vbscript - Connecting to a Remote Server on a different domain -- how do I enter the username and password? -
i have vbscript parsing information on remote machine.
i have line of code connection strcomputer defined name of server connecting to.
set objwmiservice = getobject("winmgmts:{impersonationlevel=impersonate!\\" & strcomputer & "\root\cimv2")
as long executing script on same domain remote server, script run fine. requirement able run script 1 domain access remote computer on different domain.
to this, need provide username , password. think username must have domain part of it?
anyways, possible? if so, how , enter username , password this? can add argument.
according microsoft should possible. need authenticate against remote domain, though, e.g. this:
computer = "..." username = "otherdomain\user" password = "..." set locator = createobject("wbemscripting.swbemlocator") set wmi = locator.connectserver(computer, "root\cimv2", username, password) wmi.security_.impersonationlevel = 3
Comments
Post a Comment