-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOSVer.vbs
More file actions
123 lines (116 loc) · 4.96 KB
/
OSVer.vbs
File metadata and controls
123 lines (116 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
'
' Windows Embedded POSReady 2009
' Last Rev: August 26, 2008
'
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strWPAKeyPath = "SYSTEM\WPA\"
strWPAValueName = "Installed"
dwWPAValue = 0
strAppKeyPath = "SOFTWARE\Microsoft\"
strAppVersion = "Version"
strAppBuild = "Build"
strAppVersionValue = ""
strAppBuildValue = ""
Set objWMIRegistry = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colWPA = objWMIService.ExecQuery ("Select * from Win32_WindowsProductActivation")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
Set colComputerSystem = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
'----------------------------------------------------
' Operating System
'----------------------------------------------------
objWMIRegistry.GetDWORDValue HKEY_LOCAL_MACHINE, "SYSTEM\WPA\WES", strWPAValueName, dwWPAValue
If dwWPAValue = 1 Then
strApp = "WES"
Else
objWMIRegistry.GetDWORDValue HKEY_LOCAL_MACHINE, "SYSTEM\WPA\POSReady", strWPAValueName, dwWPAValue
If dwWPAValue = 1 Then
strApp = "POSReady"
Else
objWMIRegistry.GetDWORDValue HKEY_LOCAL_MACHINE, "SYSTEM\WPA\WEPOS", strWPAValueName, dwWPAValue
If dwWPAValue = 1 Then
strAPP = "WEPOS"
Else
strApp = "Windows"
End If
End If
End If
If strApp = "Windows" Then
For Each objOperatingSystem in colOperatingSystems
strInfo = strInfo & "PRODUCT:" & vbTab & objOperatingSystem.Caption & vbCrLf
strInfo = strInfo & vbTab & vbTab & objOperatingSystem.Version & " (" & objOperatingSystem.CSDVersion & ")" & vbCrLf & vbCrLf
strOSMajorVer = Left(objOperatingSystem.Version,1)
Next
Else
If strApp = "WES" Then
strInfo = strInfo & "PRODUCT:" & vbTAB & "Windows Embedded Standard" & vbCrLf & vbCrLf
For Each objOperatingSystem in colOperatingSystems
strInfo = strInfo & "BASED ON:" & vbTab & objOperatingSystem.Caption & vbCrLf
strInfo = strInfo & vbTab & vbTab & objOperatingSystem.Version & " (" & objOperatingSystem.CSDVersion & ")" & vbCrLf & vbCrLf
strOSMajorVer = Left(objOperatingSystem.Version,1)
Next
Else
If strApp = "POSReady" Then
strInfo = strInfo & "PRODUCT:" & vbTab & "Windows Embedded POSReady 2009" & vbCrLf
Else
strInfo = strInfo & "PRODUCT:" & vbTab & "Windows Embedded for Point of Service" & vbCrLf
End If
For Each objOperatingSystem in colOperatingSystems
If objOperatingSystem.SuiteMask And 64 Then
objWMIRegistry.GetStringValue HKEY_LOCAL_MACHINE, strAppKeyPath & strApp, strAppVersion, strAppVersionValue
objWMIRegistry.GetStringValue HKEY_LOCAL_MACHINE, strAppKeyPath & strApp, strAppBuild, strAppBuildValue
strInfo = strInfo & vbTab & vbTab & "Version: "
If strAppVersionValue Then
strInfo = strInfo & strAppVersionValue
Else
strInfo = strInfo & "1.0"
End If
If strAppBuildValue <> "" Then
strInfo = strInfo & " (" & strAppBuildValue & ")"
End If
strInfo = strInfo & vbCrLf & vbCrLf
End if
strInfo = strInfo & "BASED ON:" & vbTab & objOperatingSystem.Caption & vbCrLf
strInfo = strInfo & vbTab & vbTab & objOperatingSystem.Version & " (" & objOperatingSystem.CSDVersion & ")" & vbCrLf & vbCrLf
strOSMajorVer = Left(objOperatingSystem.Version,1)
Next
End If
End If
'----------------------------------------------------
' Computer System
'----------------------------------------------------
strInfo = strInfo & "COMPUTER:"
For Each objComputerSystem in colComputerSystem
strInfo = strinfo & vbTab & objComputerSystem.Manufacturer & vbCrLf
strInfo = strinfo & vbTab & vbTab & objComputerSystem.Model & vbCrLf & vbCrLf
Next
'----------------------------------------------------
' Registration
'----------------------------------------------------
For Each objOperatingSystem in colOperatingSystems
strInfo = strInfo & "REGISTRATION:"
strInfo = strInfo & vbTab & objOperatingSystem.RegisteredUser & vbCrLf
strInfo = strInfo & vbTab & vbTab & objOperatingSystem.Organization & vbCrLf & vbCrLf
Next
'----------------------------------------------------
' Evaluation Period
'----------------------------------------------------
If strApp = "POSReady" Then
For Each objWPA in colWPA
strInfo = strInfo & "LICENSE:"
If (objWPA.RemainingEvaluationPeriod > 2000000000) Then
strInfo = strInfo & vbTab & "Unlimited" & VBCR & VBLF
Else
strInfo = strInfo & vbTab & "Evaluation" & vbCrLf
strInfo = strInfo & vbTab & vbTab & objWPA.RemainingEvaluationPeriod & " Days Remaining" & VBCR & VBLF
End If
Next
End If
'----------------------------------------------------
' Display results
'----------------------------------------------------
Wscript.Echo strInfo
'----------------------------------------------------
' End of script
'----------------------------------------------------