-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConnect-VM.ps1
More file actions
27 lines (22 loc) · 886 Bytes
/
Connect-VM.ps1
File metadata and controls
27 lines (22 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<#
.SYNOPSIS
Connect-VM userName password baseUrl
.PARAMETER UserName
The userName of the user
.PARAMETER Password
The password of the user
.PARAMETER BaseUrl
Remote host in https://host:port format.
.EXAMPLE
Connect-VM -UserName user1 -Password password1 -BaseUrl https://10.10.10.10:5986
#>
param (
[Parameter(Position = 0, Mandatory=$true)]
[string]$UserName,
[Parameter(Position = 1, Mandatory=$true)]
[securestring]$Password,
[Parameter(Position = 2, Mandatory=$true)]
[string]$BaseUrl
)
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $Password
Enter-PSSession -ConnectionUri $BaseUrl -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) -Authentication Negotiate