I am trying to connect to live#edu using PowerShell with the following command.
$SessionNew = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://pod51002psh.outlook.com/powershell
Error:
[pod51002psh.outlook.com] Connecting to remote server failed with the
following error message : The WinRM client cannot process the
request. The destination computer returned an empty response to the
request. For more information, see the about_Remote_Troubleshooting
Help topic.
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [],
PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionOpenFailed
Can anyone suggest me what to do with this type of errors?
I am working with following System enviornment:
Win 7, default version of PowerShell & IIS feature enabled.
Is this Code working?
$Uri = "https://pod51002psh.outlook.com/powershell/"
$Credentials = Get-Credential
$SessionNew = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $Uri -Credential $Credentials -Authentication Basic –AllowRedirection
Import-PSSession $SessionNew
In order for Import-PSSession to work though, you will have to change local execution policy with:
Set-ExecutionPolicy remotesigned
Related
I am trying to establish a PowerShell session to run several Exchange commands on an Exchange server on the localhost. This is not a constant issue, script is running successfully for sometime, but most of the time it is throwing following error:
New-PSSession : [Exchange-server-name] Connecting to remote server Exchange-server-name failed with the following error message : Access is denied. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:9 char:15
+ $newsession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ...
+
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Supply a non-null argument and try the command again.
At line:10 char:27
+ import-PSSession -session $newsession -AllowClobber
Following is my PSSession command:
$newsession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://Exchange-server-name/PowerShell/ -Authentication Kerberos -Credential $Credential
I tried running the following script to connect to an exchange server but I get the below error. Is anything wrong with the script? Are there any changes to be done from the server end?
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://mail.company.tld/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Error:
New-PSSession : [mail.deloitte.ca] Connecting to remote server mail.deloitte.ca failed with the following error message : The WinRM client sent a request to an HTTP
server and got a response saying the requested HTTP URL was not available. This is usually returned by a HTTP server that does not support the WS-Management protocol.
For more information, see the about_Remote_Troubleshooting Help topic.
At line:4 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed
Have you checked PowerShellVirtualDirectory as mentioned in this document? It mentions exact same issue.
Assuming your ConnectionUri is correct, most likely PowerShell remoting is not enabled on the target CAS server. You can enable it by running this on the CAS server directly:
Enable-PSRemoting
You may also need to configure the PowerShell virtual directory with:
Set-PowerShellVirtualDirectory "[ServerName]\POWERSHELL (default web site)" -BasicAuthentication $true
I am trying to connect to my O365 Exchange Online but getting WinRM error messages when doing so.
$user = "user#domain.co.uk"
$cred = Get-Credential -Credential $user
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $cred -Authentication "Basic" -AllowRedirection
when running that I get the following error message:
> New-PSSession : [outlook.office365.com] Connecting to remote server
> outlook.office365.com failed with the following error message : The
> WinRM client cannot process the request. Basic authentication is
> currently disabled in the client configuration. Change the client
> configuration and try the request again. For more information, see the
> about_Remote_Troubleshooting Help topic. At line:1 char:20
> + $exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -Connecti ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession],
> PSRemotingTransportException
> + FullyQualifiedErrorId : -2144108321,PSSessionOpenFailed
I have looked online around WinRM and basic authentication.
I have enabled basic authentication through GPO but this hasn't done much.
Any information would be great.
Thanks
Looks to me like you have MFA enabled for the admin account - disable that. Cheers.
I would like to connect to Exchange Server 2010 by using PowerShell.
I am using the following command:
PS C:\Windows\system32> $UserCredential = Get-Credential
PS C:\Windows\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://<serverName>/powershell-liveid/ -Credential $UserCredential -Authenticat
At this point I got the following error message:
WARNING: Your connection has been redirected to the following URI: "https://****************/owa/pow
ershell-liveid "
New-PSSession : [******************] Connecting to remote server **************** failed
with the following error message : The WinRM client received an HTTP status code of 440 from the remote
WS-Management service. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession],
PSRemotingTransportException
+ FullyQualifiedErrorId : -2144108273,PSSessionOpenFailed
I have tried to search for this 440 Error and figure out what is the exact cause for this error, but got no result. Could anyone please give some ideas about why it fails and how to fix it?
On all the exchange servers that I manage the uri is http://EXCHANGESERVERfqdn/PowerShell
I'm trying to run following powershell script using webjobs, but receive an error. Local run works just fine.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange `
-ConnectionUri https://outlook.office365.com/powershell-liveid/ `
-Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
The output from webjob run details is:
ERR ] New-PSSession : [outlook.office365.com] Connecting to remote server
outlook.office365.com failed with the following error message : WS-Management
cannot process the request. The operation failed because of an HTTP error. The
HTTP error (50) is: The request is not supported. . For more information, see
the about_Remote_Troubleshooting Help topic.
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri ht ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : WinRMOperationAborted,PSSessionOpenFailed
Is it possible to connect to remote Exchange online server from azurewebsites webjob and "do something" there?