Skip to content

Instantly share code, notes, and snippets.

@adbertram
Created February 2, 2016 22:12
Show Gist options
  • Save adbertram/b00d5c5e37a9d249fab7 to your computer and use it in GitHub Desktop.
Save adbertram/b00d5c5e37a9d249fab7 to your computer and use it in GitHub Desktop.
$date = get-date
if (get-eventlog -logname system -source disk -newest 1 | where-object { [dateTime]$_.Time -eq $date })
{
GET-WMIOBJECT –class win32_logicaldisk | where { $_.DriveType -eq 3 } | foreach { fsutil dirty set $_.DeviceID }
}
else
{
Write-Output "nothing to do!"
start-sleep -s 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment