Avatar of Kelly Garcia
Kelly Garcia
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Powershell Test connection then mstsc

Hi All,

I have this line of code that test connection for servers:

PS G:\> Test-Connection -ComputerName  sdindc01, sraddc01, sdendc01, senadc01, sewcdc01, solidc01 -Count 1 | selec
t address

Open in new window


if the ping is successful I then want to Mstsc in to the servers, I've tried:
$t=Test-Connection -ComputerName  sdindc01, sraddc01, sdendc01, senadc01, sewcdc01, solidc01 -Count 1 | selec
t address
$t | % {mstsc /v:$_}

Open in new window


However this does not work. please help
PowershellMicrosoft Server OSNetworking

Avatar of undefined
Last Comment
Jeremy Weisinger

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jeremy Weisinger

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jeremy Weisinger

Glad to help. :)
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck