Nitin_ted
Well-Known Member
- Messages
- 87
- Solutions
- 1
- Reaction score
- 2
- Points
- 8
Hi Prajwal, i notice many devices not getting Monthly updates in device Software center. I checked and found it could be cause by group policy. After i remove registry.pol and gpupdate /force the machine, user get the updates in their software center (i tried in 2-3machines). since PS1 is blocked in user device I prepare .Bat file. I need to run this file in user machine using GPO (maybe task schedule every month) but i can't run since in-order to remove registry.pol file required to have admin access. I prepare 1 bat file. Can you please advise if below .bat works and where to put Admin ID and PWD?
@echo off
:: Check for administrator privileges
net session >nul 2>&1
if %errorLevel% == 0 (
goto :start
) else (
echo This script requires administrator privileges.
echo Please run this script as an administrator.
pause
exit /B
)
:start
:: Unhide GroupPolicy folder
attrib -h -r -s "C:\Windows\System32\GroupPolicy"
:: Delete Registry.pol file
del /f /q "C:\Windows\System32\GroupPolicy\Machine\Registry.pol"
runas /user:administrator "cmd /c gpupdate /force"
echo Group Policy updated successfully.
pause
@echo off
:: Check for administrator privileges
net session >nul 2>&1
if %errorLevel% == 0 (
goto :start
) else (
echo This script requires administrator privileges.
echo Please run this script as an administrator.
pause
exit /B
)
:start
:: Unhide GroupPolicy folder
attrib -h -r -s "C:\Windows\System32\GroupPolicy"
:: Delete Registry.pol file
del /f /q "C:\Windows\System32\GroupPolicy\Machine\Registry.pol"
runas /user:administrator "cmd /c gpupdate /force"
echo Group Policy updated successfully.
pause