Restart a Windows service using PowerShell (require Administrator permissions).
# Enter into a new session
$session = New-PSsession -Computername "RemoteComputer"
# Execute PowerShell script remotely
Invoke-Command -Session $session -ScriptBlock { Restart-Service -Name "W3SVC" -PassThru }
# Disconnect the Session
Remove-PSSession $session