2013-01-25 48 views

回答

0

試試這個,(未測試):

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-indexing "c:" 
+0

謝謝。我在這個論壇上找到了相同的內容[link](http://powershellcommunity.org/Forums/tabid/54/aft/7644/Default.aspx) – igor012