Scripting Question

How to pass administrative credentials to vbs file to run in elevated privileges.

03/18/2015 4898 views

I would like to pass administrator credentials to the vbs file to run under admin account. I have tried "RunAs" & "PsExec" utitilites, but no luck.
Please keen your valuable inputs on this.

0 Comments   [ + ] Show comments


All Answers

Forget RunAs: it prompts for a password. I use PSexec all the time to run stuff with alternative credentials so I think you have an error in your command line if it's failing for you. Are you prefixing the username with a domain/computername, as it '-u SomeDomain\TheUserID -p its_password'?
Answered 03/18/2015 by: VBScab
Red Belt

  • Hi VBScab,

    Below is the command I used in non admin cmd.

    PsExec -h -accepteula -u W411023\administrator -p P@ssw0rd msiexec /i "Path of msi" /qn

    The above command works when I run in admin cmd but I want to make it run in normal cmd.

Ditch the '-h' switch: you don't need it if you're executing a process with an administrative account.

Why are trying to run an administrative process from a non-admin command prompt? If you're trying to test a deployment and emulate a deployment system, you should use the '-s' switch i.e. 'Run with the local System account' but you'll need to do that from an administrator-level command prompt.

I notice you don't specify a target machine name: is it going to run on W411023 or some other machine? If another machine, does 'W411023\Administrator' have any rights on that machine?

Answered 03/18/2015 by: VBScab
Red Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ