Powershell to List All Active Windows 2012 Servers from Active Directory

Powershell to List All Active Windows 2012 Servers from Active Directory

Import-ModuleActiveDirectory

Set-Location AD:

Get-ChildItem

#Set-Location “OU=Server Infrastructure,dc=rickyadams,dc=com”

Get-ADComputer-LDAPFilter“((objectcategory=computer)(&(operatingsystem=*Server 2012*))(&(!(userAccountControl:1.2.840.113556.1.4.803:=2))))” -Property *-SearchBase“OU=Server Infrastructure,DC=ia,DC=doi,DC=net”| Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap-Auto

Comments are closed.