I've been running local admin scripts against 13 location OUs in our domain each month for over two years without issues. However, recently three of these OUs stopped responding to the script, leading to every asset being flagged in the error report. I've checked for any network or group policy changes—none exist. I've also been reviewing the PowerShell logs in Event Viewer, but I haven't found a clear cause for the problem. Is there anything else I should consider checking? Here's a snippet of the code that works for most OUs.
4 Answers
Regarding your script, if you're using a lot of data handling, consider validating if all machines are running a compatible OS like Windows 10/11. You might also want to explore using `Invoke-Command` for parallel processing instead of querying each one by one. It could save you some time and effort.
One thing to note: If your script is referencing the local admin group by name, it might fail if the group name isn't localized the same way across different machines. Switching to using the group SID could help. You should also think about leveraging `Get-CimInstance` to access the group name.
Have you checked the permissions for those OUs? Sometimes, even if everything seems fine, permissions can slip through the cracks, preventing the script from accessing them properly.
I had a similar situation where a Group Policy was dropped in that accidentally overridden everything else. It might be a good idea to look into any GPs that might affect those specific OUs. Sometimes the solution is hidden in those tweaks.
Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically