Following on from this thread I thought I would post my findings in case anyone stumbled upon it.
For starters, remotely executing PS scripts against Exchange Server 2007 via WinRM is not supported. This is not isolated to APM, it does not work from any machine, even locally connecting in using Enter-PSSession-localhost doesn't work. You basically end up with the below error:
"An Active Directory error 0x80072020 occurred while searching for domain controllers in domain xxxx.xxxx.xxx: An operations error occurred."
For Exchange Server 2010 it appears that it is possible. See thisthread for more info on how to set it up.
Upgrading to Exchange 2010 will happen later this year but in the meantime I still want to monitor the database status on all my 2007 Mailbox servers. So I am now wondering if I can run a Version 1 PS script (not PowerShell v1.0) so that it executes locally on the APM server.
Before I move to an Exchange script (I have Exchange tools on APM server) and have to load the Exchange Snapin I want to run a basic script against the local APM server and this is what I have:
------------------------------------------
$Riley = @()
$Riley = Get-Process | where {$_.'ProcessName' -like 'System'}
if (!$Riley) {write-host "Statistic: 0" Exit(0)}
if ($Riley) {write-host "Statistic: 1" Exit(1)}
------------------------------------------
It does not work and gives the following error:
Testing on node orion.domain.co.uk: failed with 'Undefined' status Windows script execution error.
Running Get-Process | where {$_.'ProcessName' -like 'System'} within PowerShell console returns the process 'system'.
Also, when executing a PS command from within APM, does it use the 64 or 32 bit version of PowerShell?