Im wondering if its posible to detect windows CE in a windows logon script ( Scrip runs in the user account ).
I assume its posible to detect this via some checking for some file, but i was hoping for a bit "cleaner" so开发者_Go百科lution.
You can use the below code to check against the Windows version in VBscript using WMI. Replace the XXXXXXXXX with the appropriate version number.
strComputer = "." 'We are using computer "here"
set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2") 'Initialize WMI object for this computer
'Displays which operating system is installed on the current computer.
set colOperatingSystems = objWMIService.ExecQuery _
("Select Caption, Version from Win32_OperatingSystem") 'Query WMI for OS Version
'Validate that OS version is valid
for each objOperatingSystem in colOperatingSystems ' Parse results
if objOperatingSystem.Version = "XXXXXXXXX" Then
'Do something here
end if
next
If you're not sure what the version is, try changing the if/then statement temporarily to
WScript.Echo objOperatingSystem.Version
and running it manually. That will output the correct version # for your system.
精彩评论