Hello,
after updating my monitoring PC to Windows 10 I have a funny problem.
It seems the standard Powershell modules are no longer reachable from PRTG.
I have to import for example Microsoft.PowerShell.Management to get Get-WMIObject working.
Kind regards Ingo
Article Comments
It's the EXE/Script Advanced-Sensor.
The sensor and the same script worked without problem under Windows 8.1
Aug, 2015 - Permalink
Are all PowerShell cmdlets affected that you use in the custom scripts? Just so we know if it's a general problem or just certain cmdlets.
Aug, 2015 - Permalink
At the moment I'm only using three cmdlets in my scripts which were not running:
- Get-WmiObject
- Select-Object
- New-Object
Aug, 2015 - Permalink
Alright, thanks. I'll test this tomorrow morning when I have a Windows 10 VM at hand :)
Aug, 2015 - Permalink
Just tested it and it really seems that you need to import the modules (at least, for current PRTG versions). Just as a quick note, this works, too:
Import-Module @("Microsoft.PowerShell.Management","PSDiagnostics")
Nevertheless, the execution time is horrible... Windows 8.1 with 402ms vs. Windows 10 taking 4.9 seconds ;(
We'll look into it!
Aug, 2015 - Permalink
Then at least it's not a problem of the Windows update. I presume you installed the Windows from scratch.
Yeah, aweful runtime, so I'm only importing the necessary modules...
New OS new challenge... :-)
Aug, 2015 - Permalink
We've changed the execution of PowerShell sensors (currently internal canary) so it will load the modules according to the PowerShell version:
if ($PSVersionTable.PSVersion -ge (new-object 'Version' 5,0)) { Import-Module Microsoft.PowerShell.Management; Import-Module Microsoft.PowerShell.Utility};
This should also work with your existing scripts :)
Sep, 2015 - Permalink
Thanks for the hint! With which sensor did you try it? PowerShell v5 seems to have it's caveats as it seems :(
Aug, 2015 - Permalink