Deactivate admin privileges
Posted: 14 Oct 2018 16:05
I'm having some problems with a script i'm making. Here is a short background. At my work (a computer store) we do alot of installations for the customers. Until now we have done most of the installations manually wich have been a pain in the ass. So I started to write a script. The script contains alot of tools for our daily work and it has a total of 20 something batch files for different purposes. So the main bat file is called start and I run that with admin privileges (thru a shortcut). The admin rights is nessecery for the whole script to work properly. What I´ve noticed is that the admin rights seem to be inherited to other bat files that you use the call or start command on. Here comes the problem. One of the bat files downloads the spotify installer, starts the installer and should install the program. BUT... spotify installer does not allow you to run it with admin rights. It just pops up a messagebox that says something like "Run this program as a standard user, not as an administrator".
I find this very strange. Is there a work around for this? I have not found anything when I googled if there is a command for temporarily removing the inherited admin rights for a bat file.
If I run the spotify bat file directly without starting the elevated start.bat file first, it works perfectly. But f I run it thru the main file (start.bat) it won´t work.
Anyone who sits on a solution for this?
The, not so good, solution I´ve managed to create so far is this:
Starting start.bat
Automatically copying spotify.bat to autostart
Automatically restarting computer with shutdown.exe -r -t 0
spotify.bat runs thru autostart, downloads spotify and installs the program. It then deletes the downloaded installation file and the .bat in autostart and restarts the start.bat again so the user can continue the installation.
Is there another, more convinient way so you dont need to restart the computer?
I find this very strange. Is there a work around for this? I have not found anything when I googled if there is a command for temporarily removing the inherited admin rights for a bat file.
If I run the spotify bat file directly without starting the elevated start.bat file first, it works perfectly. But f I run it thru the main file (start.bat) it won´t work.
Anyone who sits on a solution for this?
The, not so good, solution I´ve managed to create so far is this:
Starting start.bat
Automatically copying spotify.bat to autostart
Automatically restarting computer with shutdown.exe -r -t 0
spotify.bat runs thru autostart, downloads spotify and installs the program. It then deletes the downloaded installation file and the .bat in autostart and restarts the start.bat again so the user can continue the installation.
Is there another, more convinient way so you dont need to restart the computer?