SizeLimit Specifies the total amount of records to request By default a maximum

Sizelimit specifies the total amount of records to

This preview shows page 249 - 257 out of 257 pages.

SizeLimit - Specifies the total amount of records to request. By default a maximum of 1000 are returned unless PageSize is set. PageSize - Specifies the maximum number of objects that are returned in a paged search. It is recommended to always set it to 1000 so it pages in the background result. SearchRoot - Specifies the Domain from where to run, it can be set to a domain and it will detect and query the first GC for it or bind it to a specific GC using LDAP or GC provider path. SearchScope - Specifies the possible scopes for a directory search. Scopes are Base, OneLevel or Subtree (default). 249
Image of page 249
Fundamentals of Leveraging PowerShell - DEFCON Searching AD 250
Image of page 250
Fundamentals of Leveraging PowerShell - DEFCON Searching AD 251
Image of page 251
Fundamentals of Leveraging PowerShell - DEFCON Searching AD 252
Image of page 252
Fundamentals of Leveraging PowerShell - DEFCON Searching AD Methods to perform a search: FindOne() - Executes the search and returns only the first entry that is found. FindAll() - Executes the search and returns a collection of the entries that are found. 253
Image of page 253
Fundamentals of Leveraging PowerShell - DEFCON Searching AD A Service Principal Name is the name by which a client uniquely identifies an instance of a service for use in Kerberos Authentication. All Microsoft services that support Kerberos authentication register themselves under the host account. The format for a SPN entry is <service class>/<host>:<port>/<service name> where port and service name are optional 254
Image of page 254
Fundamentals of Leveraging PowerShell - DEFCON Searching AD Some known SPN Classes: TERMSRV - Remote Desktop SmtpSVC and SMTP - Mail. WSMAN - WinRM ExchangeAB, ExchageRFR and ExchangeMDM - MS Exchange services POP/POP3 - POP3 mail service. IMAP/IMAP4 - IMAP service. MSSQLSvc - Microsoft SQL Server GC - Global Catalog DNS - DNS Server HTTP - Web Server ldap - LDAP Server Dfsr - File Server participating in DFRS 255
Image of page 255
Fundamentals of Leveraging PowerShell - DEFCON Searching AD Example of searching for MSSQL Servers: 256 $filter = '(&(objectCategory=computer)(servicePrincipalName=MSSQLSvc*))' $searcher = [ adsisearcher ] $filter $searcher . PageSize = 1000 $searcher . FindAll()
Image of page 256
Fundamentals of Leveraging PowerShell - DEFCON General Tips for Searching AD To generate a date in ADSI format for filtering: To generate a TimeSpan object used to New-TimeSpan cmdlet: Each returned object is not an instance of the object found but a System.DirectoryServices.SearchResult object. To make in to an instance we can then use [ADSI] accelerator. 257 $timeFilter = [ datetime ] '8/3/14' $timeFilter . ToString( "yyyyMMddhhmmss.sZ" ) $timeSpan = New-TimeSpan -Days 1 $timeSpan = New-TimeSpan -Hours 1 $timeSpan = New-TimeSpan -Minutes 1 $timeSpan = New-TimeSpan -Seconds 60 $searcher . FindAll() | ForEach-Object { [ adsi ] $_ . Path}
Image of page 257

You've reached the end of your free preview.

Want to read all 257 pages?

  • Fall '18
  • fasdfasdfasd
  • Test, Windows PowerShell, Windows Management Instrumentation

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes