-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetTrustedHosts.ps1
38 lines (27 loc) · 1.32 KB
/
SetTrustedHosts.ps1
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
30
31
32
33
34
35
36
37
38
# Configuring TrustedHosts
# Enter session with IP Address to DC01
$ServerIP = '192.168.68.99'
Invoke-Command -ComputerName $ServerIP -ScriptBlock {
Get-computerInfo | select-object -Property CsName,CsDomain,WindowsProductName}
$Credential = Get-Credential
Invoke-Command -ComputerName $ServerIP -Credential $Credential -ScriptBlock {
Get-computerInfo | select-object -Property CsName,CsDomain,WindowsProductName}
# Enter Session to server01
$ComputerName = "Server01"
$Credential = Get-Credential
Invoke-Command -ComputerName $ComputerName -Credential $Credential -ScriptBlock {
Get-computerInfo | select-object -Property CsName,CsDomain,WindowsProductName}
# Error
get-item WSMan:\localhost\Client\TrustedHosts
set-item WSMan:\localhost\Client\TrustedHosts -Value "*"
# Test remoting to IP
$ServerIP = '192.168.68.99'
$Credential = Get-Credential
Invoke-Command -ComputerName $ServerIP -Credential $Credential -ScriptBlock {
Get-computerInfo | select-object -Property CsName,CsDomain,WindowsProductName}
# Test remoting to non-domain computer
$ComputerName = 'Server01'
$Credential = Get-Credential
Invoke-Command -ComputerName $ComputerName -Credential $Credential -ScriptBlock {
Get-computerInfo | select-object -Property CsName,CsDomain,WindowsProductName}
set-item WSMan:\localhost\Client\TrustedHosts -Value ""