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!
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.
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)
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)