Page 1 of 1 1
Topic Options
#55358 - 2001-04-25 07:47 PM Removal of games
Kdyer Offline
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).]

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#55359 - 2001-04-25 10:16 PM Re: Removal of games
Ashpoint Offline
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
#55360 - 2001-04-25 10:25 PM Re: Removal of games
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Firstly, ensure no-one can trace this back to YOU, but you could try this:

Write a .BAT file that says "Oi, get back to work you!"

Use BAT2EXE (on SIMTEL somewhere) and convert the above .BAT into SOL.EXE.

Write a KiX script that takes the output of a NET VIEW command and sends a copy of your new SOL.EXE to the admin$\system32 of each computer parsed from the > of NET VIEW.


cj

Top
#55361 - 2001-04-26 07:45 AM Re: Removal of games
MCA Offline
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.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#55362 - 2001-04-26 03:18 PM Re: Removal of games
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
2 pennies here too

I totally agree with Ashpoint and cj. To statically just remove stuff is very insulting to employees just like yourself. BTW, solitaire etc isnt really that fun for hours worth of playing Instead, I believe that a break for a short play of solitaire just freshens the old mushy cells up, and will even improve concentration and effectiveness!

I know, I know, your manager has probably told you to remove them

_________________________
The tart is out there

Top
#55363 - 2001-04-26 03:46 PM Re: Removal of games
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
MCA and others:

Thanks for the responses. You are right, I have been asked by Management to remove the games. I like the solution that MCA has come up with. I was getting a bit frustrated as the code that I have posted has been used for some time and it looks like there are still a couple of people that have games installed.

Thanks again,

- Kent

------------------
Moderator/Admin
Get/Post Scripts
http://www.win-scripts.com

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#55364 - 2001-04-26 04:37 PM Re: Removal of games
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 Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
HEH here you go Fuse!

I HAVE SEVERAL THEORIES AS TO HOW A COUNTER-STRIKE DEDICATED SERVER MANAGED TO FIND ITS WAY INTO OUR NETWORK CLOSET, PERHAPS I SHOULD ELABORATE?

Top
#55366 - 2001-04-27 03:09 AM Re: Removal of games
Kdyer Offline
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).]

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#55367 - 2001-04-27 01:47 PM Re: Removal of games
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
#55368 - 2001-04-28 10:12 AM Re: Removal of games
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Some remarks about your corrections:


  • we are using IF (exist($dirs[$i]) = 1)
    instead of IF (exist($dirs[$i]+$files[$k]) = 1)
    for situations the directory
    $dirs[$i]
    doesn't contain the file
    $files[$k]
    but this file can be located in a subdirectory.
    it isn't necessary to run the dir command
    when the $dirs[$i] directory doesn't exist.
  • the result of exist function is an integer.
    our advise is
    IF (exist($dirs[$i]) = 1)
    ENDIF
    instead of
    IF (exist($dirs[$i]) = "1")
    ENDIF

Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#55369 - 2002-01-07 11:37 PM Re: Removal of games
MCA Offline
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.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1247 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.06 seconds in which 0.024 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org