Check NCPA , PSSnappin error for Exchange 2013
Posted: Mon Jul 15, 2019 5:11 pm
System : Windows 2012ServerR2 6.3.9600
where the servers are located [In DMZ or not] : Servers are in the DMZ and not domain members.
ncpac version : 2.1.1
Version of Exchange : Exchange 2013
one of my team is attempting to load a Powershell PSSnapin for exchange on these systems so I can interrogate the message queue for monitoring. When using ncpa to load the service monitor Exchange Queue Length, the script fails.
The error is related to loading the Exchange powershell snapin loaded to execute the powershell script that returns queue length. The script get-QueueLength.ps1 runs on the server however fails to load when executed from Nagios
[nagios@monrck-vccn003 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version
4.
At C:\Program Files (x86)\Nagios\NCPA\plugins\Nagios_Get-QueueLength.ps1:8
char:1
+ Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.SnapIn"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Excha...werShell.Sna
pIn:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
dPSSnapinCommand
We Also Tried the some troubleshooting steps by following a post #53056 and we still face with the below errors
.ps1 = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Program Files\Microsoft\Exchange Server\V15\bin\Microsoft.Exchange.PowerShell.Configuration.dll"
Still getting this:
$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Processing -File '"Microsoft.Exchange.Management.PowerShell.SnapIn"' failed: Illegal characters in path. Specify a valid path for the -File parameter.
Or when I use single quotes around the full snappin name like this 'Microsoft.Exchange.Management.PowerShell.SnapIn':
$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Processing -File ''Microsoft.Exchange.Management.PowerShell.SnapIn'' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.
where the servers are located [In DMZ or not] : Servers are in the DMZ and not domain members.
ncpac version : 2.1.1
Version of Exchange : Exchange 2013
one of my team is attempting to load a Powershell PSSnapin for exchange on these systems so I can interrogate the message queue for monitoring. When using ncpa to load the service monitor Exchange Queue Length, the script fails.
The error is related to loading the Exchange powershell snapin loaded to execute the powershell script that returns queue length. The script get-QueueLength.ps1 runs on the server however fails to load when executed from Nagios
[nagios@monrck-vccn003 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version
4.
At C:\Program Files (x86)\Nagios\NCPA\plugins\Nagios_Get-QueueLength.ps1:8
char:1
+ Add-PSSnapin "Microsoft.Exchange.Management.PowerShell.SnapIn"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Excha...werShell.Sna
pIn:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.Ad
dPSSnapinCommand
We Also Tried the some troubleshooting steps by following a post #53056 and we still face with the below errors
.ps1 = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Program Files\Microsoft\Exchange Server\V15\bin\Microsoft.Exchange.PowerShell.Configuration.dll"
Still getting this:
$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Processing -File '"Microsoft.Exchange.Management.PowerShell.SnapIn"' failed: Illegal characters in path. Specify a valid path for the -File parameter.
Or when I use single quotes around the full snappin name like this 'Microsoft.Exchange.Management.PowerShell.SnapIn':
$ /usr/local/nagios/libexec/check_ncpa.py -H server -t 'token' -P 5693 -M 'plugins/Nagios_Get-QueueLength.ps1'
Processing -File ''Microsoft.Exchange.Management.PowerShell.SnapIn'' failed because the file does not have a '.ps1' extension. Specify a valid Windows PowerShell script file name, and then try again.