I have two servers Server A and Server B. I want to stop server A from Server B remotely using Powershell script.
Option 1:
iisreset remotepcname /restart
Option 2:
(Get-Service -ComputerName remotepc -Name 'IISAdmin').stop()
Option 3:
Invoke-Command -ComputerName remotepc -ScriptBlock {iisreset}