Forum Discussion
Sandesh_Gowda777
Jan 19, 2020Copper Contributor
Power Shell script
Hi All,
I have requirement to automate and get all the running services details on different remote computers in one go,how it can be achieved this using power shell scripting.
All the remote computers have same user credentials
Please help.
Below are the steps I tried and I am stuck in
Enter-pssession -computername qwerty -credential
after above command ,how can I pass next command to be running on a remote machine from the script file .ps1
I have requirement to automate and get all the running services details on different remote computers in one go,how it can be achieved this using power shell scripting.
All the remote computers have same user credentials
Please help.
Below are the steps I tried and I am stuck in
Enter-pssession -computername qwerty -credential
after above command ,how can I pass next command to be running on a remote machine from the script file .ps1
Enter-PSSession is for *interactive* remoting, not for use with scripts. Use Invoke-Command instead, or simply use the -ComputerName parameter for Get-Service: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-service?view=powershell-5.1
1 Reply
Enter-PSSession is for *interactive* remoting, not for use with scripts. Use Invoke-Command instead, or simply use the -ComputerName parameter for Get-Service: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-service?view=powershell-5.1