I need to perform a small inventory in our network. So I wrote a VBScript which I wanted to deploy with our deployment system. My problem now is: The script is executed in the context of the AD system user.

So this lines:

Set objNetwork = CreateObject("Wscript.Network")
strOutput = strOutput & ";" & objNetwork.UserName

Wont return the logged on user but the AD system user running the script.

Does anybody know a solution for this?


For future google users: I solved it with this little gem: http://officewarfare.net/index.php/owexec/

  • Copy the vbs file to the local hdd
  • start the script via owexec (with parameter -c localhost)

Thats it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.