![]() ![]() The secret to running a script under RunAs is to call one of the two script hosts, passing along the name of the script as a command-line argument. Although Test.vbs might not be an executable file, the two Windows script hosts - Cscript.exe and Wscript.exe - are executable files. So if RunAs accepts only executable files then obviously we can’t run a script using RunAs, right? Well, not necessarily. ![]() Most likely your code is just fine the problem is that you’re trying to run a script rather than a. Test.vbs is obviously not an executable file, so the command fails. That’s because RunAs is expecting to run an executable file. But here’s the deal: the error message says nothing about the script or the script code being invalid, it simply states that Test.vbs is not a valid Win32 application. It’s at this point that people typically do one of two things: either they give up, or they start debugging the script, trying to figure out why their code isn’t valid. RUNAS ERROR: Unable to run - C:\Scripts\Test.vbsġ93: C:\Scripts\Test.vbs is not a valid Win32 application. Runas /profile /user:fabrikam\kenmyer "C:\Scripts\Test.vbs"Īnd here’s what happens when you press ENTER:Īttempting to start C:\Scripts\Test.vbs as user "fabrikam\kenmyer". And so, seeing as how everyone always does whatever Microsoft tells you to do, you type the following command at the command prompt and try using the RunAs utility to run the script C:\Scripts\Test.vbs: Use a utility such as RunAs any time you need to run a program as an Administrator. I'll paste this here as it's useful for future reference (and just in case it ever get lost over at MS!) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |