Hi all,
I’ve got a scenario where a monitoring system (PRTG) executes some powershell scripts to check on various aspects of exchange and underlying OS functions. Some of these scripts call exchange cmdlets, others are generic powershell. Both use psremoting.
The issue I’m having is that the scripts that call exchange shell fail if the service account doesn’t have some kind of local session on the monitoring box. I’ve tested both with powershell in a runas and with the monitoring user logged in on console. Scripts that don’t call exchange work whether that user is logged in or not. Here’s the error I see when the user is not logged in:
Connecting to remote server exchangeserver.domain.com failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic. At C:Program Files (x86)PRTG Network Monitorcustom sensorsEXEXMLExchangeDatabaseStatusChecker.ps1:23 char:20 + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Connecti … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (System.Manageme….RemoteRunspace:Re moteRunspace) [New-PSSession], PSRemotingTransportException + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
This is reproducible consistently – logging the service account in or out changes the behavior at the next monitoring interval. Note it fails on creation of the $session variable, which later (would) get imported.
Thanks for any help or ideas.
This is ex2016cu2 on 2012r2, two servers in a DAG. Both machines behave the same way. The PRTG install is current and running from a 2012 r2 machine.
submitted by /u/cowardlyginger
[link] [comments]
The post Monitoring exchange via remote powershell – works if the service account is logged in on the monitoring server, fails otherwise – any ideas? (xpost r/exchangeserver and r/sysadmin) appeared first on How to Code .NET.