Monday, April 6, 2009

Search and Delete Files on Windows Domain Structure

Use the script below to find and delete files according to their extensions.

strComputer = "."Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")Set colFiles = objWMIService.ExecQuery _("Select * from CIM_DataFile where Extension = 'mp3' OR Extension = 'mp4'")For Each objFile in colFilesobjFile.DeleteNext

No comments:

Post a Comment

 
span.fullpost {display:inline;}