M
mcw.willart
Hi,
I'm trying to find out how to collect RSOP data in C#, but I haven't
been successfull yet.
Below is the code I Use in VBScript:
------------------------------------------------------------------------------------------------------------------------------
Const FL_FORCE_CREATE_NAMESPACE = 4
strComputer = "."
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set connection = locator.ConnectServer _
(strComputer, "root\rsop", null, null, null, null, 0, null)
Set provider = connection.Get("RsopLoggingModeProvider")
provider.RsopCreateSession _
FL_FORCE_CREATE_NAMESPACE, Null, namespaceLocation, hResult, eInfo
Set rsopProv = locator.ConnectServer _
(strComputer, namespaceLocation & "\User", null, null, Null, Null, 0 ,
Null)
Set colItems = rsopProv.ExecQuery("Select * from RSOP_GPO")
For Each objItem in colItems
WScript.Echo objItem.Name
Next
provider.RsopDeleteSession namespaceLocation, hResult
------------------------------------------------------------------------------------------------------------------------------
Are there any examples on how to do this in C#?
Thanks,
Mario
The Netherlands
I'm trying to find out how to collect RSOP data in C#, but I haven't
been successfull yet.
Below is the code I Use in VBScript:
------------------------------------------------------------------------------------------------------------------------------
Const FL_FORCE_CREATE_NAMESPACE = 4
strComputer = "."
Set locator = CreateObject("WbemScripting.SWbemLocator")
Set connection = locator.ConnectServer _
(strComputer, "root\rsop", null, null, null, null, 0, null)
Set provider = connection.Get("RsopLoggingModeProvider")
provider.RsopCreateSession _
FL_FORCE_CREATE_NAMESPACE, Null, namespaceLocation, hResult, eInfo
Set rsopProv = locator.ConnectServer _
(strComputer, namespaceLocation & "\User", null, null, Null, Null, 0 ,
Null)
Set colItems = rsopProv.ExecQuery("Select * from RSOP_GPO")
For Each objItem in colItems
WScript.Echo objItem.Name
Next
provider.RsopDeleteSession namespaceLocation, hResult
------------------------------------------------------------------------------------------------------------------------------
Are there any examples on how to do this in C#?
Thanks,
Mario
The Netherlands