Hello,
I’m working on some operational tests for Group Policy WMI Filters. What I want to accomplish is pulling all WMI Filters from Active Directory (accomplished with https://gallery.technet.microsoft.com/scriptcenter/Group-Policy-WMI-filter-38a188f3) and loop thru them testing the query of each one against multiple operating systems or system types.
The issue I’m having is that it (appears) I can only mock the output of the call, but what I need to do is mock the INPUT. Meaning, I want to mock the Win32_OperatingSystem Class of a Windows 7 system, a Windows 8.1 system AND a Windows 10 system and execute the WMI Query against each mock to see how it behaves. I know I can do this by connecting to LIVE systems, but I’m hoping I can avoid that so I don’t need to find or build a live system each time I want to test this.
I’ve created a gist with my code thus far: Test Group Policy WMI Filters with Pester · GitHub