Posts Tagged Registry
Determining Client OS Version
Posted by admin in Powershell on October 5, 2009
Using powershell to query the registry, either local or remote, to determine the OS version being used:
1 2 3 4 | $MachineName = $Args[0]
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $MachineName)
$regKey= $regKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" ,$False)
$regkey.getvalue('ProductName') |
Or by using WMI and also discovering whether the client is 32 or 64 bit:
1 | gwmi Win32_OperatingSystem -computer "." | select-object Caption , OSArchitecture |