Hi.
I'm trying to run a powershell script with check_ncpa and I want to add a snapin. But when I use this command
"Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010"
I get this error :
"Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2."
Any ideas?
Thank you.
check_ncpa & powershell
Re: check_ncpa & powershell
That is almost acting like you're trying to run that script on a server that doesn't have Exchange installed on it (so no snap-in available), if you run the powershell script manually on the remote server, does it work?
Edit: Another question, is this 32-bit or 64-bit Exchange? Is this a 32-bit or 64-bit OS?
Edit: Another question, is this 32-bit or 64-bit Exchange? Is this a 32-bit or 64-bit OS?
Re: check_ncpa & powershell
Exchange is installed on the server and both are 64bit versions. If I run the script on the server it runs correctly.
Re: check_ncpa & powershell
I created a script with a single line
and I called it from nagios. The result I got was "4". That means that ncpa is calling the x86 version of powershell and the 64bit version. How can I change that?
Thank you.
Code: Select all
[IntPtr]::Size
Thank you.
Re: check_ncpa & powershell
Ok, that's likely why then, please try changing your ncpa.cfg .ps1 definition from:
To the 64 bit version:
Then restart the ncpa_listener service and see if it works properly now.
Code: Select all
.ps1 = powershell -ExecutionPolicy Bypass -File $plugin_name $plugin_args
Code: Select all
.ps1 = %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File $plugin_name $plugin_args
Re: check_ncpa & powershell
Or you might be able to rename your powershell plugin to pluginname.ps64 and add the line below as an alternate means of having both:
Code: Select all
.ps64 = %SystemRoot%\sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File $plugin_name $plugin_args