[Solved] Run any program with Elevated Privilege using Script (RUN AS).
In my previous blog I have mentioned some issue with WDS while Implementing DC-AD on my college and had also shared the solved issue with you all through this blog. Similarly this time also here I have faced the issue with WAMP…a server which run apache essential for PHP. I was almost corner of the deployment and about to wrap up the project but suddenly I got the call saying WAMP is not able to run in client machine… I had gone thought the Google and Bing for the solution yet not able to get it, But just got a clue of the Issue.
To get Run WAMP Server Completely it requires the two essential services to get run with administrative privilege. Those are
To get this solved what I did was…. Firstly I get login in to the client machine with local administrative privilege. And then went to the services with using services.msc command line.
Then what I did was went to the properties of the both the services that requires WAMP to get function properly and made it logon type with local Administrative user ID as well the services type automatic.
But after doing all these things whenever I tried to run the WAMP with standard user Privilege I always got the issue of the Administrative password with dim background, to get sort this out what I did was wrote the script and make it run….. bingo… it works… here is the script which you can use.
set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.run “runas /user:computername or domainnameusername %comspec%” ‘Open command prompt
WshShell.SendKeys “password” ‘send password
WshShell.SendKeys Chr(34) + “c:wampwampmanager.exe” + Chr(34)
WshShell.SendKeys “exit” ‘Close command prompt
set wshshell = nothing
Hoping to get your response on this.