473,698 Members | 2,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBscript to delete games

5 New Member
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 2058
bartonc
6,596 Recognized Expert Expert
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 Recognized Expert Contributor
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 Recognized Expert Expert
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 Recognized Expert Top Contributor
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
5286
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 html button. I wonder how I can change it to VB code behind file and use a server control. Thanks. <script language="VBScript">
3
8265
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 order to open a specific document. any help appreciated. I dont get an error message but i get a blank screen. The problem seems to be with the Return Value of the function - i may not be using this correctly. <td>
3
14049
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 clicks yes or no. Thanks in advance. Asif =======================
3
1890
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 function a contactID. Then, I want to send the result of this confirm (true|false) to a server-side VBScript function, along with the contactID. The VBScript function will then perform a delete in the database for the specified contactID.
5
5755
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 the Access I have 2 tables, each one with less then 20 rows. The problem is, that each time my application access the database, the response is about 30 second. My questions: 1. How can I improve response time?
1
1013
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. Got this error when I tried to run a very basic page... code: <%@ LANGUAGE=vbscript %> <%
3
1714
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 client-side VBSCRIPT, VS creates a VBSCRIPT script block. Even if I delete everything within the block, just leaving the <script</scripttags, I get an error on the page if I click an item in the list box. If I use JScript, rather than VBScript, I don;t...
4
1693
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 of them have games. It was the department policy that no games must be installed in each PC. Can you guys help me with this? or can you modify this VBscript? dim strExcludedPC ServerFileSave="\\S1-admin-06\User Area\Save\" strComputer = "."...
5
3823
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
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.