mirror of
https://github.com/sstent/Scripts.git
synced 2026-01-26 15:12:27 +00:00
added scripts and SUPERMICRO
This commit is contained in:
22
listdomain.ps1
Normal file
22
listdomain.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
$strFilter = "computer"
|
||||
|
||||
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
|
||||
$objOU = New-Object System.DirectoryServices.DirectoryEntry("LDAP://DC=bnwww,DC=prod,DC=bn")
|
||||
|
||||
|
||||
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
|
||||
$objSearcher.SearchRoot = $objOU
|
||||
$objSearcher.SearchScope = "Subtree"
|
||||
$objSearcher.PageSize = 1000
|
||||
|
||||
$objSearcher.Filter = "(objectCategory=$strFilter)"
|
||||
|
||||
$colResults = $objSearcher.FindAll()
|
||||
|
||||
foreach ($i in $colResults)
|
||||
{
|
||||
$objComputer = $i.GetDirectoryEntry()
|
||||
if ((gwmi Win32_PingStatus -Filter "Address='$objComputer.Name'").StatusCode <EFBFBD>eq 0){
|
||||
write-host $objComputer.Name
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user