wmic /node:@workstations.txt /failfast:on process call create "\\server\openshare\install_stuff.bat" wmic /node:@workstations.txt /failfast:on operatingsystem where Primary='True' call Win32ShutDown 6remotely creating processes on computers will drop your network creds when on the remote machines, so the bat/software repos need to be in a read-only unauthenticated share.
set flags=C:\StMary
if exist %flags%\frozen goto end
set dir=nul
if "%OS%" == "Windows_NT" set dir=
if not exist %flags%\%dir% mkdir %flags%
set root=C:\Windows
if "%OS%" == "Windows_NT" set root=%ALLUSERSPROFILE%
set desktop=%root%\Desktop
set startmenu=%root%\Start Menu
set programs=%startmenu%\Programs
set quicklaunch=%root%\Application Data\Microsoft\Internet Explorer\Quick Launch
set shortcuts=%desktop%\Shortcuts
set yes="P:\installers\stmary\yes.txt"
set rmdir=deltree /y
if "%OS%" == "Windows_NT" set rmdir=rmdir /s /q
set run=start /w
if "%OS%" == "Windows_NT" set run=start "Waiting..." /wait
set autoit=P:\Apps\AutoIt\AutoIt3A.exe
if "%OS%" == "Windows_NT" set autoit=P:\Apps\AutoIt\AutoIt3.exe
set sleep=ping 127.0.0.1 -n
set cls=@call :cls
if not "%OS%" == "Windows_NT" set path=C:\Windows\system;%path%
goto scuts
:cls
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@echo.
@if exist %flags%\pause pause
@goto :eof
:reboot
if "%OS%" == "Windows_NT" goto rebootNT
%windir%\rundll32.exe %windir%\system\shell32.dll,SHExitWindowsEx 6
goto bootwait
:rebootNT
%windir%\system32\shutdown.exe -f -r -t 2
:bootwait
%sleep% 20 >nul
%cls%
@echo Automatic restart failed.
@echo.
@echo Please turn off this computer by
@echo pressing the power button on the
@echo front of the system box.
:bootloop
@goto bootloop
:somefeat
if exist %flags%\somefeat goto nextfeat
%cls%
title Setting up some feature...
(code to set up some feature or install some app or whatever)
type nul >%flags%\somefeat
:scuts
if exist %flags%\scuts goto sshort
%cls%
title Creating All Users Shortcuts folder...
if not exist "%shortcuts%\%dir%" mkdir "%shortcuts%"
if "%OS%" == "Windows_NT" cacls "%shortcuts%" /t /g "curric\Domain Admins":f SYSTEM:f curric\Installer:f Everyone:r <>
type nul >%flags%\scuts
:sshort
if exist %flags%\sshort goto jre
%cls%
title Installing "Staff Shortcuts" shortcut...
copy /y "P:\Installers\StMary\staff-shortcuts\Staff Shortcuts.lnk" "%shortcuts%"
attrib +r "%shortcuts%\Staff Shortcuts.lnk"
type nul >%flags%\sshort
:jre
if exist %flags%\jre16011 goto twcli32
%cls%
title Installing Sun Java runtime environment 6 update 11...
set setupexe=P:\Installers\Java\jre-6u11-windows-i586-p-s.exe
%run% %setupexe% /s /v"/qn REBOOT=Suppress IEXPLORER=1 MOZILLA=1"
%cls%
title Uninstalling older Sun Java runtime environment versions...
%run% msiexec /qn /x {26A24AE4-039D-4CA4-87B4-2F83216010FF}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160070}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160060}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160050}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160040}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160030}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160020}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0160010}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150110}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150100}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150090}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150080}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150070}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150060}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150050}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150040}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150030}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150020}
%run% msiexec /qn /x {3248F0A8-6813-11D6-A77B-00B0D0150010}
del %flags%\jre*
type nul >%flags%\jre16011
>You are not logged in, either login or create an account to post comments
If your machines arent rebooting then you arent doing any windows updates, which is a big no-no. I'd also look at implementing WSUS and getting those machines patched ASAP. Especially with the new vulnerabilities we've seen in the past few months.
You can kill two birds with one stone here. Implement forced patching which will reboot, which will force them to log in, which will, you guessed it: install your software via script/AD/whatever.
posted by damn dirty ape at 9:09 AM on December 9, 2008 [1 favorite has favorites]