Babu VT
2009-06-29 15:51:08 UTC
Hi,
I'm trying to clean "$NTUninstall..." folders from remote machines and found
the below snippet useful.Unfortunately it isn't deleting any folders.Can
someone point me where is the fault... I can't use FSO objects since I need
to delete folders in multiple machines where C$ shares might not be
available.
strComputer ="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
strQueryString1 = "Select * from Win32_Directory where Name = '" &
OSRootDir & "'"
Set colSubfolders = objWMIService.ExecQuery (strQueryString1)
For Each objFolder in colSubfolders
If Instr( UCase(objFolder.Name), "$NTUNINSTALL" ) > 0 then
strReport = strReport & "Deleted :" & strcomputer & ":" & objFolder.Name
& " uninstall folder" & vbCrLf
objFolder.delete
End If
Next
I'm trying to clean "$NTUninstall..." folders from remote machines and found
the below snippet useful.Unfortunately it isn't deleting any folders.Can
someone point me where is the fault... I can't use FSO objects since I need
to delete folders in multiple machines where C$ shares might not be
available.
strComputer ="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
strQueryString1 = "Select * from Win32_Directory where Name = '" &
OSRootDir & "'"
Set colSubfolders = objWMIService.ExecQuery (strQueryString1)
For Each objFolder in colSubfolders
If Instr( UCase(objFolder.Name), "$NTUNINSTALL" ) > 0 then
strReport = strReport & "Deleted :" & strcomputer & ":" & objFolder.Name
& " uninstall folder" & vbCrLf
objFolder.delete
End If
Next