Hello,
I'm trying to use WMI Custom Sensor to get the space used by VSS Shadow copies on our servers (2012 R2).
I'm running this WMI query with the sensor :
SELECT UsedSpace FROM Win32_ShadowStorage
When I use this query locally on one of the servers that I want to monitor, I get a result in bytes.
But with the sensor, as with PRTG's WMI tester tool, I get this error :
80041014: A component, such as a provider, failed to initialize for internal reasons.
Other WMI sensors (eventlog, logical disk) just works well on those devices.
I've tried to modify the namespace parameter on the sensor from root\cimv2
to nothing (blank field) : no more result.
Can someone tell me what I'm doing wrong ?
Regards
Article Comments
Hello there,
Did you check out this article from Microsoft already?
Kind regards,
Erhard
Apr, 2017 - Permalink
Hello Erhard,
Thank you for the link, I've tried both workarounds of sections "I’m getting an 0x80041013 (“Provider not found”) or an 0x80041014 (“Component failed to initialize) error" and "I’m getting an error regarding provider registration" without success.
Furthermore, I've made new test with PowerShell locally on those devices : I've run the following command in normal and in elevated prompt :
Get-WmiObject -Query "SELECT UsedSpace FROM Win32_ShadowStorage"
I only get result in elevated prompts, in normal prompt I got the following error :
Get-WmiObject : Initialization failure
At line:1 char:1
+ Get-WmiObject -Query "SELECT UsedSpace FROM Win32_ShadowStorage"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
So I think this issue is related to UAC.
On our PRTG's server, I run successfully this command in a PowerShell prompt run-as with credentials I set in PRTG (where 'DEVICE' is the name of the remote server I try to monitor.) :
Get-WmiObject -Query "SELECT UsedSpace FROM Win32_ShadowStorage" -ComputerName DEVICE
I've tried to put It in a script :
param( # must me a resolvable hostname (Netbios or DNS) [Parameter(Position=0)] [string] $ComputerName = 'DEVICE', # WMI query to be run on the server, must return only one value [Parameter(Position=1)] [string] $Query = "SELECT UsedSpace FROM Win32_ShadowStorage", # WMI result modifier [Parameter(Position=2)] [string] $ResultModifier = "/1Gb" ) # Error handling trap{ # Return value 0 and error message "0:$($_.ToString())" exit 2 } # run WMI query $result = Get-WmiObject -Query $Query -ComputerName $ComputerName -ErrorAction Stop # set and transfrom result $PropName = $result | gm | where MemberType -eq Property | where name -NotMatch "__" | select -expand name $result = Invoke-Expression "`$result.$PropName" $result = Invoke-Expression "`$result$ResultModifier" # Return result and error code "$($result):Ok" exit 0
But PRTG return "System Error: Initialization failure (code: PE022)"
Note that I've successfully run the script of my previous post on the same device, with same credentials.
This script run successfully in a PowerShell prompt run-as with credentials I set in PRTG, on the PRTG's server.
It seems that there is an issue with WMI related functionality handling by PRTG and UAC...
Regards
EDIT It seems that the markup parser do not like my piece of code ^.^'
EDIT BY MOD: Fixed :)
Apr, 2017 - Permalink
Hi,
are both machines (Probe and target) in the same domain? Do you have tried passing a Credential Object with the WMI Query?
This could be done with something like:
$password = "YOURPASSWORD" | ConvertTo-SecureString -AsPlainText -Force $credentials = New-Object System.Management.Automation.PSCredential(("{0}\{1}" -f ,"YOURDOMAIN", "YOURUSER"), $password) # run WMI query $result = Get-WmiObject -Query $Query -ComputerName $ComputerName -ErrorAction Stop -Credential $credentials
Apr, 2017 - Permalink
Hi Konstantin,
- Yes, both machines are in the same domain.
- No, but I've done it by integrating your piece of code to my script.
Same results :
- From ISE/Powershell the WMI request return good result.
- From PRTG "System Error: Initialization failure (code: PE022)".
Regards.
PS : Thank you for the code formatting ;)
Apr, 2017 - Permalink
Hey,
my apologies for the delay.
There could be an issue with the permissions of the calling process, which in this case would be the PRTG Probe (which is running with the local SYSTEM account). Could you try letting the probe run under a different user account?
Preferably one which is part of the local Administrator group?
Best
Konstantin
Apr, 2017 - Permalink
Hi,
I've try to modify the account running Probe's service, now it is running with the same account as the one used in credentials in my previous tests.
As a result, all of my 3 sensors are now down, with new error messages :
Description | SensorName | Message |
---|---|---|
WQL query | WMI Custom UsedSpace from Win32_ShadowStorage | 80041014: A component, such as a provider, failed to initialize for internal reasons. |
First script | EXE VSS Shadows used space | A required privilege is not held by the client. (0x522) |
Second script | Custom EXE/Script Sensor | A required privilege is not held by the client. (0x522 |
All my others sensors (3958 on this probe) just work fine.
Then I've modified the security context of my EXE/Script sensors, from Use Windows credentials of parent device to Use security context of probe service. They both now work as before :
Description | SensorName | Message |
---|---|---|
First script | EXE VSS Shadows used space | OK |
Second script | Custom EXE/Script Sensor | System Error: Initialization failure (code: PE022) |
Regards.
Apr, 2017 - Permalink
Hey,
could you possibly open up a support ticket and forward us the System Logs as well as the Sensor Results.
You can set the sensor to write results on tab Settings. There just switch the Result Handling Option to Write to Disk.
This will create the sensor logs under <prtg_data_directory>\Logs (Sensors). Just forward us those for the sensors affected.
Best
Konstantin
Apr, 2017 - Permalink
In the mean time, I'm using this powershell script to get the result, devices must have WinRM configured :
Apr, 2017 - Permalink