On error resume next strComputer = "." DomainDN = "DC=ldap389,DC=info" DomainDNSFQDN = "ldap389.info" LAGDC = "LAG_DC" BackupLocationTool = "G:\Tool" Const ForAppending = 8 Set FSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set MySink = WScript.CreateObject( _ "WbemScripting.SWbemSink","SINK_") Set MySink2 = WScript.CreateObject( _ "WbemScripting.SWbemSink","SINK2_") objWMIservice.ExecNotificationQueryAsync MySink, _ "SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " & _ "TargetInstance ISA 'Win32_SubDirectory'" & _ " AND TargetInstance.GroupComponent = 'Win32_Directory.Name=""F:\\\\WINDOWS\\\\SYSVOL\\\\domain\\\\Policies""'" objWMIservice.ExecNotificationQueryAsync MySink2, _ "SELECT * FROM __InstanceDeletionEvent WITHIN 10 WHERE " & _ "TargetInstance ISA 'Win32_SubDirectory'" & _ " AND TargetInstance.GroupComponent = 'Win32_Directory.Name=""F:\\\\WINDOWS\\\\SYSVOL\\\\domain\\\\Policies""'" While (True) Wscript.Sleep(1000) Wend Sub SINK_OnObjectReady(objObject, objAsyncContext) gpofullpath = objObject.TargetInstance.Properties_.item("PartComponent").value gpoid1 = split(lcase(gpofullpath),"policies\\") gpouid = replace(gpoid1(1),chr(34),"") strGPODN = "CN="&gpouid&",CN=Policies,CN=System,"&DomainDN Set objGPO = GetObject("LDAP://" & strGPODN) StrGPOName = objGPO.DisplayName Set df80 = FSO.OpenTextFile(BackupLocationTool&"\GPM-Modified.log",ForAppending) df80.writeline(now&";CREATED;"&gpouid&";"&StrGPOName) df80.close End Sub Sub SINK2_OnObjectReady(objObject, objAsyncContext) gpofullpath = objObject.TargetInstance.Properties_.item("PartComponent").value StrGPOName = "N/A" gpoid1 = split(lcase(gpofullpath),"policies\\") gpouid = replace(gpoid1(1),chr(34),"") if LAGDC <> "" then strGPODN = "CN="&gpouid&",CN=Policies,CN=System,"&DomainDN err.clear Set objGPO = GetObject("LDAP://" &LAGDC&"/"&strGPODN) if err.number <> 0 then StrGPOName = "N/A" else StrGPOName = objGPO.DisplayName End if End if Set df80 = FSO.OpenTextFile(BackupLocationTool&"\GPM-Modified.log",ForAppending) df80.writeline(now&";DELETED;"&gpouid&";"&StrGPOName) df80.close End Sub Sub SINK_OnCompleted(objObject, objAsyncContext) End Sub