Closed zenaidura closed 5 years ago
This code appears to have been updated, does this issue still need to remain open?
function PreflightCheck() {
try {
Write-Host "Check Remote PowerShell " -Fore Green
# Start Jobs
foreach ($server in $global:servers) {
$addr = $server.Address
if ($addr -ne $env:computername) {
# Dynamic open PSSession
if ($remoteSessionPort -and $remoteSessionSSL) {
$remote = New-PSSession -ComputerName $addr -Credential $global:cred -Authentication Credssp -Port $remoteSessionPort -UseSSL
}
elseif ($remoteSessionPort) {
$remote = New-PSSession -ComputerName $addr -Credential $global:cred -Authentication Credssp -Port $remoteSessionPort
}
elseif ($remoteSessionSSL) {
$remote = New-PSSession -ComputerName $addr -Credential $global:cred -Authentication Credssp -UseSSL
}
else {
$remote = New-PSSession -ComputerName $addr -Credential $global:cred -Authentication Credssp
}
}
}
Write-Host "Succeess" -Fore Green
return $true
}
catch {
throw 'Not able to connect to one or more computers in the farm. Please make sure you have run run Enable-PSRemoting and Enable-WSManCredSSP -Role Server'
}
}
Resolved with above code. Issue closed.
While doing the pre-flight check and make sure the remoting in to server is enabled..
The line which is bold above needs to be modified to:
**$s = New-PSSession -ComputerName $addr -Credential $global:cred -Authentication CredSSP**