Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, May 28, 2020 3:28 AM
I am trying to connect to the exchange powershell session, the connection gets established, and after about 5 - 10 minutes, if i run a get-mailbox command, i get the below error
PS C:\Users\a79270> Get-Mailbox Mailbox
Processing data for a remote command failed with the following error message: Access is denied. For more information,
see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OperationStopped: (ServerName:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : ServerName
Processing data for a remote command failed with the following error message: Access is denied. For more information, see the about_Remote_Troubleshooting
Help topic.
+ CategoryInfo : OperationStopped: (ServerName:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : ServerName
When i check to see if the session is active, i see the below
PS C:\Users\a79270> sess.ps1
ComputerName State ConfigurationName Availability
ServerName Broken Microsoft.Exchange.Management.Powershell.2016 None
What am i doing wrong and what settings should i change on my laptop to ensure that the connection remains active and does not break
All replies (15)
Monday, June 1, 2020 7:37 AM ✅Answered
Thank you Manu And Lucas, i resolved the issue with the connection not being stable. I ended up refreshing the TCP/IP stack and after i restarted the computer, i was able to stay connected without getting disconnected.
earlier in the day, i noticed when i ran a continuous ping that there were packet loss, not too many but there were quite a few packet loss. i realized that and thought i should reset the stack and did the trick i am guess, its been three days and i dont see any disconnections so far.
I sincerely want to thank you for spending time on this issue sir, and hopefully what ever i did might help someone who has similar issues.
The way to reset the TCP/IP Stack is to run the command in an elevated command prompt
"netsh int ip reset"
Thursday, May 28, 2020 5:14 AM
Hello,
Looks like a session timeout issue. Try to increase it as follows. Set to 10 Min
$so = New-PSSessionOption -IdleTimeout 600000
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<SERVER>/PowerShell/ -Authentication Default -SessionOption $so
Regards From: Exchange Online | World of Cloud Computing
Thursday, May 28, 2020 6:12 AM
Thank you sir,
I have now modified my connection script, this is what i have in the file
$SkypeUname = "Domain\Username"
$SkypePass = cat "C:\Users\Username\OneDrive - Company Name, Inc\Folder\O365-Connections\tenant2.key" | ConvertTo-SecureString
$SkypeCredentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $SkypeUname, $SkypePass
$so = New-PSSessionOption -IdleTimeout 600000
$Session = New-PSSession -ConfigurationName Microsoft.Exchange.Management.Powershell.2016 -ConnectionUri http://ExchangeServer/PowerShell/?SerializationLevel=Full -Credential $SkypeCredentials -Authentication Kerberos -SessionOption $so
Import-PSSession $Session -DisableNameChecking -AllowClobber
I will wait for about 15 minutes and then let you know whats the status of the issue is.
Thursday, May 28, 2020 7:01 AM
after making the changes to the connection file, i have been able to stay connected. can i monitor this for another days time and let you know what happens sir?
Thank you,
Santosh
Thursday, May 28, 2020 11:21 AM
Hello Santhosh,
Glad to know that you are seeing some good signs of fix.
Let's know how it helps you after monitoring the changes for the desired time
Regards From: Exchange Online | World of Cloud Computing
Thursday, May 28, 2020 2:31 PM
Thank you very much sir. While i was at work, the connection seemed to be stable. i came back home and connected to the VPN and then i re-established the connection to the on-prem powershell, but it wouldnt stay connected even for 5 minutes.
PS C:\Users\a79270> sess.ps1
ComputerName State ConfigurationName Availability
ServerName Broken Microsoft.Exchange.Management.Powershell.2016 None
why would the state say broken and not disconnected. isnt it supposed to say Disconnected instead? do i have to change settings on my laptop to get this fixed sir?
Thursday, May 28, 2020 3:39 PM
Hi Santhosh,
As I understood correctly, now you are connecting from a different computer. So, please follow the first settings change here again
Regards From: Exchange Online | World of Cloud Computing
Thursday, May 28, 2020 3:48 PM
Sir, i am not using two different computers, its the same laptop that i use while i am at work. however, after i sent the last message, i close the PowerShell window, relaunched it and connected to the on-prem PowerShell session, it has been sometime and the connection is stable. i am not sure why i had to close the window and re-open it. but the connection has been stable so far.. i will continue to monitor this for some more time and let you know what happens. Once again i sincerely thank you for your assistance on this sir.
Friday, May 29, 2020 2:46 AM
Good Morning sir,
this morning, when i came into work, i started a new session and within 5 minutes i get the below error. i check to see if the session is open, it shows Broken, so i attempt to get the mailbox properties and i get prompted for the credentials. when i put in the credentials, i get the error immediately
PS C:\Users\UserName> sess.ps1
ComputerName State ConfigurationName Availability
ServerName Broken Microsoft.Exchange.Management.Powershell.2016 None
PS C:\Users\a79270> Get-Mailbox -Identity MailboxName
Creating a new session for implicit remoting of "Get-Mailbox" command...
New-PSSession : [ServerName] Connecting to remote server ServerName failed with the following error message : Access is denied. For more information,
see the about_Remote_Troubleshooting Help topic.
At C:\Users\UserName\AppData\Local\Temp\tmp_aazggsmm.r2l\tmp_aazggsmm.r2l.psm1:137 char:17
+ & $script:NewPSSession `
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit remoting module."
At C:\Users\UserName\AppData\Local\Temp\tmp_aazggsmm.r2l\tmp_aazggsmm.r2l.psm1:20095 char:13
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($myI ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException
PS C:\Users\Username>
Friday, May 29, 2020 2:50 AM
Opening a new PowerShell window and trying to connect to the PowerShell session gave me the below error
Experience the fast and reliable Exchange PowerShell V2 Cmdlets via new PowerShellGallery module. Go to https://aka.ms/exops-docs
This PowerShell module allows you to connect to Exchange Online service.
To connect, use: Connect-EXOPSSession -UserPrincipalName <your UPN>
This PowerShell module allows you to connect Exchange Online Protection and Security & Compliance Center services also.
To connect, use: Connect-IPPSSession -UserPrincipalName <your UPN>
To get additional information, use: Get-Help Connect-EXOPSSession, or Get-Help Connect-IPPSSession
PS C:\Users\UserName> Connect-On-Prem.ps1
Transcript started, output file is C:\Users\UserName\OneDrive - Arrow Electronics, Inc\Santosh - Office\Transcripts\o365 Transcripts\On-Prem-report-for-05292020-0818.txt
New-PSSession : [ServerName] Connecting to remote server ServerName failed with the following error message : Access is denied. For more information,
see the about_Remote_Troubleshooting Help topic.
At C:\Windows\system32\Connect-On-Prem.ps1:10 char:12
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange.Manage ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the
command again.
At C:\Windows\system32\Connect-On-Prem.ps1:12 char:18 - Import-PSSession $Session -DisableNameChecking -AllowClobber
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Import-PSSession], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ImportPSSessionCommand
Set-ADServerSettings : The term 'Set-ADServerSettings' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Windows\system32\Connect-On-Prem.ps1:13 char:1
- Set-ADServerSettings -ViewEntireForest 1
-
+ CategoryInfo : ObjectNotFound: (Set-ADServerSettings:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\UserName>
Friday, May 29, 2020 8:46 AM
Hi Santz,
What is your Exchange environment?
1. If your environment is Exchange Online. According to the error information, this issue may be caused by your account doesn’t have permission to access Exchange Online, you could following these steps to resolve this issue:
1) Sign in to the Office 365 porta as an administrator.
2) Add your account to Organization Management group.
3) You could connecting to Exchange Online by run:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
For information: "Access is denied" error when you connect to Exchange Online by using remote Windows PowerShell and Connect to Exchange Online PowerShell.
2. If your environment is on-premises Exchange. You could connecting to on-premises Exchange by run:
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ServerFQDN>/PowerShell/ -Authentication Kerberos -Credential $UserCredential
Import-PSSession $Session -DisableNameChecking
For more information:Connect to Exchange servers using remote PowerShell
Regards,
Lucas Liu
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Friday, May 29, 2020 9:28 AM
Thank you Lucas,
No, i have no issues connecting to the o365 Environment. The issue lies with maintaining a stable connection to the on-prem exchange server powershell session. i can connect to the PowerShell session, but it wont work for too long and also when the connection breaks, it comes back asking for password, the moment i put in the password and hit the enter key, it gives me an error like below
PS C:\Users\UserName> TerminatingError(): "No session has been associated with this implicit remoting module."
>> TerminatingError(): "Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit remoting module.""
>> TerminatingError(): "Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit remoting module.""
Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit remoting module."
Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit remoting module."
At C:\Users\UserName\AppData\Local\Temp\tmp_x43yp0nx.1yq\tmp_x43yp0nx.1yq.psm1:20095 char:13
+ $steppablePipeline = $scriptCmd.GetSteppablePipeline($myI ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException
Monday, June 1, 2020 8:25 AM
Hi Santz,
I am pleased to hear that your problem has been solved.
You could share your solution and mark them or the helpful reply as answer, this will make answer searching in the forum easier and be beneficial to other community members as well.
Thanks for your understanding.
Regards,
Lucas Liu
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].
Monday, June 1, 2020 8:30 AM
Thank you sir, i have updated it now. is there a way to close this post? or can you help me close the post?
Monday, June 1, 2020 8:36 AM
Hi Santz,
Thank you for your sharing.
After you mark the answer, the flow of this case is closed.
Hope you have a good day.
Regards,
Lucas Liu
Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].