Skip to content

Instantly share code, notes, and snippets.

@MartinMiles
Last active July 25, 2019 16:29
Show Gist options
  • Save MartinMiles/921d125ec9f784923575f38803b1817f to your computer and use it in GitHub Desktop.
Save MartinMiles/921d125ec9f784923575f38803b1817f to your computer and use it in GitHub Desktop.
This is a sample of WinRm code execution in a context of remote machine
$pass = ConvertTo-SecureString -AsPlainText '123' -Force
$Cred = New-Object System.Management.Automation.PSCredential -ArgumentList 'Martin',$pass
Invoke-Command -ComputerName 192.168.173.14 -ScriptBlock { Get-ChildItem C:\ } -credential $Cred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment