Created
April 4, 2018 13:58
-
-
Save Celoxocis/ac0726f823827cbbff2938b9e682fbdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Disable-Indexing { | |
Param($Drive) | |
$obj = Get-WmiObject -Class Win32_Volume -Filter "DriveLetter='$Drive'" | |
$indexing = $obj.IndexingEnabled | |
if("$indexing" -eq $True){ | |
write-host "Disabling indexing of drive $Drive" | |
$obj | Set-WmiInstance -Arguments @{IndexingEnabled=$False} | Out-Null | |
} | |
} | |
#Use: | |
#Disable Drive Indexing on C:\ | |
#Disable-Indexing "C:" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment