I need to work across domains and have begun studying online Microsoft TechNet about Writing WMI scripts. I haven't yet found how to apply permissions to run scripts on a machine under domain "fmsuz" that access machines on domain "sysk3". I know a user name and the administrator name and passwords for "sysk3", but don't know syntax to use it. Here is a test script. Any help will be appreciated.
Code:
'TestThis.vbs
For Each strComputer in Array ("MissionControl", "PMcMath", "Aardvark" )
' Which computer?
msgbox strComputer
' This fails if computer is in a different domain (or if turned off)
Set objSWbemServices = _
GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
' Query for remote OS
Set colItems = objSWbemServices.ExecQuery _
("Select * From Win32_OperatingSystem")
' Show remote OS (only one item is displayed )
For Each objItem in ColItems
Wscript.Echo strComputer & ": " & objItem.Caption
Next
Next
' Machine is in a different domain
'---------------------------
'Windows Script Host
'---------------------------
'Script: ...\TestThis.vbs
'Line: 10
'Char: 2
'Error: Permission denied: 'GetObject'
'Code: 800A0046
'Source: Microsoft VBScript runtime error
'
'---------------------------
'OK
'---------------------------
' Machine is not available
'---------------------------
'Windows Script Host
'---------------------------
'Script: ...\TestThis.vbs
'Line: 10
'Char: 2
'Error: The remote server machine does not exist or is unavailable: 'GetObject'
'Code: 800A01CE
'Source: Microsoft VBScript runtime error
'
'---------------------------
'OK
'---------------------------