Thursday, March 30, 2017

Windows PowerShell

Running Remote Command with Windows PowerShell inside WORKGROUP

on each machine:
  • run powershell as admin 
  • Enable-PSRemoting
  • Set-Item wsman:\localhost\client\trustedhosts *
  • Restart-Service WinRM 
frequently used commands:
  • Get-Service winrm
  • Stop-Computer -Force
  • Enter-PSSession -ComputerName <ip_addr> -Credential <username>
  • Exit-PSSession
  • Invoke-Command -ComputerName <ip_addr> Stop-Computer -Force
  • Set-ExecutionPolicy remotesigned : To run unsigned PowerShell script