Using the RunAs command will prompt for a password. I have implemented this by using PSExec from Microsoft, and passing the Administrator password to PSExec. The major problem with this is I have had to use two script files. The first one that is run by the login script copies a second script file to the local PC (usually C:\Temp) and then the first script file invokes PSExec to run the second script file using wshShell.Run "\\server\share\psexec -u:" & strUser & " -p:" & strPassword & " wscript.exe C:\Temp\2ndFile.vbs"
Now, the major problem with doing this, is you could have someone edit your script file and get your admin password. That would be bad. You should use the Microsoft Script Encoder to at least scramble the visible code in your script files.
Hope this helps.
Rob.
Main Topics
Browse All Topics





by: amit_gPosted on 2007-04-10 at 14:27:19ID: 18885582
Run it from command prompt using RunAs
ator CScript YourVbsFiel.vbs
RunAs /user:YourDomain\Administr
It would ask for password and then execute the vbs as Administrator.