$RemoteMachines = '1598.domain.com', '1599.domain.com' | |
$adminname = 'user.name' | |
$adminpassword = 'YourPassword' | |
$password = ConvertTo-SecureString $adminpassword -AsPlainText -Force | |
$cred = New-Object System.Management.Automation.PSCredential (".\$adminname", $password) | |
$SessionOptions = New-PSSessionOption –SkipCACheck –SkipCNCheck –SkipRevocationCheck | |
$PSSession = New-PSSession -ComputerName $RemoteMachines -Port 5986 -UseSSL -Authentication Credssp -Credential $cred -SessionOption $SessionOptions | |
# Do stuff | |
Invoke-Command -Session $PSSession -ScriptBlock { | |
gci C: | |
whoami | |
} | |
Get-PSSession | Remove-PSSession |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment