Skip to content

Instantly share code, notes, and snippets.

@pallid
Created November 19, 2015 14:23
Show Gist options
  • Save pallid/534b33e2540c7a01cf36 to your computer and use it in GitHub Desktop.
Save pallid/534b33e2540c7a01cf36 to your computer and use it in GitHub Desktop.
PowerShell заметки
winrm create winrm/config/listener?Address=*+Transport=HTTP
winrm create winrm/config/listener?Address=IP:192.168.25.209+Transport=HTTP
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/client '@{TrustedHosts="<local>"}'
winrm set winrm/config/client '@{TrustedHosts="192.168.25.209"}'
//CMD
winrs –r:192.168.25.210 Get-Process| Format-Table Name,StartTime -AutoSize
//PS
//Получить на удаленной машине процесс запущенный процессы и время их запуска
$cred = (new-object -typename System.Management.Automation.PSCredential -argumentlist "ServName\User",(convertto-securestring "PASS" -asplaintext -force));
Invoke-Command -ComputerName 'ServName' -Credential $cred -ScriptBlock{Get-Process| Format-Table Name,StartTime -AutoSize}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment