[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.
Cause:
To get Run WAMP Server Completely it requires the two essential services to get run with administrative privilege. Those are
Solution:
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
WScript.Sleep 1000
WshShell.SendKeys “password” ‘send password
WshShell.SendKeys “{ENTER}”
WScript.Sleep 1000
WshShell.SendKeys Chr(34) + “c:wampwampmanager.exe” + Chr(34)
WshShell.SendKeys “{ENTER}”
WshShell.SendKeys “exit” ‘Close command prompt
WshShell.SendKeys “{ENTER}”
WScript.Sleep 1000
set wshshell = nothing
Hoping to get your response on this.
Related Posts
Configuring Teams PowerShell
[Solved]Adding Federation Domain… got Frozen for unexpectedly long time
[Solved] Couldn’t find Enterprise Container
About Author
pdhewjau
Prashant is a Principal Cybersecurity Specialist at Thakral One Nepal. His prior position as a Modern Work Security Specialist at Microsoft saw him providing invaluable guidance to major clients in Bangladesh, Brunei, Cambodia, and Myanmar, assisting them with their foundational security needs. Awarded the esteemed Microsoft Most Valuable Professional (MVP) accolade in 2017, Prashant is recognized globally among Microsoft peers. Since 2010, he has imparted his expertise as a Microsoft Certified Trainer (MCT), conducting specialized training across Nepal.