I have a GPO with this WMI filter: SELECT Name From Win32_ServerFeature WHERE Name = 'Web Server (IIS)'
The GPO has a startup script meant to modify a file to instruct the load balancer that the server is OK to send traffic to.
Normally, when rebooting, the startup script runs. However, after installing patches, I noticed the server never went back into the load balancer. The startup script creates a log file, and I saw that the log file was never created for that reboot. I rebooted another time, and the startup script ran. I found the following event in EventViewer, which shows that the GPO was not applied due to WMI filtering:
Log Name: Microsoft-Windows-GroupPolicy/Operational
Source: Microsoft-Windows-GroupPolicy
Date: 5/4/2023 7:48:26 AM
Event ID: 5313
Task Category: None
Level: Information
Keywords:
User: SYSTEM
Computer: server01.mydomain
Description:
The following Group Policy objects were not applicable because they were filtered out :
gpo.autoreboot.IIS_OK
Denied (WMI Filter)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-GroupPolicy" Guid="{aea1b4fa-97d1-45f2-a64c-4d69fffd92c9}" />
<EventID>5313</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2023-05-04T11:48:26.661096300Z" />
<EventRecordID>274604</EventRecordID>
<Correlation ActivityID="{ff168884-e55b-47c0-960c-40b500f178c2}" />
<Execution ProcessID="1528" ThreadID="3212" />
<Channel>Microsoft-Windows-GroupPolicy/Operational</Channel>
<Computer>server01.mydomain</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData>
<Data Name="DescriptionString">gpo.autoreboot.IIS_OK
Denied (WMI Filter)
</Data>
<Data Name="GPOInfoList"><GPO ID="{guid}"><Name>gpo.autoreboot.IIS_OK</Name><Version>131074</Version><SOM>LDAP://OU=servers,DC=mydomain</SOM><FSPath>\\mydomain\SysVol\mydomain\Policies\{guid}\Machine</FSPath><Reason>DENIED-WMIFILTER</Reason></GPO></Data>
</EventData>
</Event>
Here's the Data element expanded and decoded:
<GPO ID="{guid}">
<Name>gpo.autoreboot.IIS_OK</Name>
<Version>131074</Version>
<SOM>LDAP://OU=servers,DC=mydomain</SOM>
<FSPath>\\mydomain\SysVol\mydomain\Policies\{guid}\Machine</FSPath>
<Reason>DENIED-WMIFILTER</Reason>
</GPO>
A subsequent reboot did not have this event, and there was another event listing all the applied GPOs, which included this one. Is there something about updates that can prevent WMI filtering from working correctly on the Win32_ServerFeature class? If so, is there a workaround I can use to make sure this script only runs on IIS servers? I have thought about removing the WMI filter and just adding in a condition on the script that checks to see if the role is installed.
This happened on multiple servers with different OS versions, so I do not think it was a one-time event.