neo1491 has asked for the wisdom of the Perl Monks concerning the following question:
but I can't seem to find anything that identifies the system I'm using as a Windows 2008 OS without going to extraordinary lengths like:#!C:/Perl/bin/perl.exe -w use Config; use strict; print "\nOS name: ".$Config{'osname'}; print "\nOS archname: ".$Config{'archname'}; print "\nOS version: ".$Config{'osvers'};
... which gives me "Microsoft<< Windows Server<< 2008 Enterprise#!C:/Perl/bin/perl.exe -w use Win32::OLE qw(in with); $host = "127.0.0.1"; $WMI = Win32::OLE->new('WbemScripting.SWbemLocator') || die "Cannot access WMI on local machine: ", Win32::OLE->LastError; $Services = $WMI->ConnectServer($host) || die "Cannot access WMI on remote machine: ", Win32::OLE->LastError; $os_set = $Services->InstancesOf("Win32_OperatingSystem"); foreach $os (in($os_set)) { $os_name = $os->{'Caption'}; } print "$os_name\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding OS Version and Win2K8
by BrowserUk (Patriarch) on May 23, 2008 at 04:31 UTC | |
by Burak (Chaplain) on May 23, 2008 at 08:26 UTC | |
by neo1491 (Beadle) on May 23, 2008 at 13:36 UTC | |
|
Re: Finding OS Version
by Khen1950fx (Canon) on May 22, 2008 at 22:05 UTC | |
by neo1491 (Beadle) on May 22, 2008 at 22:48 UTC | |
by Khen1950fx (Canon) on May 22, 2008 at 23:18 UTC | |
by Burak (Chaplain) on May 23, 2008 at 08:14 UTC |