You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OperatingSystem : Microsoft Windows 7 Professional
52
-
Vulnerable : True
53
-
AppliedHotFixIds :
54
-
SMB1FeatureEnabled : False
55
-
SMB1ProtocolEnabled : True
51
+
PSComputerName : workstation
52
+
OperatingSystemCaption : Microsoft Windows 7 Professional
53
+
OperatingSystemVersion : 6.1.7601
54
+
Vulnerable : True
55
+
AppliedHotFixIds :
56
+
SMB1FeatureEnabled : False
57
+
SMB1ProtocolEnabled : True
56
58
.Notes
57
59
Not applicable to windows 10.
58
60
.Link
@@ -135,20 +137,7 @@ begin {
135
137
"KB4015546",
136
138
"KB4015547",
137
139
"KB4015548",
138
-
"KB4015549",
139
-
"KB4015550",
140
-
"KB4015551",
141
-
"KB4015552",
142
-
"KB4015553",
143
-
"KB4015554",
144
-
"KB4016635",
145
-
"KB4019213",
146
-
"KB4019214",
147
-
"KB4019215",
148
-
"KB4019216",
149
-
"KB4019263",
150
-
"KB4019264",
151
-
"KB4019472"
140
+
"KB4015549"
152
141
)
153
142
}
154
143
@@ -157,16 +146,15 @@ process {
157
146
"ByComputerName" {
158
147
foreach ($nameValuein$Name) {
159
148
try {
160
-
Write-Progress-Activity "Testing '$nameValue' for WannaCry vulnerabilities using WMI"-CurrentOperation "Retrieve operating system caption"-PercentComplete 20
Write-Progress-Activity "Testing '$nameValue' for WannaCry vulnerabilities using WMI"-CurrentOperation "Retrieve operating system information"-PercentComplete 20
150
+
$osInformation=Get-WmiObject-ComputerName $nameValue-Class Win32_OperatingSystem -Property Caption, Version -Credential $Credential-ErrorAction Stop
163
151
} catch {
164
-
Write-Error-Message "Failed to contact WMI on '$nameValue'."-RecommendedAction "Verify WS-MAN is not being blocked by the firewall."
152
+
Write-Error-Message "Failed to query WMI on '$nameValue'."-RecommendedAction "Verify WMI access is not being blocked by the firewall."
165
153
continue
166
154
}
167
155
168
-
if ($osCaption-match"Windows 10") {
169
-
Write-Warning-Message "$osCaptionis not vulnerable to WannaCry."
156
+
if ([Version]$osInformation.Version-ge [Version]"10.0.15063") {
157
+
Write-Warning-Message "$($osInformation.Caption)$($osInformation.Version)is not vulnerable to the WannaCry Exploit."
170
158
continue
171
159
}
172
160
@@ -208,7 +196,8 @@ process {
208
196
209
197
$output= [PSCustomObject]@{
210
198
PSComputerName=$nameValue
211
-
OperatingSystem=$osCaption
199
+
OperatingSystemCaption=$osInformation.Caption
200
+
OperatingSystemVersion=$osInformation.Version
212
201
Vulnerable=$vulnerable
213
202
AppliedHotFixIds=$appliedHotFixIds-join"|"
214
203
SMB1FeatureEnabled=$smb1FeatureEnabled
@@ -222,11 +211,10 @@ process {
222
211
"ByCimSession" {
223
212
foreach ($cimSessionValuein$CimSession) {
224
213
Write-Progress-Activity "Testing '$nameValue' for WannaCry vulnerabilities using CIM"-CurrentOperation "Retrieve operating system caption"-PercentComplete 20
0 commit comments