Skip to content

Instantly share code, notes, and snippets.

@Kaidja
Created September 18, 2021 18:30
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 Kaidja/43b74e51cbdd3b0b5fb0dab3ed9e876e to your computer and use it in GitHub Desktop.
Save Kaidja/43b74e51cbdd3b0b5fb0dab3ed9e876e to your computer and use it in GitHub Desktop.
#Get the credentials and open a remote session
$ServerName = ("SRV02").ToUpper()
$Credentials = Get-Credential
$PSRemoteSession = New-PSSession -ComputerName $ServerName -Credential $Credentials
Write-Output "PowerShell remote session status: $($PSRemoteSession.State)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment