Skip to content
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

$checkShadow is $null when no shadow copies exist #7

Open
nmanzi opened this issue Jul 26, 2021 · 1 comment
Open

$checkShadow is $null when no shadow copies exist #7

nmanzi opened this issue Jul 26, 2021 · 1 comment

Comments

@nmanzi
Copy link

nmanzi commented Jul 26, 2021

On at least Windows 10 20H2 (19042.1110), Get-WmiObject Win32_ShadowStorage returns $null when shadow copies are not configured and none exist.

This lead to $fixed = $false, when in fact the issue is fixed.

Recommend updating to the following:

#check shadow
if ($vulnerable -eq $true) {
    $checkShadow = Get-WmiObject Win32_ShadowStorage -Property UsedSpace | Select-Object -ExpandProperty UsedSpace
    if ((0 -eq $checkShadow) -or ($null -eq $checkShadow)) {
        $shadowSucces = $true
        Write-Host "Successfully deleted old volume shadow copies."
    }
    else {
        $shadowSucces = $false
        write-host "Shadow deletion failed. Security software may be blocking this action or check running permissions."
    }
}

if (0 -eq $checkShadow) {

@GossiTheDog
Copy link
Owner

Ooops, good shout, this will need fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants