Monday, September 18, 2017

Push GPUPDATE to List of Computers on Domain



@ECHO OFF
:: This Script must be run with Domain Admin rights
:: You also must have PSEXEC on your PC (See How To doc)
PING 1.1.1.1 -n 1 -w 500 >NUL
echo.
echo.
echo    --------------------------------------------
echo    --------------------------------------------
echo    ---- WELCOME TO THE SME MULTIPLE DEVICE ----
echo    ----    AUTOMATED GPUPDATE SCRIPT       ----
echo    --------------------------------------------
echo    --------------------------------------------
echo.
echo.
PING 1.1.1.1 -n 1 -w 1500 >NUL
echo.
REG ADD "HKEY_CURRENT_USER\Software\Sysinternals\PsExec" /v "EulaAccepted" /t "REG_DWORD" /d "1" /f

For /f "tokens=*" %%a in (gpupdate_computers.txt) Do psexec \\%%a -i gpupdate

:: To grab the latest list of all Devices in the domain use the following query in AD Powershell:
:: Get-ADComputer –filter 'Name -like "*"' -Searchbase "dc=sme-inc, dc=net" | Select-Object -ExpandProperty Name | Out-File -Encoding ascii gpupdate_computers.txt
PAUSE

No comments:

Post a Comment