Lofty Worm
asked on
Reboot all computer is OU at TIME
Can someone tell me why this is failing (and how to fix it)??
Get-ADComputer -Filter * -SearchBase "OU=Test, OU=Hanger,OU=Planes Computers,DC=notmydomain,D C=com" |restart-computer $_.name
I have confirmed the first part works. As a minor side question, how could I get the first part to output only the name with no title like "BOB" and not "Name: BOB"
Thanks for your help!!!
Get-ADComputer -Filter * -SearchBase "OU=Test, OU=Hanger,OU=Planes Computers,DC=notmydomain,D
I have confirmed the first part works. As a minor side question, how could I get the first part to output only the name with no title like "BOB" and not "Name: BOB"
Thanks for your help!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, I tested this with replacing the restart with write-host, and it seemed to work. I will set up my OU again, and test the restart :)
Any thought on my second minor question? what I should be learning??You can just expand the name property to get only names..
Get-ADComputer -Filter * -SearchBase "OU=Test, OU=Hanger,OU=Planes Computers,DC=notmydomain,DC=com" | Select -ExpandProperty Name
Or use foreach to print just value..Get-ADComputer -Filter * -SearchBase "OU=Test, OU=Hanger,OU=Planes Computers,DC=notmydomain,DC=com" | ForEach-Object {$_.Name}
Here $_.Name represent the value of the property Name.
ASKER
Fast and accurate, even with the follow up, THANK YOU!
ASKER
Any thought on my second minor question? what I should be learning??