Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

I'm trying to create a P3 script that stop/start services on 3 servers in order.

$
0
0

connect to 3 servers and stop 2 services on each server first and then go back (in order..server 1, server 2, server 3) and then start those 2 services on each.

I tried this one but it's not making it through each server..

$s = New-PSSession -computername server1, server2, server3

invoke-command 

-session $s {stop-service service1;stop-service service2}

invoke-command  -session $s {start-service service1;start-service service2}


Viewing all articles
Browse latest Browse all 2562

Trending Articles