-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnect-RDP.ps1
More file actions
29 lines (23 loc) · 858 Bytes
/
Connect-RDP.ps1
File metadata and controls
29 lines (23 loc) · 858 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
28
29
Function Connect-RDP {
Param (
[Parameter(Mandatory=$True,
HelpMessage="Enter a ComputerName"
)]
[string]
[Alias("cn","comp")]
$ComputerName
)
Function Get-DnsHostName {
Param (
[Parameter(Mandatory=$True,
HelpMessage="Enter a ComputerName"
)]
[string]
[Alias("cn","comp","ComputerName")]
$Host
)
Return [System.Net.Dns]::GetHostByAddress( [System.Net.Dns]::GetHostByName($Host).AddressList.IpAddressToString ).HostName
}
$ServerHostName = Get-DnsHostName -Host $ComputerName
Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$ServerHostName"
}