Audit Local Administrators Group with SCCM - access denied
Followed the article https://www.itninja.com/blog/view/audit-local-administrator-group-with-sccm
When I run script locally it work fine, but if it is running from baseline it getting error access denied.
I don't know where can I look for more logs.
Humm, hard to tell what is wrong.
Update the script for verbose, when the scripts runs from SCCM it should show the error in the above screen shot - I think.
$VerbosePreference = 'Continue' #SilentlyContinue|Continue
Next, delete the WMI class manually and then Evaluate the Compliance Item from the SCCM control panel.
- We are trying to figure out if the script ran and populated WMI correctly.
- If it populated WMI correctly, but you got the error above, then its something to do with SCCM detecting that it did not run correctly.
SCCM is quirky on what it considers a successful run of a compliance item. In my setup it expects a 0 returns, if it detects anything else, even extra console output before the 0, it will marked it as failed.
- You can enable PowerShell logging and view the script output in Eventlogs.
- If you are using $OutputFileLocation, make sure the directory path exists!