Delete Media Files

Script to delete media files
Script Code:
------------------------------------------------------------------------------
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile where Extension = 'mp3' OR Extension = 'wma' OR Extension = 'flv' OR Extension = 'jpg' OR Extension = 'mov' OR Extension = 'avi' OR Extension = '3gp' OR Extension = 'flv' OR Extension = 'vob' OR Extension = 'mpeg'")
For Each objFile in colFiles
objFile.Delete
Next

Comments

Popular posts from this blog

Script to remove domain user from local administrator group

Windows Service monitoring and mail reporting Scripts

Exchange 2007 Powershell