I want to collect performance data from a Windows 2008 R2 Server with PowerShell.
For this task, I want to use a non admin account.
My problem is now, that I´m getting back a empty object ($WMIService).
There is no error message when I´m executing my script.
When I´m using a account with admin rights, everything is perfect.
So I think, permissions are missing for the non admin account.
How can I fix my problem?
My configuration for the WMIService account:
My script:
$ServiceCred = Get-Credential
$AdminCred= Get-Credential
$WMIService = Get-WmiObject -Class Win32_PerfFormattedData_PerfOS_Memory -ComputerName servername -Credential $ServiceCred
$WMIAdmin = Get-WmiObject -Class Win32_PerfFormattedData_PerfOS_Memory -ComputerName servername -Credential $AdminCred
$WMIService (Empty)
$WMIAdmin (Perfect)
Solved! The user must also be in the Performance Monitor Users group.
My working configuartion: