Skip to content

Replace Get-WMIObject with Get-CimInstance #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Find-L4JVulnerabilities.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -314,18 +314,18 @@ switch ($usrMitigate) {
#map input variable usrScanScope to an actual value
if($EverythingSearch) {
Write-Log -Text "Everything search requested. Scanning all possible drives."
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
} else {
switch ($usrScanScope) {
1 {
Write-Log -Text "- Scan scope: Home Drive"
$script:varDrives = @($env:HomeDrive)
} 2 {
Write-Log -Text "- Scan scope: Fixed & Removable Drives"
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.DriveType -eq 2 -or $_.DriveType -eq 3} | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
} 3 {
Write-Log -Text "- Scan scope: All drives, including Network"
$script:varDrives = @(Get-WmiObject -Class Win32_logicaldisk | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
$script:varDrives = @(Get-CimInstance -Class Win32_logicaldisk | Where-Object {$_.FreeSpace} | ForEach-Object {$_.DeviceID})
} default {
Write-Log -Text "ERROR: Unable to map scan scope variable to a value. (This should never happen!)" -Type ERROR
Write-Log -Text "The acceptable values for env:usrScanScope are:" -Type ERROR
Expand Down