Hi, I have the following code in an agent:
Sub Initialize
On Error Goto errHandler
Dim s As New NotesSession
Dim doc As NotesDocument
Dim clientPC As Variant
’ Set doc=s.DocumentContext
’ Print doc.Remote_Addr(0)
Dim strComputer As String
strComputer = "192.168.1.117"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.InstancesOf ( "Win32_ComputerSystem" )
Forall objComputer In colSettings
Print objComputer.UserName
End Forall
Exit Sub
errHandler:
Print "<p>" & Err & " - " & Error & "</p>"
Resume Next
End Sub
It works when run from the notes client. If I try and run it as a web agent it falls over:
207 - Automation object error
when calling ‘GetObject…’.
I’ve tested the WMI script (in a small text file) running on the server - the system account on the server has access to the workstation in question.
Anyone done anything similar? My agent has access to restricted operations.