Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Workstation cleanup

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,44033
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Workstation cleanup
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Workstation cleanup - 3/3/2007 5:36:17 PM   
  tokiwoki

 

Posts: 8
Score: 0
Joined: 3/3/2007
Status: offline
Hi everyone, My boss asked me to write a script that silently uninstalls some software apps on workstations on our domain, so I wrote the following


      

Any comments or suggestions would be great since this is my first vbs script.  I noticed that trying to silently uninstall WinRar on one machine didn't do anything, but removing the /s flag asked the user for confirmation and then proceeded as normal.
 
 
Post #: 1
 
 RE: Workstation cleanup - 3/5/2007 1:24:35 AM   
  DiGiTAL.SkReAM


Posts: 1097
Score: 6
Joined: 9/6/2005
From: Florida, USA
Status: offline
Very nice for a first script.
My only suggestions would be:
1.) Use Option Explicit
    -It forces you to Dim your variables, and helps promote good coding practices
2.) Don't use On Error Resume Next unless you have to.
    -It hides any error messages that might be needed for debugging/troubleshooting
3.) Try condensing your code a little.
    -It makes it easier to read, and easier to maintain.  For example, if you wanted to run all of your commands in the background, with no windows, with your original script, you would have to change the ,1,true to ,0,true about 7 times.  With the below script, just change it in one place.


      


_____________________________

"There's the one man who learns by reading, the two men that learn by watching, and the rest of us have to pee on the electric fence for ourselves." - Roy Rogers

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

(in reply to tokiwoki)
 
 
Post #: 2
 
 RE: Workstation cleanup - 3/5/2007 10:45:16 PM   
  tokiwoki

 

Posts: 8
Score: 0
Joined: 3/3/2007
Status: offline
Cool thanks, that was very helpful!

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: Workstation cleanup - 3/6/2007 3:49:55 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:

ORIGINAL: DiGiTAL.SkReAM

2.) Don't use On Error Resume Next unless you have to.
-It hides any error messages that might be needed for debugging/troubleshooting


except when you want to do your own error handling...



_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 4
 
 RE: Workstation cleanup - 3/7/2007 12:50:08 AM   
  DiGiTAL.SkReAM


Posts: 1097
Score: 6
Joined: 9/6/2005
From: Florida, USA
Status: offline
quote:

ORIGINAL: kirrilian

quote:

ORIGINAL: DiGiTAL.SkReAM

2.) Don't use On Error Resume Next unless you have to.
-It hides any error messages that might be needed for debugging/troubleshooting


except when you want to do your own error handling...




I believe that would fall under the heading of "unless you have to".

_____________________________

"There's the one man who learns by reading, the two men that learn by watching, and the rest of us have to pee on the electric fence for ourselves." - Roy Rogers

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

(in reply to kirrilian)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Workstation cleanup Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts