Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - How to list offline Domain Controllers

Reply
 
Old 10-19-2008   #1 (permalink)
Isaac


 
 

How to list offline Domain Controllers

Hello all,
I have written the below script to scan through the Domain Controllers
Ou and set the WINS to address listed. At the moment the script will
only return the name and IP addresses of Servers that are currently
onilne. My question is, how can I get the script to also return
atleast server name with message (Computer Offline) for servers that
are not reachable.

#get the .Net Directory Class
[void]
[reflection.assembly]::LoadWithPartialName("System.DirectoryServices.ActiveDirectory.Domain.Class")

#Get All computers from domain controllers OU

$OU=[ADSI]"LDAP://OU=Domain Controllers,DC=domainname,DC=ORG"

#Filter only computer objects from this OU

ForEach($child in $OU.psbase.children)
{
If ($child.objectcategory -like '*computer*')
{
ForEach($computer in $child.name)
{
#If NIC is Enabled and have a static IP address, set WinServer
Get-WmiObject win32_networkadapterconfiguration -ComputerName
$computer| Where-Object {$_.IPEnabled -eq 'true'} |ForEach-
Object{ $computer;$_.IPAddress;
$_.SetWinsServer("192.168.10.150","192.168.10.250")}
}
}
}

My System SpecsSystem Spec
Old 10-20-2008   #2 (permalink)
Shay Levy [MVP]


 
 

Re: How to list offline Domain Controllers

Hi Isaac,

Your question has been answered here:
http://www.powergui.org/thread.jspa?messageID=22857


---
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar: http://tinyurl.com/PSToolbar



I> Hello all,
I> I have written the below script to scan through the Domain
I> Controllers
I> Ou and set the WINS to address listed. At the moment the script will
I> only return the name and IP addresses of Servers that are currently
I> onilne. My question is, how can I get the script to also return
I> atleast server name with message (Computer Offline) for servers that
I> are not reachable.
I> #get the .Net Directory Class
I> [void]
I> [reflection.assembly]::LoadWithPartialName("System.DirectoryServices.
I> ActiveDirectory.Domain.Class")
I> #Get All computers from domain controllers OU
I>
I> $OU=[ADSI]"LDAP://OU=Domain Controllers,DC=domainname,DC=ORG"
I>
I> #Filter only computer objects from this OU
I>
I> ForEach($child in $OU.psbase.children)
I> {
I> If ($child.objectcategory -like '*computer*')
I> {
I> ForEach($computer in $child.name)
I> {
I> #If NIC is Enabled and have a static IP address, set WinServer
I> Get-WmiObject win32_networkadapterconfiguration -ComputerName
I> $computer| Where-Object {$_.IPEnabled -eq 'true'} |ForEach-
I> Object{ $computer;$_.IPAddress;
I> $_.SetWinsServer("192.168.10.150","192.168.10.250")}
I> }
I> }
I> }


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: Scripted removal of domain controllers from AD? PowerShell
Scripted removal of domain controllers from AD? PowerShell
domain controllers - up / down PowerShell
Looking for domain controllers PowerShell
Domain Controllers Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46