Working in Out of Date Enviroment

Welcome Forums General PowerShell Q&A Working in Out of Date Enviroment

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
4 months, 1 week ago.

  • Author
    Posts
  • #129534

    Participant
    Points: 33
    Rank: Member

    I work for a Managed Service Provider and we just took on a client with a very messed up environment.  The issue I am trying to work through now is that they are running a Native Mode 2003 AD and the most up-to-date DC's in the environment are 2008   What do I need to install, short of updating the AD or Rebuilding it from scratch, do I need to be able to run an AD PowerShell Module to do some Recon on this AD.  I really want to Export the GPO's with out right clicking on each one.  I want to do a lot of things that I would do on a more up-to-date AD but I am not sure how to get an AD PowerShell Module to work in this environment.  I do not believe that just putting up a Jump Box with RSAT Tools on it and PowerShell 5.1 will work with a 2003 AD Will it???

    Thank

    Steve

  • #129549

    Participant
    Points: 316
    Helping Hand
    Rank: Contributor

    You can use PowerShell to leverage existing Dot Net functions to query AD and report on whatever you need.
    For example this one liner gets a list of domain controllers:

    [system.directoryservices.activedirectory.Forest]::GetCurrentForest().domains.domaincontrollers | 
                select Forest,Name,CurrentTime,OSVersion,Roles,Domain,IPAddress,SiteName
    

    or leverage LDAP to query AD via PowerShell. For example this lists enabled computer objects:

    $adsi = [adsisearcher]"objectcategory=computer"
    $adsi.PageSize = 1000000 
    $adsi.filter = "(&(objectClass=Computer)(!userAccountControl:1.2.840.113556.1.4.803:=2))" # To return only the enabled computer objects
    $adsi.FindAll() | foreach {
        $obj = $_.Properties
        [PSCustomObject][ordered]@{
            ComputerName = [string]$obj.name
            OSName       = [string]$obj.operatingsystem
            DN           = [string]$obj.distinguishedname
            AD_OU        = [string](($obj.distinguishedname) -replace '^CN=[\w\d-_]+,\w\w=','' -replace ',OU=','/' -replace ',DC=.*')
            LastLogon    = (([datetime]::FromFileTime([string]$obj.lastlogon)).ToShortDateString())
            ADCreated    = ($obj.whencreated).ToShortDateString()
        }
    }
    

The topic ‘Working in Out of Date Enviroment’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort