Link to home
Start Free TrialLog in
Avatar of Jerry Atkins
Jerry Atkins

asked on

Run batch file elevated through group policies

I have a batch file that I wrote to upgrade a software package on my systems. This batch files makes a registry change so needs to run with admin privileges. I can run it manually from and elevated command prompt with no problem. When I place the script in my Domain Group policy to run at startup it twill not run.
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

When I place the script in my Domain Group policy to run at startup it twill not run.
This issue is not admin rights. Startup scripts start with that. Can you post script?
Avatar of Jerry Atkins
Jerry Atkins

ASKER

Here is the batch file. renamed it to a text file for upload purposes
Firerms.txt
SOLUTION
Avatar of Don
Don
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Authenticated users have permissions to the share and security to the folder to read and execute, I can add domain computers as well
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have given Domain Computers group access to the shared folder, but it still is not running
Just a question, why use script?

Do this with GPO Registry Preferences and item level filter
REM // Set Registry Key for SQL Server
IF !OS_64!==1 (
	reg add HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\RMS5SQL_DSN   /v Server /t REG_SZ /d XXXX  /f 
	) ELSE (
	reg add HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\RMS5SQL_DSN   /v Server /t REG_SZ /d XXXX  /f 
	)

Open in new window


Deploy this as a software package
		>>!rms_updatelog! ECHO Installing new version...
		>>!rms_updatelog! ECHO Log: !rms_setuplog!
		>>!rms_updatelog! msiexec.exe /X {524EE37E-4E8E-42F1-A92E-0C1E8398F747} /qn /L* !rms_setuplog!
		>>!rms_updatelog! msiexec /i "c:\temp\FireRMS\FireRMS.msi" ALLUSERS=2" /L* !rms_setuplog!
		>>!rms_updatelog! ECHO Errorlevel: %ERRORLEVEL%

Open in new window


Do this with GPO Environmental variables and item level filter
	FOR /F %%F IN (' ipconfig/all ^| find /i /c "Default Gateway . . . . . . . . . : 10.139.30" ') DO (
		IF %%F GEQ 1 (
			SET ServerLocation="\\XXXX\IT\Deploy\FireRMS"
		)
	)

Open in new window

I am using script because this is what I am familiar with, and was able to modify the script  from one an associate had written in the past.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks I have read this, I need to go but I will try it tomorrow.
I was out at a remote site this morning I tried setting the HiberbootEnabled to 0 in the registry on a windows 10 computer with no luck, It also does not run on windows 7 computers either
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You found a solution? Please share it, so other scan benefit.
The solution for Windows 10 was the registry change as mentioned above to disable the fast startup when shutdown. The Windows 7 machine I was using for testing had not been online for a while for some reason it was not syncing properly with the network. I tried a different windows 7 machine and it worked right away. So the second computer I forced some updates and got it active, after that the script ran properly.