February 2019
Intermediate to advanced
626 pages
15h 51m
English
Many classes (or types) implement a constructor that does not require any arguments, for example, ADSISearcher (the type accelerator for System.DirectoryServices.DirectorySearcher).
An instance of the searcher may be created as follows, using one of the available constructors:
$searcher = [ADSISearcher]::new( [ADSI]'LDAP://domain.com', '(&(objectClass=user)(objectCategory=person))')$searcher.PageSize = 1000
Alternatively, it can be created from a hashtable, which can be easier to read, as each of the arguments has a clear name:
$searcher = [ADSISearcher]@{ SearchRoot = [ADSI]'LDAP://domain.com' Filter = '(&(objectClass=user)(objectCategory=person))' PageSize = 1000}
This technique is especially useful for ...
Read now
Unlock full access