Need help with a script to remove media player icon from the desktop
Posted on 2007-10-19
I need assistance in writing a script that will remove windows media player shortcut from the desktop. I found this script but it doesn't seem to work.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_ShortcutFile Where FileName = 'Windows Media Player'")
For Each objItem in colItems
If Instr(objItem.Name, "desktop") Then
strPath = objItem.Name
strPath = Replace(strPath, "\", "\\")
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_Datafile Where Name = '" & strpath & "'")
For Each objFile in colFiles