vbscript

Dynamic Interesting Desktops

One of my first contract jobs was for a small IT company in the area. I worked with them for about 4 months before a permanent, salaried position came along. (Sorry, I like having someone else pay for the benifits) One of the most memorable things the owner shown me was his background.

Script to Simplify life

During my work day, I probably send a 20-30 email messages. Each time I typically look up someone's email address, copy it to the (keyboard) buffer (CTRL+C), click on a shortcut I have to open a new email, then paste the email address into the new message. I thought, what if my new email shortcut, would test the keyboard buffer and then automatically paste the address for me?

Server Inventory Script

I have been working on a number of projects lately where I need to touch most of the servers in our environment; be it changing DNS servers, or querying event logs, I needed a way to get every live server out there.

The attached script will query AD for all servers, then if pingable, it will attempt to gather more info via WMI. The final result is output to a CSV file in the C:\ root of the local computer.

  • Server name
  • OS version
  • Last Service Pack # applied (not patch version)
  • MAC Address, IP and DNS configuration for each active NIC

Query AD for Printer info

Expanding on my code to query single printer information, I found I could pull all networked printers from Active Directory(AD). This will help in cleaning up the naming standard for all our printers. Hopefully making DNS cleaner by using a single standard for host(A) records. Final file is written to c:\printer-info.csv. The attached script will return the following:

  • Printer name
  • Server name - where hosted
  • Port - name of printer port (local or network)
  • Share name

Modify Mailbox Alias field

We recently finished a project updating the naming standard for all our Windows AD accounts. Once completed, I found that approximately 3% of the accounts had the alias field set to this old naming standard. Googled high-and-low, I could not find a simple script to set the alias field. So...

Script Quickie

I am working on a project to cleanup a ton of DNS entries. Every once in a while, I find two A records pointing to the same IP address. To clean-up the extra entry, I am running a quick NBTStat -A against the IP address to see what NetBEUI name replies.

Exporting Exchange 2003 Mailbox Information

One of my peer departments is working on spamming the corporation. This internal spam, aka Corporate Newsletter, is to go out to everyone with a mailbox in the corporation. Unfortunately, a number of these people have abused their rights and their mailboxes are limited to receiving e-mail from only their managers.

Tool to Export DL Membership

Here is a small HTA applet that I have built to export the membership of various groups in Windows Active Directory. It provides some basic filtering (owner, specific OU, name contains), plus 3 modes of export, XLS, CSV, or HTML to screen. Beware, if you have office 2007, XLS is XLSX format.

To run this in your environment, it will need to be modified:
line 27 & 28

 strHTML=strhtml&"<option value=""LDAP://dc=local,dc=corp"" >All OUs"
strHTML=strhtml&"<option value=""LDAP://ou=sub,dc=local,dc=corp"" >This SUB OU Only"

Query or change DHCP settings of all XP workstations in AD

Due to a DHCP failure, a client had to go through and set all their workstations to static IP addresses. This is approximately 75 workstations throughout their environment. This week, I am tasked with fixing their DHCP issues, and resetting all the workstations back to using DHCP.

This broad-stroke VBScript searches for all workstations in an environment, and queries their DHCP settings for all of them. By removing a single comment, the same script can be used to set all the same workstations to use DHCP (which can be dangerous).

Find Those Printers

When decommisioning an older server in the environment, it is essential that all the former services are moved off it. This includes the existing applications (including databases), file shares and printer shares. Unfortunately there is no easy way to capture who is mapped to each of the pritner shares. Outside simply monitoring printer traffic, or visiting each desktop, Windows (AFIK) has no method of tracking this.

Hence another script. This script queries the active computer for all printers, then exports the 'resource name' (port) and share name to a CSV in a specific location.