Skip to content

Instantly share code, notes, and snippets.

@marckean
Last active December 7, 2016 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marckean/1143ab0cad0e7a11476734b1b3229610 to your computer and use it in GitHub Desktop.
Save marckean/1143ab0cad0e7a11476734b1b3229610 to your computer and use it in GitHub Desktop.
#To connect
$ServerName = "ServerName.cloudapp.net"
$port = '5986'
#region creds
$adminname = 'user.name'
$adminpassword = 'paasword'
#endregion
$password = ConvertTo-SecureString $adminpassword -AsPlainText -Force
$cred= New-Object System.Management.Automation.PSCredential (".\$adminname", $password)
### Enter session
$SessionOptions = New-PSSessionOption –SkipCACheck –SkipCNCheck –SkipRevocationCheck
Enter-PSSession -ComputerName $ServerName -Port $port -UseSSL -Credential $cred -SessionOption $SessionOptions
#Do Stuff...
#To disconnect
Exit-PSSession
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment