Hi guys,
my Name is Lev,
first off all i want to thank you that you’ve opened this kind of web site.
i’ve seen all the series of first part of powershell on MVA, to day i’ve started to watch the second one which “Advanced Tools & Scripting with PowerShell 3.0 Jump Start”
i’m in powershell almost 2 weeks now and i can tell you that as an experienced system administrator (over 10+ of experience), i don’t understand how the hell i’ve managedto get to 2018 without the knowledge of the use of powershell ! (shame on me !)
so now i’m starting to play with powershell and i’ve managed to do some stuff and i’m learning very fast, but still need some guidance (don’t want the answer… it’s not fun )
for now, i’m trying something simple as getting test-connection to all the pc’s in my computers ou
here is the script:
$pc=Get-ADComputer -Filter * -SearchBase "ou=computers,ou=blah,ou=blah,dc=blah,dc=local" ForEach ($PSItem in $pc) { write-host "now testing connection to $pc" Test-Connection -ComputerName $pc }
when i run the script, i’m getting this error
Test-Connection : Testing connection to computer 'CN=LEVL-01,OU=blah,OU=blah,OU=blah,DC=blah,DC=local' failed: No such host is known At line:7 char:3 + Test-Connection -ComputerName $pc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (CN=LEVL-01,OU=C...C=blah,DC=local:String) [Test-Connection], PingException + FullyQualifiedErrorId : TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand
the problem is that if i run test-connection only for one computer it’s working ok (levl-01 is my localhost, the one that i’m writing this message from… so it’s alive )
thanks alot for your help !
*notes: i didn’t use “-quite” for a reason, i want to see that it working.