JSI Tip 9831. How can a script configure Group Policy to reinstall a software deployment on a local or remote computer?

In tip 8412, I explained how deleting a registry sub-key would cause Group Policy to reinstall deployed software.

Using REG.EXE, built into Windows XP and Windows Server 2003, or from the Windows 2000 Support Tools, I have scripted DeploymentName.bat to delete the sub-key of a matching Deployment Name data value.

The syntax for using DeploymentName.bat is:

DeploymentName Name Computer


Name     contains the Deployment Name string to match.

Computer contains the NetBIOS computer name a the computer, like JSI009, whose registry is to be searched and altered.
DeploymentName.bat contains:
@echo off
if \{%2\}==\{\} @echo Syntax: DeploymentName Name Computer&goto :EOF
set deploy=%1
set deploy=%deploy:"=%
set comp=%2
set comp=%comp:"=%
set comp=\\%comp:\=%
set key="%comp%\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt"
set fnd=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmtfor /f "Tokens=*" %%a in ('REG QUERY %key% /S') do (
 set line=%%a
 call set work=!line:%fnd%=!
 if "!line!" NEQ "!work!" set dk="%comp%\!line!"
 set OK=N
 for /f "Tokens=*" %%x in ('@echo %%a ^|find /i "%deploy%" ^|find "Deployment Name"^|find "REG_SZ"') do (
  set OK=Y
 if "!OK!" EQU "Y" REG DELETE !dk! /F

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.