|
|
File Categories |
 |
|
|
|
 |
|
|
File download disclaimer |
 |
|
The files in this section are offered for your convinience and use free of charge. The copyrights of the files themselves may lie with the file creator and are not nessisarily public domain, unless otherwise noted. It is our hope that you find this repository of files useful in making your life as a network administrator easier, however, as with any internet download care should be taken in the execution and use of these files. A trusted virus scanner should be employed to scan every file downloaded to ensure it is virus free, prior to use. Please note, in order to rate a script you must be a registered user. You're e-mail address used during registration will NEVER be shared or used for any other purpose than to contact you about a specific question. NO mass mailing, no "newsletters", no "emails from us with offers", etc... nothing but a personal e-mail from a staff member. All files are provided as-is and without warranty of any kind. |
|
 
|
|
Administrator Tools and Scripts |
 |
|
 | | How to use the VBScript Scripting.Dictionary object to store data to make key decisions. (A Magic Eightball Script) Author :: Jerry Lees Date :: Wed 07/09/2008 @ 08:45 |
| The Scripting.Dictionary object is a quite useful object. It will let you store data in a categorized manner through it's use of a key when you add data to the object. It works very much like a multi-dimensional array would, except that it is much easier to retrieve a specific type of data. You place the data into the object via the .add method and retrieve a specific item via it's key. The key can either be numeric or a string. In the example below, I've chosen a number. Now for the example... a script so useful that I'm certain it will become a key part of your decision making process at work... The Magic Eight Ball! Now, before you laugh not everyone has a magic eight ball (I have two) and that's a shame because they really do help with making decisions. read article
I've been writing lately on individual topics and thought it was time for a little fun, while introducing you to a new object in the process... the Scripting.Dictionary object! (and random number generation in the process) The Scripting.Dictionary object is a quite useful object. It will let you store data in a categorized manner through it's use of a key when you add data to the object. It works very much like a multi-dimensional array would, except that it is much easier to retrieve a specific type of data. You place the data into the object via the .add method and retrieve a specific item via it's key. The key can either be numeric or a string. In the example below, I've chosen a number. Now for the example... a script so useful that I'm certain it will become a key part of your decision making process at work... The Magic Eight Ball! Now, before you laugh not everyone has a magic eight ball (I have two) and that's a shame because they really do help with making decisions. Just run the script below several times and ask it these questions: Will anyone notice if I reboot the exchange server now?
Will the network survive while the Network Guys upgrade the switches?
Will the servers survive another patch Tuesday?
Does my boss appreciate me enough to give me a $10,000 raise?
|
| |
|
 | | A simple way to Write to the registry with VBScript Author :: Jerry Lees Date :: Fri 06/06/2008 @ 07:05 |
| Example code from my blog entry at the ITKE entitled, A simple way to Write to the registry with VBScript. read article
Last time I posted I gave you a function that provided A simple way to read the registry with VBScript, in this posting we’ll use the same Wscript.shell object as last time, just use a different method– the RegWrite Method! Keep in mind, writing to the registry can be dangerous to the stability of your system. If you do not specifically know you need to write the registry location, and with what value, I recommend not writing to the registry. I have used a made up registry location so running this script should be as safe as I can make it. This example writes to HKey_Current_User\VBScriptAdmin the key Teststring, which is a REG_SZ (or string) value. You’ll notice that this value likely doesn’t exist before you run the script. The method creates the entire path if it doesn’t exist– which is very nice! (Or not so nice if you typo the path.) At the end of the script you should see the ReadReg function reads the value back in and writes the value read, which should be Success!.
|
| |
|
 | | A simple way to read the registry with VBScript Author :: Jerry Lees Date :: Wed 06/04/2008 @ 07:57 |
| Example code from my blog entry entitled, A simple way to read the registry with VBScript it the ITKE. read article
On occasion when administering a group of systems you need to preform certain tasks depending on if something is installed or a particular setting is a certain value and the only way to determine if a system needs attention is to look in the registry. So, In this installment we will look at reading the registry with the Wscript.shell object. This is a simple task, as you can see from the function below in the example code. However, it’s something that will save you a ton of time in troubleshooting when you have to first check to ensure a particular system has the setting you need to change or that is creating a problem! In the example code below, I have attempted to keep it pretty generic in an effort to demonstrate the code on as many systems as possible– so it doesn’t do much because I’ve kept my registry checks limited to components I think should be installed on most all systems. However, it does present the concepts and I’ve added the major registry keys’ abbreviations you would use to reference them as comments in the code. Additionally, remember that you reference the path all the way to the data you want including the value name, if you are specifying a value. If you reference a registry key, but no value, you will get back the (default) value. Both examples are shown below, I encourage you to break out regedit and take a look at the values I referenced in the code below so you can better see what the code is doing. Also, you can look here to learn more about the regread method of the wscript.shell object.
|
| |
|
 | | Sending e-mails with vbscript using the cdo.sys object Author :: Jerry Lees Date :: Fri 05/23/2008 @ 07:46 |
| Example code from my ITKE blog posting entitled, Sending e-mails with vbscript using the cdo.sys object. This example code uses the CDO.Message object of CDOSYS to generate an e-mail. read article
Writing text files, Word docs, Excel spreadsheets with VBScript is great and all– but sometimes you just need a process to run and notify you when something happens. (Without remembering to check a file every day.) In fact, sometimes it’s nice to walk in and recieve an email in your inbox to remind you– or let you know all is well in the world. To accomplish this on windows 2003 and above the CDOSYS object is our best friend. There are a few caveates to using this script though. Note that (as I recall) CDOSYS is not available prior to Windows 2000, so if you’re running windows NT 4.0 you’ll need to use CDO.NTS instead, which is slightly different in syntax. Also, the object is installed as part of the SMTP service, so you will need the SMTP service installed on the system this script runs on to make it work. (Yes, it will work on Windows XP as well with the SMTP service installed.) Using CDOSYS is really easy. Basically, you create the CDO.Message object and then set 4 properties (TO, SENDER, TEXTBODY, and SUBJECT) then call the SEND method to actually do the sending of emails. Literally, it’s that simple. If you don’t believe me, check out the attached code.
|
| |
|
 | | Getting disk usage data with the filesystem object and the Excel.Application object in vbscript Author :: Jerry Lees Date :: Wed 05/14/2008 @ 01:59 |
| Example code from my ITKE blog posting entitled, Getting disk usage data with the filesystem object and the Excel.Application object in vbscript. This example code uses the Win32_LogicalDisk WMI class to gather free disk space on a drive in a server then saves it to an excel file using the excel.application object. read article
In my previous posting, entitled Working with the Excel.Application object in vbscript to create Excel Spreadsheets, we worked with excel in vbscript to create a excel spreadsheet. The spreadsheet wasn’t going to win any awards for complexity or usefulness, but none the less it was a spreadsheet– and more importantly it was generated by a script! I also promised to bring you a script to help you chart diskspace usage in my next posting in the series. This posting is the fulfilment of that promise! The script below uses WMI’s Win32_LogicalDisk class to grab the drives in the target system, specifically the drive you specify through the use of a where clause in the SQL statement that pulls back the WMI data. (Through the “where deviceid like” section of the SQL statement in the code) Also, I didn’t put a lot of effort into the code where the for/next loop is that loops through getting and saving the free space because I didn’t want to create a lot of extra complexity and wanted to create a script that would run through to completion pretty quickly. Currently, the script takes 10 minutes to complete. To test the script while it’s running, just create files in a folder and delete them a number of times. I created a 10Mb and 20Mb file and made a series of copy/pastes during execution– with a smattering of deletes in the mix. For further customization, you can look at the code from the posting I wrote a while back Reporting CPU usage by saving it to a file with the VBScript filesystem object to get a good feel for how to modify the loop to get what you want. In essence, change the number 2 in “wscript.sleep 2″ to a lager number to get a bigger gap between samples and change the 300 in the “For x = 1 to 300″ line to a larger number to get a longer sample period.
|
| |
|
|
|
|
 |  |