Need assistance configuring GPO assigned script to run with admin privileges under normal domain user account

I am attempting to silently run an uninstall script via a GPO when a normal domain user logs into the device.
My understanding is that anything run at startup uses the system account and therefore the script should work fine but that is not my experience. The files copy over fine and the script runs but not with admin (install) privileges.

Any assistance to resolve this is appreciated

(See attached screenshots)

CMD file being executed:

@echo off
if not exist "C:\Programdata\install_wim_tweak.exe" xcopy "\\maccrayhs\msiapps\uninstall_edge\*.*" "C:\Programdata\"
echo Uninstalling Microsoft Edge...
cd /d "%~dp0"
echo Uninstalling Microsoft Edge...
CLS
C:\Programdata\install_wim_tweak.exe /o /l
C:\Programdata\install_wim_tweak.exe /o /c Microsoft-Windows-Internet-Browser-Package /r
C:\Programdata\install_wim_tweak.exe /h /o /l

Open in new window

Screenshot-from-2018-11-16-09-31-08.png
Screenshot-from-2018-11-16-09-31-35.png
Raymond NortonWAN AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MaheshArchitectCommented:
If user doesn't have admin rights on machine, then uninstall scripts at logon or logoff will not work

U need to add scripts to system start up script under computer configuration
Raymond NortonWAN AdminAuthor Commented:
Correct, that is what my screenshots show. Do I need to do it differently than what is shown?
Shaun VermaakTechnical SpecialistCommented:
Run those EXEs as a Software Installation using Zap files
https://www.itninja.com/blog/view/use-zap-files-to-publish-non-msi-setups-via-gpo
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Raymond NortonWAN AdminAuthor Commented:
Links are broken and I am hoping to resolve the issue without installing third-party software. Maybe that is not realistic.
Shaun VermaakTechnical SpecialistCommented:
Software deployment GPO and zap files are not 3rd party
NVITEnd-user supportCommented:
How do you know the cmd script isn't running? To test, I'd put a line at the top that echo's text to a file. If the file exists, with the text, it works. e.g.

@echo off
ECHO It works>>c:\testscript.txt

if not exist "C:\Programdata\install_wim_tweak.exe" xcopy "\\maccrayhs\msiapps\uninstall_edge\*.*" "C:\Programdata\"
echo Uninstalling Microsoft Edge...
cd /d "%~dp0"
echo Uninstalling Microsoft Edge...
CLS
C:\Programdata\install_wim_tweak.exe /o /l
C:\Programdata\install_wim_tweak.exe /o /c Microsoft-Windows-Internet-Browser-Package /r
C:\Programdata\install_wim_tweak.exe /h /o /l

Open in new window

Raymond NortonWAN AdminAuthor Commented:
It runs but does not execute the program properly. if I choose to run as administrator, it runs and executes properly. That will not work in our environment. I need it to run with elevated privs in startup.
MaheshArchitectCommented:
have you tried disabling UAC on affected machine and executed script with startup GPO

may be you need to disable user access controls form gpedit.msc on machine instead of control panel
Raymond NortonWAN AdminAuthor Commented:
Really don't want to do that . Tested a gpo, disabling UAC and user got a pop up saying UAC was disabled but needed a reboot.
Raymond NortonWAN AdminAuthor Commented:
Shaun Vermaak, do you have an example of how zap might work executing the .cmd  shown in the original post? I am not finding simple documentation explaining it.
serialbandCommented:
Can that script be run under the computer configuration instead of the user?
Shaun VermaakTechnical SpecialistCommented:
Shaun Vermaak, do you have an example of how zap might work executing the .cmd  shown in the original post? I am not finding simple documentation explaining it.
In the article posted
Raymond NortonWAN AdminAuthor Commented:
I couldn't figure out how to get zap to work, so I went with psexec.

I copied necessary files over to each workstation via a gpo startup script and then ran the following command to execute the .cmd file:

psexec -s "@text file of workstation IPs" \\server\share\uninstall.cmd

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.