Skip to content

Commit 4a1f7ea

Browse files
committed
Replace Get-WMIObject with Get-CimInstance
1 parent c8e46d0 commit 4a1f7ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Find-L4JVulnerabilities.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,18 @@ switch ($usrMitigate) {
314314
#map input variable usrScanScope to an actual value
315315
if($EverythingSearch) {
316316
Write-Log -Text "Everything search requested. Scanning all possible drives."
317-
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
317+
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
318318
} else {
319319
switch ($usrScanScope) {
320320
1 {
321321
Write-Log -Text "- Scan scope: Home Drive"
322322
$script:varDrives = @($env:HomeDrive)
323323
} 2 {
324324
Write-Log -Text "- Scan scope: Fixed & Removable Drives"
325-
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
325+
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
326326
} 3 {
327327
Write-Log -Text "- Scan scope: All drives, including Network"
328-
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
328+
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
329329
} default {
330330
Write-Log -Text "ERROR: Unable to map scan scope variable to a value. (This should never happen!)" -Type ERROR
331331
Write-Log -Text "The acceptable values for env:usrScanScope are:" -Type ERROR

0 commit comments

Comments
 (0)