05 September, 2010

Delete local hotfix folders script (Windows XP only)

Deploying hotfixes ?
Have Windows XP in your environment ?

Here is a vbs script to delete all hotfix folders, just deploy it via GPP or any other method:
==================================
dim filesys, f
Set objShell=CreateObject("WScript.Shell")
Set objArgs = WScript.Arguments
'FolderName =objArgs(0) 'optional with parameter
Set fso=createobject("scripting.filesystemobject")
Set f = fso.GetSpecialFolder(0)
FolderName = f

Set fld_root = fso.GetFolder(FolderName)
For Each fld_sub In fld_root.SubFolders
  If (InStr(fld_sub.Name,"$")=>1) Then
       if fld_sub.Name ="$hf_mig$" Then
       Else
       'WScript.Echo "Deleting " & Foldername & "\" & fld_sub.Name
       fld_sub.delete
       End If
  End If
 Next
==================================

Enjoy...

No comments:

Post a Comment