Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChrisTitusTech/53da38b28dbfcf5b18b3f9ba2082693d to your computer and use it in GitHub Desktop.
Save ChrisTitusTech/53da38b28dbfcf5b18b3f9ba2082693d to your computer and use it in GitHub Desktop.

Revisions

  1. @Celoxocis Celoxocis created this gist Apr 4, 2018.
    13 changes: 13 additions & 0 deletions Powershell – Disable Drive Indexing
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    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:"