locked
Disable Indexing for Mount Points RRS feed

  • Question

  • Hi All,

    I am looking for a way to disable indexing on mountpoints. I have the below script to disable indexing on drive letters but I cannot figure out how to do this for moint ponts. Any help is appreciated.

    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:"

    Thanks Gaz.

    Tuesday, January 9, 2018 1:05 PM

All replies

  • $v = Get-WmiObject -Class Win32_Volume -Filter "DriveLetter='D:'"
    $v.IndexingEnabled = $false
    $v.Put()
    


    \_(ツ)_/

    • Proposed as answer by BOfH-666 Tuesday, January 9, 2018 3:47 PM
    Tuesday, January 9, 2018 3:15 PM
  • We can also do this like this:

    Get-CimInstance -ClassName Win32_Volume -Filter "DriveLetter='D:'" |
        Set-CimInstance -Property @{IndexingEnabled=$false}


    \_(ツ)_/

    Tuesday, January 9, 2018 3:55 PM
  • Thanks for the info. One of the issues that I am having is that the Mount Points are not associated to any driver letter so when I filter by drive letter I can disable indexing for that drive letter but it does not disable indexing for the mount points. If I run Get-WmiObject -Class Win32_Volume the output I get for a mount point is below.

    Is there a way I an filter by Caption or Name?  Can I filter for Null if the driverletter has no info?

    __GENUS                      : 2
    __CLASS                      : Win32_Volume
    __SUPERCLASS                 : CIM_StorageVolume
    __DYNASTY                    : CIM_ManagedSystemElement
    __RELPATH                    : Win32_Volume.DeviceID=
    __PROPERTY_COUNT             : 44
    __DERIVATION                 : {CIM_StorageVolume, CIM_StorageExtent, CIM_LogicalDevice, CIM_LogicalElement..
    __SERVER                     : TEST123
    __NAMESPACE                  : root\cimv2
    __PATH                       : \\TEST123\root\cimv2:Win32_Volume.DeviceID="\\\\?\\Volume{abc123}\\"
    Access                       :
    Automount                    : True
    Availability                 :
    BlockSize                    : 65536
    BootVolume                   : False
    Capacity                     : 8001389854720
    Caption                      : D:\testvol\Vol25\
    Compressed                   :
    ConfigManagerErrorCode       :
    ConfigManagerUserConfig      :
    CreationClassName            :
    Description                  :
    DeviceID                     : \\?\Volume{abc123}\
    DirtyBitSet                  : False
    DriveLetter                  :
    DriveType                    : 3
    ErrorCleared                 :
    ErrorDescription             :
    ErrorMethodology             :
    FileSystem                   : ReFS
    FreeSpace                    : 7959582146560
    IndexingEnabled              :
    InstallDate                  :
    Label                        : Vol25
    LastErrorCode                :
    MaximumFileNameLength        : 255
    Name                         : D:\TEST123\Vol25\

    Tuesday, January 9, 2018 4:09 PM
  • Mount points are not indexed by default.


    \_(ツ)_/

    Tuesday, January 9, 2018 4:13 PM
  • Thanks again. It does appear to be disabled according to the PowerShell output. This may be a questions for another forum but do you have any idea why the GUI is showing it as enabled? 

    The mount points are located on D:\ and indexing has been disabled for the D:\ drive and all subfolder/files.

    Tuesday, January 9, 2018 4:23 PM
  • Hi,

    I'm checking how the issue is going, was your issue resolved?

    And if the replies as above are helpful, we would appreciate you to mark them as answers, and if you resolve it using your own solution, please share your experience and solution here. It will be greatly helpful to others who have the same question.

    Appreciate for your feedback.

    Best Regards,
    Albert

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, January 10, 2018 11:40 AM