Hey All,
So been trying to get the LogonServer variable from a PsExec command prompt for awhile and after some trial and error was able to get it the following way. Which made my life easier, now I execute various update from a local server to the workstation rather than having BatchPatch copy it to the workstation.
Yes, powershell can do this but in our environment, powershell has been disable for various security reasons.
So this would be my first line in a bat file.
For /F “tokens=4* delims= ” %%x in (‘nltest /sc_query:your_domain ^| findstr Name’) do set “Server=%%x”
The above get the Logonserver name in FQDN format and set the Server variable. Now I use %Server% in a command to update acrobatReader for instances, the following would be my second line of my bat file.
msiexec.exe /p %Server%\Netlogon\patches\AcroRdrDCUpd1902120049.msp /q /norestart
One more trick, I use the DFS replication for DC to replicate whatever app or file I want deployed. So I copy a single copy of AcroRdrDCUpd1902120049.msp to my \\DCserver\Netlogon directory, wait for 30-60 mins to replicate throughout my enterprise and now I can call it in my batch
30 remote office Workstation done in 15 mins…
BTW we have use this to upgraded win7 to win10, Pre-copy the install file to a local server and execute the following…
For /F “tokens=4* delims= ” %%x in (‘nltest /sc_query:your_domain ^| findstr Name’) do set “Server=%%x”
xcopy /s /e /v %Server%\Installs\Win10_Upgrade\*.* C:\Win10_Upgrade\ /Y
C:\Win10_Upgrade\setup.exe /auto upgrade /DynamicUpdate disable /ShowOOBE none /Telemetry disable /Compat IgnoreWarning /imageindex 1
Happy Batch Patching….