Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete automaticly all Mucis files from all WinXP workstations

Status
Not open for further replies.

IRLASCHU

IS-IT--Management
Dec 29, 2007
28
GB
Hi all,

I am cleaning up a company network that I have inherited and al lot of the staff have Music, Video files on there workstations even when policy forbids this. I am coming to the point where I simple need to scan each Windows XP/2000 PC and delete all the files.

What I am thinking of is that I automatically start up all the computers in the office on a weekend with ‘WOL’ using a WOL tool or WinInstall.
Then somehow get all the computers to do a scan of volume C: and delete files with the file extension I selected (e.i. .mp3; .wav). Is there a way of doing this? Does it maybe need to be scripted first? I have seen it being done in a few very large enterprise organizations.

Thanks,
Alexander
 
vbscript should do, after some checking I found this but you might have someone in the vbscript forum touch it up for you...


'Script to delete files via name and/or file extension
'The script will search the local HD and delete all files with the same name and/or extension.
'Created by Cheyenne Harden October 27 2006

On Error Resume Next
strComputer = "."
strFileName = inputbox("Enter the name of the file you would like to delete!" & vbCrLf & "Do NOT type in the extension.")
strFileExtension = inputbox("Enter the file extension. Without the " & "'.'")

If strFileName > "" Then
If strFileExtension > "" Then
DeleteFileExt()

Else
DeleteFileName()
End If

ElseIf strFileExtension > "" Then
DeleteExtension()

Else
Wscript.Echo "No File Name Or Extension Entered"
Wscript.Quit

End If


Sub DeleteExtension()

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery ("Select * From CIM_DataFile Where Extension = '" & strFileExtension & "'")

For Each objFile in colFiles
errResults = objFile.Delete
Next
End Sub

Wscript.Echo "Files Deleted"

Sub DeleteFileExt()

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery ("Select * From CIM_DataFile Where FileName = '" & strFileName & "' and Extension = '" & strFileExtension & "'")

For Each objFile in colFiles
errResults = objFile.Delete
Next
End Sub

Sub DeleteFileName()

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery ("Select * From CIM_DataFile Where FileName = '" & strFileName & "'")

For Each objFile in colFiles
errResults = objFile.Delete
Next
End Sub
 
Fair warning on the deletion of the .wav, many windows sound files are in .wav. So you might want to be sure not to target the primary windows folder when you run your scan for deletion.

There is a point in wisdom and knowledge that when you reach it, you exceed what is considered possible - Jason Schoon
 
Make sure you have decent backups!!!!! You may find yourself looking for a new job should you delete someone importants presentation or critical wav files!

If someone did that to me I would possibly kill them as I have hundreds of wav files on my pc for our Telephone systems and I'd be a bit cheesed off if at 3am I was doing a emergency reinstall only to find the files missing !

Only the truly stupid believe they know everything.
Stu.. 2004
 
I think I would be more inclined to ask upper management to reissue the "banning" of music files with the statement that sytems may be checked at a later date and appropriate action taken. If you come up with a script that can delete music files, then you should be able to come up with a script that can find and report them. If you plan on maintaining some reasonable cooperation with users in the future, I wouldn't recommend you being the "music police". Let the users' supervisors handle that part.
 
Does banning music files include banning playing of CDs and MP3 players (not copying them to disk).

If it does, instead of removing music files, why not just disable media player, real player and whatever player they use to play them. If they can't play them, then they won't put them on.
 
I'd add my voice to what has been said. You would do better to scan for the music files and report them rather than summarily delete them, for you don't know what people will be working on that is legitimate for the organization. In addition, MP3 or other formats may be used, especially if someone in the organization is doing multimedia presentations.

You're better off to just scan systems, put the results to a log file, and then look it over for patently obvious file names.

Doing that is simple enough. This should get it:
Code:
DIR /A /O /S *.mp3 >> drivelog.txt

Should catch most of what people do. Hiding 'em via ADS is another matter entirely, but I'm not sure too many will be up on that (yet).
 
Hi all,

Thank you all for the response. All very important points! Well we are a small company doing B2B Marketing (100 People). All the Line Managers do not really have time or care about doing the task to check there employees PC's even when they meant too make sure they follow policy. I looked after all the systems there and after a failed infrastructure, I rebuild the systems from scratch. Now as IT Manager, reporting to the Managing Director I am trying to strictly clean up my network. To many people use, Music files. CD- players are on some teams ok but no downloading music is allowed.

How would you try to get the Network clean or as IT Manager reinforce the policy and try to get all the managers to then take control of the issue and check all staff follows policy?
‘MoLaker’ makes a very important point that I agree strongly with “I wouldn't recommend you being the "music police". Let the users'”

P.S. Does this post now need to be posted elsewhere?

 
IRLASCHU, only you and your boss are in a position to make the necessary decisions for controlling music downloads or any other software additions/changes, for that matter. If the dictate from your Managing Director is "no music" then it would seem it would be your job only to report abuse. Beyond that, I believe it would be your responsibility to find measures that could be put in place to prevent downloading music file - such as a proxy server and/or group policies. A proxy, of course, could only control Internet downloads and means money which is why it probably goes beyond your area of control. Unless your operation is run significantly differently than most, you probably do not have "direct report" authority with users. Attempting to apply such by carte blanc wiping out of audio files can only result in some sort of user revolt and placing you "outside" the office social circle. Once again, I recommend you report (with options on how to control the abuse) and then clean up the specific systems you are given the authority to do - and proceed with care.

As for posting in another location - yes, we have moved beyond the scope of this particular forum. You might want to post in "Overcoming Obstacles Getting My Work Done" forum in "Career Corner Forums" as this seems to more a management issue than a technical matter.
 
Have you considered just issuing a memo re-stating the company policy, and stating that all of those files will be deleted on X/X/X date? Might be better than just wiping everything out, and a lot of the problems will be cleaned up be the users.
 
Not allowing files with certain extensions is difficult to enforce. There are new formats coming out every few months and it is just a pain to keep up with it.

I don't know if a virus checker will do this but you could tell the virus checker that anything with an mp3 extension is suspect and the virus checker will quarantine any mp3 files when it does its daily run and you don't have to do anything. If the user wants them back, then just take them out of quarantine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top