After running command to connect O365 remote powershell for Exchange, getting following error
PS C:\Users\sas\Desktop> Import-PSSession $(New-PSSession -ConfigurationName
Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Authentica
tion Basic -AllowRedirection -Credential $(Get-Credential))
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
[ps.outlook.com] Connecting to remote server failed with the following error me
ssage : The WinRM client cannot process the request because the server name can
not be resolved. For more information, see the about_Remote_Troubleshooting Hel
p topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:Re
moteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argumen
t is null. Supply a non-null argument and try the command again.
At line:1 char:17
+ Import-PSSession <<<< $(New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri https://ps.outlook.com/powershell -Authentication Basic -AllowRe
direction -Credential $(Get-Credential))
+ CategoryInfo : InvalidData: (:) [Import-PSSession], ParameterBi
ndingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
Shell.Commands.ImportPSSessionCommand
Resolution:
Check for DNS resolution, via command prompt
Nslookup ps.outlook.com and see it is resolving or not
If Proxy is set, each time when you are running remote powershell for Exchange, run the below command to set the proxy
C:\> netsh winhttp set proxy IPaddress:Port
Eg:
C:\> netsh winhttp set proxy 172.16.1.30:8080
PS C:\Users\sas\Desktop> Import-PSSession $(New-PSSession -ConfigurationName
Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Authentica
tion Basic -AllowRedirection -Credential $(Get-Credential))
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
[ps.outlook.com] Connecting to remote server failed with the following error me
ssage : The WinRM client cannot process the request because the server name can
not be resolved. For more information, see the about_Remote_Troubleshooting Hel
p topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:Re
moteRunspace) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argumen
t is null. Supply a non-null argument and try the command again.
At line:1 char:17
+ Import-PSSession <<<< $(New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri https://ps.outlook.com/powershell -Authentication Basic -AllowRe
direction -Credential $(Get-Credential))
+ CategoryInfo : InvalidData: (:) [Import-PSSession], ParameterBi
ndingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
Shell.Commands.ImportPSSessionCommand
Resolution:
Check for DNS resolution, via command prompt
Nslookup ps.outlook.com and see it is resolving or not
If Proxy is set, each time when you are running remote powershell for Exchange, run the below command to set the proxy
C:\> netsh winhttp set proxy IPaddress:Port
Eg:
C:\> netsh winhttp set proxy 172.16.1.30:8080