Old Monad script does not work when used with powershell

Discussion in 'Scripting' started by Moonrox, Nov 4, 2006.

  1. Moonrox

    Moonrox Guest

    $searcher.SearchScope = [System.DirectoryServices.SearchScope].subtree

    Exception setting "SearchScope": "Cannot convert null to type
    "System.Directory
    Services.SearchScope" due to invalid enumeration values. Specify one of the
    fol
    lowing enumeration values and try again. The possible enumeration values are
    "B
    ase, OneLevel, Subtree"."
    At C:\scripts\pdriveclean.ps1:18 char:11
    + $searcher.S <<<< earchScope = [System.DirectoryServices.SearchScope].subtree
     
    Moonrox, Nov 4, 2006
    #1
    1. Advertisements

  2. Moonrox

    Marco Shaw Guest

    $searcher.SearchScope = [System.DirectoryServices.SearchScope].subtree
    There's a new microsoft.public.windows.powershell group.
     
    Marco Shaw, Nov 4, 2006
    #2
    1. Advertisements

  3. Moonrox

    moonrox Guest

    Thanks I thought that this was visible on that site also. also if I move
    the [] brackets I get the following error.

    Unable to find type [System.DirectoryServices.SearchScope.subtree]: make sure
    hat the assembly containing this type is loaded.
    At C:\scripts\hines\pdrive\pdriveclean.ps1:18 char:71
    + $searcher.SearchScope = [System.DirectoryServices.SearchScope.subtree] <<<<
    --
    DDO


     
    moonrox, Nov 4, 2006
    #3
  4. Moonrox

    dreeschkind Guest

    I'm not a DiretoryServices guy, but I think what you want is this:

    PS> [System.DirectoryServices.SearchScope]::Subtree

    Static methods/properties are called using "::" instead of "."
    Use this to see all static members:

    PS> [System.DirectoryServices.SearchScope] | get-member -static

    --
    greetings
    dreeschkind

     
    dreeschkind, Nov 5, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.