473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

VBscript to delete games

Kindly check this VBscript that i used in Win2000 server, It doesn't seem to work. What seems to be the problem? Can you help me?
Expand|Select|Wrap|Line Numbers
  1. dim strExcludedPC
  2.  
  3. ServerFileSave="\\S06-admin-06\User Area\Save\"
  4. strComputer = "."
  5. ctr=0
  6.  
  7. arExcludedPCs=Array("PC1", "PC2")
  8. Set objNetwork = Wscript.CreateObject("Wscript.Network")
  9. objComputerName = objNetwork.ComputerName
  10.  
  11. '===Check for computers that are excluded, then quit script===
  12. for Each strExcludedPC in arExcludedPCs
  13.     if objComputerName=strExcludedPC then
  14.         wscript.quit
  15.     end if
  16. Next
  17.  
  18. Set objWMIService = GetObject("winmgmts:" _
  19.  & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  20.  
  21. Set colFiles = objWMIService.ExecQuery _
  22.  ("SELECT * FROM CIM_DataFile WHERE " _
  23.     & "FileName='bounce' AND Extension='exe' OR " _
  24.     & "FileName='avseq1' AND Extension='dat' OR " _
  25.     & "FileName='zagu' AND Extension='exe' OR " _
  26.     & "FileName='zagu1' AND Extension='exe' OR " _
  27.     & "FileName='zagu2' AND Extension='exe' OR " _
  28.     & "FileName='zagu3' AND Extension='exe' OR " _
  29.     & "FileName='MCFHuntsville' AND Extension='exe' OR " _
  30.     & "FileName='picachu' AND Extension='exe' OR " _
  31.     & "FileName='fight9' AND Extension='exe' OR " _
  32.     & "FileName='unfolding' AND Extension='exe' OR " _
  33.     & "FileName='wackywordsearch' AND Extension='exe' OR " _
  34.     & "FileName='sudoku' AND Extension='exe' OR " _
  35.     & "FileName='gridlock' AND Extension='exe' OR " _
  36.     & "FileName='cubedelic' AND Extension='exe' OR " _
  37.     & "FileName='magnetism' AND Extension='exe' OR " _
  38.     & "FileName='plumber' AND Extension='exe' OR " _
  39.     & "FileName='simon' AND Extension='exe' OR " _
  40.     & "FileName='plumber2' AND Extension='exe' OR " _
  41.     & "FileName='millionaire' AND Extension='exe' OR " _
  42.     & "FileName='xraye' AND Extension='exe' OR " _
  43.     & "FileName='Flash Games' AND Extension='exe' OR " _
  44.     & "FileName='acad' AND Extension='exe' OR " _
  45.     & "FileName='bou' AND Extension='exe' OR " _
  46.     & "FileName='scrabout' AND Extension='exe' OR " _
  47.     & "FileName='ttw' AND Extension='exe' OR " _
  48.     & "FileName='texttwist' AND Extension='exe' OR " _
  49.     & "FileName='hangaroo' AND Extension='exe' OR " _
  50.     & "FileName='hangman' AND Extension='exe' OR " _
  51.     & "FileName='same' AND Extension='exe' OR " _
  52.     & "FileName='zuma' AND Extension='exe' OR " _
  53.     & "FileName='zuma deluxe' AND Extension='exe' OR " _
  54.     & "FileName='zuma deluxe' AND Extension='zip' OR " _
  55.     & "FileName='bookworm' AND Extension='exe' OR " _
  56.     & "FileName='BookwormAdventures' AND Extension='exe' OR " _
  57.     & "FileName='BookWorm Adventures Deluxe From GameHouse By TFT-TEAM' AND Extension='exe' OR " _
  58.     & "FileName='pyramid' AND Extension='exe' OR " _
  59.     & "FileName='dynomite' AND Extension='exe' OR " _
  60.     & "FileName='riveriqgame' AND Extension='exe' OR " _
  61.     & "FileName='ra2' AND Extension='exe' OR " _
  62.     & "FileName='game' AND Extension='exe' OR " _
  63.     & "FileName='collapse' AND Extension='exe' OR " _
  64.     & "FileName='arcanoid' AND Extension='exe' OR " _
  65.     & "FileName='ptanks' AND Extension='exe' OR " _
  66.     & "FileName='feedingfrenzy' AND Extension='exe' OR " _
  67.     & "FileName='feedingfrenzy' AND Extension='zip' OR " _
  68.     & "FileName='scrabble' AND Extension='exe' OR " _
  69.     & "FileName='pool' AND Extension='exe' OR " _
  70.     & "FileName='blocks' AND Extension='exe' OR " _
  71.     & "FileName='allout' AND Extension='exe' OR " _
  72.     & "FileName='winamp' AND Extension='exe' OR " _
  73.     & "FileName='milyonaryo' AND Extension='exe' OR " _
  74.     & "FileName='tumblebugs' AND Extension='exe' OR " _
  75.     & "FileName='bob' AND Extension='exe' OR " _
  76.     & "FileName='bob' AND Extension='rwg' OR " _
  77.     & "FileName='MysteryCaseFiles' AND Extension='rwg' OR " _
  78.     & "FileName='PrimeSuspects' AND Extension='rwg' OR " _
  79.     & "Extension='mp3' OR Extension='mp4' or Extension='mpeg' OR Extension='wma'")
  80.  
  81.  
  82. '===Check if files found===
  83. For Each objFile in colFiles
  84.    ctr=ctr+1
  85. Next
  86.  
  87. '===Quit if no files found===
  88. if ctr=0 then
  89.     WScript.Quit
  90. end if
  91.  
  92. '===else write the text file==================================================================> games found
  93. objUserName = objNetwork.UserName
  94. mySaveFile="C:\" & objComputerName & ".txt"
  95.  
  96. Set fs = CreateObject("Scripting.FileSystemObject")
  97.  
  98. '===if server save folder does not exist, quit program===
  99. if NOT fs.FolderExists(ServerFileSave) then
  100. '======    msgbox "folder does not exist"
  101.     WScript.Quit
  102. end if
  103.  
  104. '===else determine if for appending or new create===
  105. if fs.FileExists(ServerFileSave & objComputerName & ".txt") then
  106.      Set myScriptFile = fs.OpenTextFile(mySaveFile, 8, True)
  107. else
  108.      Set myScriptFile = fs.CreateTextFile(mySaveFile, True)
  109. end if
  110.  
  111.  myScriptFile.WriteLine("-----------------------------------------------------------")
  112.  myScriptFile.WriteLine("The Network Administrator")
  113.  myScriptFile.WriteLine("Games and music files found at " & objComputerName & "@" & objUserName)
  114.  myScriptFile.WriteLine("Date: " & date() & "    Time: " & Time())
  115.  myScriptFile.WriteLine("===========================================================")
  116.  myScriptFile.WriteLine("NOTE: The following files are prohibited from our network")
  117.  myScriptFile.WriteLine("      and will be deleted automatically:")
  118.  myScriptFile.WriteLine("")
  119.  
  120.  
  121. '===Delete the files found===
  122. For Each objFile in colFiles
  123.  objFile.Delete
  124.  myScriptFile.WriteLine(objFile.Name)
  125.  ctr=ctr+1
  126. Next
  127.  
  128.    myScriptFile.WriteLine("")
  129.    myScriptFile.Close
  130.  
  131. '===Copy listing file to server===
  132. fs.CopyFile mySaveFile, ServerFileSave
  133. 'fs.DeleteFile mySaveFile (do not delete save files)
  134.  
  135. '===if games found, open txt file as warning to the user===        
  136. Set WshShell = WScript.CreateObject("WScript.Shell")
  137. WshShell.Run mySaveFile
  138.  
  139.  
  140. '    & "FileName='sol' AND Extension='lnk' OR " _
  141. '    & "FileName='freecell' AND Extension='lnk' OR " _
  142. '    & "FileName='winmine' AND Extension='lnk' OR " _
  143. '    & "FileName='msheart' AND Extension='lnk' OR " _
  144. '    & "FileName='pinball' AND Extension='lnk' OR " _
  145.  
  146.  
  147.  
  148.  
  149. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  150. Function CheckTrend()
  151.  
  152. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  153.     strComputer = "."
  154.     Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  155.  
  156.     Set colFiles2 = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE FileName='lpt$vpn'")
  157.  
  158.     '===Check if files found===
  159.     For Each objFile in colFiles2
  160.        ctr=ctr+1
  161.     Next
  162.  
  163.     '===Quit if no files found===
  164.     if ctr=0 then
  165.      myScriptFile.WriteLine("No TrendMicro virus pattern found!!!")
  166.     end if
  167.  
  168.     Dim fso, f
  169.     Set fso = CreateObject("Scripting.FileSystemObject")
  170.  
  171.     '===Write files found===
  172.     For Each objFile in colFiles2
  173.      myScriptFile.WriteLine(objFile.Name)
  174.      Set f = fso.GetFile(objFile.Name)
  175.      myScriptFile.WriteLine("   date created: " & f.DateCreated)
  176.      myScriptFile.WriteLine("")
  177.      ctr=ctr+1
  178.     Next
  179.  
  180. End Function
Sep 11 '07 #1
4 2044
bartonc
6,596 Expert 4TB
For software development, you'll want to post in the Visual Basic Forum, and please use [code] tags, as described in out Posting Guidelines. Thank you.
Sep 11 '07 #2
Cyberdyne
627 Expert 512MB
For software development, you'll want to post in the Visual Basic Forum, and please use [code] tags, as described in out Posting Guidelines. Thank you.
imagine if somebody sends this in an e-mail attachment and the person on the other side executes it.

Cyber
Sep 11 '07 #3
bartonc
6,596 Expert 4TB
imagine if somebody sends this in an e-mail attachment and the person on the other side executes it.

Cyber
Huh??? My post or viper888's? I don't get it either way.
Sep 12 '07 #4
epots9
1,351 Expert 1GB
imagine if somebody sends this in an e-mail attachment and the person on the other side executes it.

Cyber
It'll clean out the computer of any files that are media related and game exe's...but its just deleting the exe but the registry keys still are there and that can cause problems.
Sep 12 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Sean | last post by:
Hi, I need a pop-up window for user to confirm change. The default button is the second option (No). As the user only use IE, I think the VBScript is an option. The following code only works for...
3
by: Colin Graham | last post by:
Im working on some asp code using vbscript but i cant seem to get the following code to work. I can get the result from the database but im having to joy returning the value to the html code in...
3
by: Asif Rahman | last post by:
Hi all! Please improve on the following code to make sure the record gets deleted only when the function returns false. Now I see the msgbox, but the record gets deleted no matter the user...
3
by: JWM | last post by:
Hello: Here is what I am trying to do...... The user clicks on the delete icon, and gets a JavaScript client-side popup to confirm that he wants to delete. I am passing this client-side...
5
by: Zalek Bloom | last post by:
Hello, I am developing a simple ASP application with VBScript and Access database. I am testing it on my Win98SE machine using Personal Web Server. My machine is Celeron 2000 with 512Mb RAM. On...
1
by: PaulieS | last post by:
Hi all. Am migrating a customer from IIS5 on W2K server to IIS6 on W2K3. Zipped all the websites and unzipped them to the identical locations on new server. Used IISMT to migrate metabase. ...
3
by: =?Utf-8?B?Sm9obkhvcmI=?= | last post by:
I have a problem with client-side VBSCRIPT on a page with auto-postback controls. I have generated a simple page with a listbox, set to autopostback. This works OK. If I then generate some...
4
by: viper888 | last post by:
Hi to all, I'm the newly appointed network administrator in our office, and upon scanning all the PCs that are connected to the network, (by the way we're using a windows 2000 server) almost all...
5
by: Rohit111111 | last post by:
Hello All, I new to ASP and i am using VBScript, I want to delete a file which is located on the remote machine hbow can i delete that file.plz help its urgent
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.