#55358 - 2001-04-25 07:47 PM
Removal of games
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
I am using the following to remove games from our systems. Anybody have a cleaner method of doing this?I have seen that some of this info can be also captured from - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders code:
; This removes the most common Windows Games and the LNK files used to launch them :NOGAMES ;SET SOME VARIABLES $P="%windir%\SYSTEM32" $Q="%userprofile%\STARTM~1\PROGRAMS\ACCESS~1\GAMES" $EXISTMSHEARTS = $P + "\MSHEARTS.EXE" $EXISTMSHEARTSS = $Q + "\HEARTS.LNK" $EXISTSOL = $P + "\SOL.EXE" $EXISTSOLS = $Q + "\SOLITAIRE.LNK" $EXISTWINMINE = $P + "\WINMINE.EXE" $EXISTWINMINES = $Q + "\MINESWEEPER.LNK" $EXISTFREECELL = $P + "\FREECELL.EXE" $EXISTFREECELLS = $Q + "\FREECELL.LNK" $EXISTPINBALL = "C:\Program Files\Windows NT\Pinball\PINBALL.EXE" $EXISTPINBALLS = $Q + "\PINBALL.LNK";LOOK FOR THE MSHEARTS GAME IF EXIST($EXISTMSHEARTS) DEL $EXISTMSHEARTS ENDIF ;LOOK FOR THE MSHEARTS SHORTCUT IF EXIST($EXISTMSHEARTSS) DEL $EXISTMSHEARTSS ENDIF ;LOOK FOR THE SOLITAIRE GAME IF EXIST($EXISTSOL) DEL $EXISTSOL ENDIF ;LOOK FOR THE SOLITAIRE SHORTCUT IF EXIST($EXISTSOLS) DEL $EXISTSOLS ENDIF ;LOOK FOR THE MINESWEEPER GAME IF EXIST($EXISTWINMINE) DEL $EXISTWINMINE ENDIF ;LOOK FOR THE MINESWEEPER SHORTCUT IF EXIST($EXISTWINMINES) DEL $EXISTWINMINES ENDIF ;LOOK FOR THE FREECELL GAME IF EXIST($EXISTFREECELL) DEL $EXISTFREECELL ENDIF ;LOOK FOR THE FREECELL SHORTCUT IF EXIST($EXISTFREECELLS) DEL $EXISTFREECELLS ENDIF ;LOOK FOR THE PINBALL GAME IF EXIST($EXISTPINBALL) DEL $EXISTPINBALL ENDIF ;LOOK FOR THE PINBALL SHORTCUT IF EXIST($EXISTPINBALLS) DEL $EXISTPINBALLS ENDIF ;LOOK FOR THE GAMES FOLDER IF EXIST($Q) RD $Q ENDIF RETURN
Thanks, Kent ------------------ Moderator/Admin Get/Post Scripts http://www.win-scripts.com
[This message has been edited by kdyer (edited 25 April 2001).]
|
|
Top
|
|
|
|
#55359 - 2001-04-25 10:16 PM
Re: Removal of games
|
Ashpoint
Starting to like KiXtart
Registered: 1999-08-27
Posts: 192
Loc: Sydney, NSW, Australia
|
Just my 2 pennies worth...A) I would rename the files rather than delete them - personal preference! BTW, if they have access to the Contol Panel (AND you have a i386 folder in the system), couldn't they just re-install the game(s)? B) I encourage mouse deficient users to play solitaire to improve their skills. C) Employees who play computer games excessively are in the same class as employees who use the Company phone excessively for private use, or use the Internet excessively for private purposes. I reckon that's a management problem! If the work isn't being done then the employee needs a management fix (dismissal, councelling, etc) rather than taking their toys away. Other employees may "like" to play the occassional game in their own spare time. Best regards, Michael
|
|
Top
|
|
|
|
#55361 - 2001-04-26 07:45 AM
Re: Removal of games
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,We have create a piece of code, which can easily be extended with new files and directories to check for. The script is:
code:
:nogames ; this will remove the most common windows games. ; ; 1. specifies directories to check ; 2. specifies files to check ; 3. create a file which contains found entries (= files found in specific directory) ; 4. reset file attributes to normal ; 5. delete file ; --------------------------------------------------------------------------- ; user definable part ; --------------------------------------------------------------------------- $debug_mode="yes" ; - yes/no - no = no user output will be viewed $number_of_dirs=3 ; <- increase value by new dirs to look in DIM $dirs[$number_of_dirs+1] $dirs[1]="%windir%" $dirs[2]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop") $dirs[3]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Start Menu") $number_of_files=10 ; <- increase value by new files to check for DIM $files[$number_of_files+1] $files[ 1]="MSHEARTS.EXE" $files[ 2]="HEARTS.LNK" $files[ 3]="SOL.EXE" $files[ 4]="SOLITAIRE.LNK" $files[ 5]="WINMINE.EXE" $files[ 6]="MINESWEEPER.LNK" $files[ 7]="FREECELL.EXE" $files[ 8]="FREECELL.LNK" $files[ 9]="PINBALL.EXE" $files[10]="PINBALL.LNK" ; --------------------------------------------------------------------------- ; ; --------------------------------------------------------------------------- $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) <> "\") $tmp_directory=$tmp_directory+"\" ENDIF $tmp_file=$tmp_directory+"kixtart.tmp" IF (exist($tmp_file) = 1) del $tmp_file ENDIF $i=1 WHILE ($i <= $number_of_directories) $k=1 IF (substr($dirs[$i],len($dirs[$i]),1) <> "\") $dirs[$i]=$dirs[$i]+"\" ENDIF IF ($debug_mode = "yes") ? "check directory: "+$dirs[$i] ENDIF WHILE ($k <= $number_of_files) $entry=$dirs[$i]+$files[$k] IF (exist($dirs[$i]) = 1) SHELL "%comspec% /c dir "+CHR(34)+$entry+CHR(34)+" /b /s >>"+$tmp_file ENDIF $k=$k+1 LOOP $i=$i+1 LOOP SHELL "%comspec% /c echo -end.of.list- >>"+$tmp_file ? IF (exist ($tmp_file) = 1) IF (open(1,$tmp_file,2) = 0) $completed="no" WHILE ($completed <> "yes") $result=readline(1) IF (@error <> 0) or (instr($result,"-end.of.list-") <> 0) $completed="yes" ELSE IF (exist($result) = 1) IF (SetFileAttr($result,32) = 0) ENDIF IF ($debug_mode = "yes") ? "del " $result ENDIF del $result ENDIF ENDIF LOOP IF close(1) ENDIF ENDIF ENDIF IF (exist($tmp_file) = 1) del $tmp_file ENDIF
The user output is:
code:
check directory: C:\WINDOWS\ check directory: C:\WINDOWS\Desktop\ check directory: C:\WINDOWS\Start Menu\del c:\windows\mshearts.exe del c:\windows\start menu\programs\accessories\games\hearts.lnk del c:\windows\sol.exe del c:\windows\start menu\programs\accessories\games\solitaire.lnk del c:\windows\winmine.exe del c:\windows\start menu\programs\accessories\games\minesweeper.lnk del c:\windows\freecell.exe del c:\windows\start menu\programs\accessories\games\freecell.lnk del c:\windows\desktop\pinball.lnk
The temporary file "kixtart.tmp" contains after execution many dir ... /b /s commands:
code:
c:\windows\mshearts.exe c:\windows\start menu\programs\accessories\games\hearts.lnk c:\windows\sol.exe c:\windows\start menu\programs\accessories\games\solitaire.lnk c:\windows\winmine.exe c:\windows\start menu\programs\accessories\games\minesweeper.lnk c:\windows\freecell.exe c:\windows\start menu\programs\accessories\games\freecell.lnk c:\windows\desktop\pinball.lnk c:\windows\desktop\pinball.lnk c:\windows\start menu\programs\accessories\games\hearts.lnk c:\windows\start menu\programs\accessories\games\solitaire.lnk c:\windows\start menu\programs\accessories\games\minesweeper.lnk c:\windows\start menu\programs\accessories\games\freecell.lnk -end.of.list-
Greetings.
|
|
Top
|
|
|
|
#55364 - 2001-04-26 04:37 PM
Re: Removal of games
|
Anonymous
Anonymous
Unregistered
|
I don't know how the rest of you relax but I always play a game, generally Half-Life or Quake2, against other employees during my lunch break. The alternative is for stress and tension to build to the point where I may need to release it in some other fashion. As highlighted by Ashpoint, it's a managment problem to ensure we don't play during working hours, not mine (I'm the admin).
|
|
Top
|
|
|
|
#55365 - 2001-04-26 05:00 PM
Re: Removal of games
|
Bryce
KiX Supporter
   
Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
|
|
|
Top
|
|
|
|
#55366 - 2001-04-27 03:09 AM
Re: Removal of games
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
FWIW, here is the final code..Thanks MCA for the insights!! I like your KixStrip App too as it formats it much better than going through manually and formatting it! I initially thought it was removing the ":" for the pointer, but my bad as it was me running the text editor in column mode. I did make a change to the test for the existence of the files listed, so the user does not see anything going on. Here is what was changed:
code:
$entry=$dirs[$i]+$files[$k] $entry1 = exist($entry) ;IF (exist($dirs[$i]) = "1") IF ($entry1 = "1")
This also adds a component to log what is deleted.
code:
BREAK on :nogames; this will remove the most common windows games. ; ; 1. specifies directories to check ; 2. specifies files to check ; 3. create a file which contains found entries (= files found in specific directory) ; 4. reset file attributes to normal ; 5. delete file ; --------------------------------------------------------------------------- ; user definable part ; --------------------------------------------------------------------------- $debug_mode="no" ; - yes/no - no = no user output will be viewed $number_of_dirs=3 ; <- increase value by new dirs to look in DIM $dirs[$number_of_dirs+1] $dirs[1]="%windir%" $dirs[2]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop") $dirs[3]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Start Menu") $number_of_files=10 ; <- increase value by new files to check for DIM $files[$number_of_files+1] $files[ 1]="MSHEARTS.EXE" $files[ 2]="HEARTS.LNK" $files[ 3]="SOL.EXE" $files[ 4]="SOLITAIRE.LNK" $files[ 5]="WINMINE.EXE" $files[ 6]="MINESWEEPER.LNK" $files[ 7]="FREECELL.EXE" $files[ 8]="FREECELL.LNK" $files[ 9]="PINBALL.EXE" $files[10]="PINBALL.LNK" ; --------------------------------------------------------------------------- ; ; --------------------------------------------------------------------------- $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) <> "\") $tmp_directory=$tmp_directory+"\" ENDIF $tmp_file=$tmp_directory+"kixtart.tmp" IF (exist($tmp_file) = 1) DEL $tmp_file ENDIF $i=1 WHILE ($i <= $number_of_directories) $k=1 IF (substr($dirs[$i],len($dirs[$i]),1) <> "\") $dirs[$i]=$dirs[$i]+"\" ENDIF IF ($debug_mode = "yes") ? "check directory: "+$dirs[$i] ENDIF WHILE ($k <= $number_of_files) $entry=$dirs[$i]+$files[$k] $entry1 = exist($entry) ;IF (exist($dirs[$i]) = "1") IF ($entry1 = "1") SHELL "%comspec% /c dir "+CHR(34)+$entry+CHR(34)+" /b /s >>"+$tmp_file ;Log the Machine $result1=setconsole('show') $logshare='\\LOGSERVER\LOGINFO' $logdata=@date + "," + @time + "," + @userid + "," + @wksta + "," + $ipadr + ",WinNT," + $entry + Chr(13) + Chr(10) $logfile=$logshare+'\NOGAMES.TXT' $result1=0 $n=0 DO $result1=Open(3, $logfile, 5) IF $result1<>0 IF $n=0 ;First wait ? "Please wait" ELSE ;follow waits "." ENDIF SLEEP 3 ELSE $result1=WriteLine(3, $logdata) $result1=Close(3) ENDIF $n=$n+1 UNTIL $result=0 OR $n=5 ; --- End of Log... ENDIF $k=$k+1 LOOP $i=$i+1 LOOP SHELL "%comspec% /c echo -end.of.list- >>"+$tmp_file IF (exist ($tmp_file) = 1) IF (open(1,$tmp_file,2) = 0) $completed="no" WHILE ($completed <> "yes") $result=readline(1) IF (@error <> 0) OR (instr($result,"-end.of.list-") <> 0) $completed="yes" ELSE IF (exist($result) = 1) IF (SetFileAttr($result,32) = 0) ENDIF IF ($debug_mode = "yes") ? "del " $result SLEEP 3 ENDIF DEL $result ENDIF ENDIF LOOP IF close(1) ENDIF ENDIF ENDIF IF (exist($tmp_file) = 1) DEL $tmp_file ENDIF RETURN
Thanks, Kent ------------------ Moderator/Admin Get/Post Scripts http://www.win-scripts.com
[This message has been edited by kdyer (edited 27 April 2001).]
|
|
Top
|
|
|
|
#55367 - 2001-04-27 01:47 PM
Re: Removal of games
|
Anonymous
Anonymous
Unregistered
|
Bryce, thanks for the idea. Instead of wasting my experimental server running silly things like protocol analysis, testing of new software, etc. I should put it to proper use as a dedicated games server (as my predecessor had once done).
|
|
Top
|
|
|
|
#55369 - 2002-01-07 11:37 PM
Re: Removal of games
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,We had replace the variable "$number_of_dirs" in "$number_of_directories". New version of script is:
code:
:nogames ; this will remove the most common windows games. ; ; 1. specifies directories to check ; 2. specifies files to check ; 3. create a file which contains found entries (= files found in specific directory) ; 4. reset file attributes to normal ; 5. delete file ; --------------------------------------------------------------------------- ; user definable part ; --------------------------------------------------------------------------- $debug_mode="yes" ; - yes/no - no = no user output will be viewed $number_of_directories=3 ; <- increase value by new dirs to look in DIM $dirs[$number_of_directories+1] $dirs[1]="%windir%" $dirs[2]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop") $dirs[3]=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Start Menu") $number_of_files=10 ; <- increase value by new files to check for DIM $files[$number_of_files+1] $files[ 1]="MSHEARTS.EXE" $files[ 2]="HEARTS.LNK" $files[ 3]="SOL.EXE" $files[ 4]="SOLITAIRE.LNK" $files[ 5]="WINMINE.EXE" $files[ 6]="MINESWEEPER.LNK" $files[ 7]="FREECELL.EXE" $files[ 8]="FREECELL.LNK" $files[ 9]="PINBALL.EXE" $files[10]="PINBALL.LNK" ; --------------------------------------------------------------------------- ; ; --------------------------------------------------------------------------- $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) <> "\") $tmp_directory=$tmp_directory+"\" ENDIF $tmp_file=$tmp_directory+"kixtart.tmp" IF (exist($tmp_file) = 1) del $tmp_file ENDIF $i=1 WHILE ($i <= $number_of_directories) $k=1 IF (substr($dirs[$i],len($dirs[$i]),1) <> "\") $dirs[$i]=$dirs[$i]+"\" ENDIF IF ($debug_mode = "yes") ? "check directory: "+$dirs[$i] ENDIF WHILE ($k <= $number_of_files) $entry=$dirs[$i]+$files[$k] IF (exist($dirs[$i]) = 1) SHELL "%comspec% /c dir "+CHR(34)+$entry+CHR(34)+" /b /s >>"+$tmp_file ENDIF $k=$k+1 LOOP $i=$i+1 LOOP SHELL "%comspec% /c echo -end.of.list- >>"+$tmp_file ? IF (exist ($tmp_file) = 1) IF (open(1,$tmp_file,2) = 0) $completed="no" WHILE ($completed <> "yes") $result=readline(1) IF (@error <> 0) or (instr($result,"-end.of.list-") <> 0) $completed="yes" ELSE IF (exist($result) = 1) IF (SetFileAttr($result,32) = 0) ENDIF IF ($debug_mode = "yes") ? "del " $result ENDIF del $result ENDIF ENDIF LOOP IF close(1) ENDIF ENDIF ENDIF IF (exist($tmp_file) = 1) del $tmp_file ENDIF
Greetings.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1247 anonymous users online.
|
|
|