Remove the games from Windows XP
We have some users that abuse the games installed on their PCs, to the point it is a distraction. Management wants the games removed. So I removed them from our Ghost images. Now I need to remove them off of PCs in use. So I found a script on the Internet that uses WMI, and altered to work in my environment. The goals were to silently uninstall the Windows XP Games feature remotely, and also to kill the games first in case someone was playing them (which would block the uninstall). Note that I use a system admin tool named Hyena, from www.systemtools.com, to run these scripts against remote machines. Hyena makes ky life easier.
Here are the scripts (sorry about the formatting):
'Kill any games that are running
'Hyena passes the %E% vairable - Computer Name, to the script
strComputer = WScript.Arguments.Item(0)
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'sol.exe'")
For Each objProcess In colProcessList
objProcess.Terminate()
Next
Set colProcessList = Nothing
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'spider.exe'")
For Each objProcess In colProcessList
objProcess.Terminate()
Next
Set colProcessList = Nothing
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'mshearts.exe'")
For Each objProcess In colProcessList
objProcess.Terminate()
Next
Set colProcessList = Nothing
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'freecell.exe'")
For Each objProcess In colProcessList
objProcess.Terminate()
Next
Set colProcessList = Nothing
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'pinball.exe'")
For Each objProcess In colProcessList
objProcess.Terminate()
Next
Set colProcessList = Nothing
' Uninstall games from Windows XP
'=========================
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
sPrograms = WshShell.SpecialFolders("AllUsersPrograms")
If (Fso.FolderExists(sPrograms & "\Games")) Then
' Create file for uninstalling games
Set f = Fso.CreateTextFile("c:\windows\inf\wmdtocm.txt", True)
f.WriteLine("[Components]")
f.WriteLine("freecell=off")
f.WriteLine("hearts=off")
f.WriteLine("minesweeper=off")
f.WriteLine("msnexplr=off")
f.WriteLine("pinball=off")
f.WriteLine("solitaire=off")
f.WriteLine("spider=off")
f.WriteLine("zonegames=off")
f.Close
WshShell.Run "sysocmgr.exe /i:c:\windows\inf\sysoc.inf /u:""c:\windows\inf\wmdtocm.txt""
/q", 1, True
Fso.DeleteFolder(sPrograms & "\Games"), True
End If




6 comments:
you're heinous
Yes, Evil. Pure Evil.
Of course removing the games from XP doesn't stop Yahoo.
FYI... This just deletes the shortcuts to the games in the start menu. Any user that can create a shortcut can access these games still. To keep users from doing this you will have to delete the executable for each game. I am currently work on a project at work to remove games too.
Actually it kills the games (if they are in use) and then uninstalls them. It doesn't just remove the shortcut. If this isn't happening there could be an issue with the script on your machine.
A savvy user can still copy the games onto a USB drive and run them, however.
Why not just go to the server, open explorer.exe, in the address bar, type \\computername\c$
Then go to \\computername\c$\Documents and Settings\All Users\Start Menu\Programs
Then delete the Games directory...
much easier!
Anonymous said ...
"Why not just go to the server, open explorer.exe, in the address bar, type \\computername\c$
Then go to \\computername\c$\Documents and Settings\All Users\Start Menu\Programs
Then delete the Games directory...
much easier!"
My Response is:
Noob! /facepalm
[1] Why go to a server for this?
[2] Why explorere.exe...?
From your Admin workstation:
Start>Run>
[3] Try Deleting a remote folder ( like \games) with an .exe ( like sol.exe) in use... Ahhhh! Now you see the value of the process kill in this script.
[4] SCRIPT IT! - think of what you are doing "much easier", then multiply it by 30-250 ( or more) machines.. all of a sudden it is not so easy. Lrn2script
-=Ed
Post a Comment