Created
August 24, 2016 17:41
-
-
Save mikebranstein/394b05a27df0bd16861d946e0a716be7 to your computer and use it in GitHub Desktop.
Establish a remote PowerShell session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$username = "administrator" | |
$password = "your-super-secret-password" | |
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force | |
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $securePassword | |
$pstimeout = New-PSSessionoption -OperationTimeout (1000*60*5) | |
$session = New-PSSession -computer $ipAddress -Credential $cred -ErrorAction Stop -SessionOption $pstimeout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment