Category - Batch

July 15, 2007

Use tinyget to determine your external IP address

Here's what we're trying to do: I wanted to send myself a periodic e.mail to @gmail.com with my external IP address, both to keep a log of IP's used, and to recover in case my dynamic DNS registration fails for some reason. And of course, Google's nearly unlimited MB MORE...

June 6, 2007

Update EasyDNS with tinyget.exe

I've used or tried several dynamic IP clients in the past with various results. One windows shareware utility worked fine, but randomly decided to use 100% of the CPU until manually reset. Probably the best so far was Ez-ipupdate for *Nix systems, it's a freeware/open source utility and really MORE...

May 9, 2007

Sample Script - remote shutdown or hibernation of a Windows system

See this post for how to wake up your server remotely. This is the second part of my decidedly-not-rocket-science script to remotely shutdown / hibernate a Windows home fileserver. It will should work on anything Win2k or newer, including XP.Requirements: 1. The excellent freeware application BeyondExec v2 from BeyondLogic.2. MORE...

Sample Script - WOL or Wake On Lan

In order to save power and keep my garage from overheating, I turn off my home file server when not in use. I used to manually run out to adjust the Big Red Switch, but then I decided to get lazy and script the WOL process... and use hibernate MORE...

March 12, 2007

Fun with Logparser.exe and EventID 1221

Here's a simple query against the Application log on a remote Exchange server through logparser.exe to grab 2 days worth of EventID 1221 (summary of online after-hours maintenance). I've added this to my daily Exchange server status script. Note per MS that you should do an offline defrag (eseutil MORE...

February 16, 2007

Batch Script - Dump workstations from AD and check a file version

We recently identified a bug in a widely deployed application and needed to get a count of how many installs mights be subject to issues. Normally I would just walk over to the SMS console and run a report, but sadly our SMS remains less-than-completely-deployed at the moment, and MORE...

January 24, 2007

Scripting moving objects in AD

During an Exchange migration I needed a script to move 200 users into an OU indicating they were migrated. Since the source OU's for these users is all over the place, I took to placing a custom attribute and doing an ADUC saved query (LDAP) search to find them, MORE...

January 2, 2007

Custom ADUC query - Find a specific SMTP address in AD

Using a custom saved query in AD to find a specific SMTP address. This is helpful if you're having trouble finding the source of a conflicting SMTP address. Limit search to users / contacts:(&(objectCategory=user)(mail=address@mydomain.tld))Wider search by SMTP address:(&(proxyAddresses=smtp:address@mydomain.tld)) You can go further and query all users in a certain MORE...

2 different methods of MS Terminal Service Remote Admin

Here's an easy way to connect to the remote console of a TS server... useful if you get "The terminal server has exceeded the maximum number of allowed connections." error message. mstsc /v:10.10.0.1 /console Where 10.10.0.1 is the IP address of the server in question. You'll have to boot MORE...

November 15, 2006

Batch - add a carriage return with texttools32

Here's a simple way to replace one line of ext with two using Texttools32 from firefly software. Example - Before blah=true Name=robot-0001 blahblah=true Example - After blah=true Name=robot-0001 Mode=1 blahblah=true Command type inifile.ini | t repl 'Name=robot-001' 'Name=robot-0001#0d#0aMode=1' So by adding #0d#0a or a line feed, we can add an MORE...

September 18, 2006

Sample Script - Windows MSCS Cluster monitor

What it does... Monitors the status of the cluster service and any clustered applications. It will alert if any resources are pending, or if your preferred node isn't active for a particular service. Why? After setting up my first fibre attached Windows MSCS file server cluster I decided to write MORE...

September 5, 2006

Sample Script - Network Appliance SnapKicker

If you have Exchange databases on Network Appliance storage, and use SnapManager for Exchange keep reading... otherwise hit the back button on your browser now... Still there? OK. If you run a SnapMirror from your front end filer to a (hopefully off site) R200 NearStore every 3 hours a MORE...

August 30, 2006

Sample Script - Check web server from a batch script

OK, just to prove you can do anything with a command line batch script... how about verifying your web server is up...? Why use an application when you can script it? :-) Thanks to the IIS 6.0 Resource Kit tool TinyGet.exe, you can do amazing things from the command line. MORE...

August 29, 2006

Sample Script - Network Appliance snapshot monitor

As part of a HA Exchange 2003 rollout using iSCSI on Network Appliance filers, I needed a utility to monitor that our snapshots were running every few hours without issues. I couldn't find anything, so I wrote a script to do it. Here's a little background: We're running Exchange 2003 MORE...

August 24, 2006

Useful Zantaz EAS SQL Queries

About a year ago I rolled out Zantaz EAS (Exchange Archive Solution) to 3000 users. We were the first large production rollout onto NetApp filers for Zantaz, and after a bunch of tweaking we got it up running. (Zantaz says you can run the Indexer and Archiver over CIFS, but MORE...

August 21, 2006

Sample Script - Convert a text file to a system variable

When running a batch script there are times when you want to take the output of a utility and/or file and convert it to a system variable. Batch was not designed for this, but there's an easy way to do it.... In this example, we'll take a line of output MORE...

August 16, 2006

Sample Script - Custom Attribute yields easier LDAP searching in ADUC

During a recent Exchange 5.5 to 2003 cross site mailbox migration, I needed a simple way to select a large number of users out of AD, right click and say move mailbox. Sounds pretty simple, right? But what if you use multiple levels of OU's in your AD structure, and MORE...

August 15, 2006

Sample Script - Get the Legacy Exchange DN from AD

During a recent Exchange 5.5 to 2003 maibox migration, I needed to have quick and easy access to the Legacy Exchange DN (AKA the Obj-Dist-Name in Exchange 5.5). We use the Zantaz EAS (Exchange Archive System) here, and it binds to MB's in the GAL through this field. The ADUC MORE...

August 9, 2006

Sample Script - Runas MMC

I've just about completed a 2500 user Exchange 5.5 to 2003 migration (you'd be surprised how many laggards are still using Exchange 5.5). One of the challenges was quickly logging into several different AD domains to perform account maintenance. Since Windows 2000 the "run as" feature has greatly simplified this, MORE...

February 1, 2006

ADUC LDAP Queries

Various LDAP queries that can be used against AD in Active DIrectory Users & Computers. Should work in Windows 2000 and Windows 2003 AD, and makes for a very nice "Saved query". Find all non-disabled users with no Exchange Home Server (&(objectCategory=user)(legacyExchangeDN=*)(!msExchHomeServerName=*)(!userAccountControl:1.2.840.113556.1.4.803:=2)) Find all users with "some text" anywhere in MORE...

January 19, 2005

Sample Script: Web Interface to Windows 2000 DNS

ASP based Web Interface to Windows 2000 DNS What does it do? The web interface allows you to add / remove host (A) and reverse (PTR) records in DNS using an ASP based web interface. MORE...

Sample Script: Get today's date

A sample command line batch file to get today's date from the system. I use this mostly to output a log file with today's date (such as the format 2005.1.18.log) from a batch script. If you just want today's date or time, from Windows 2000 or newer call the variable MORE...

Sample Script: Errorlevel checking in batch scripts

A batch command line programming example of how to call a utility or perform a function and react according to the %errorlevel% value returned post execution. In this example we parse a log file for an error string. Download file MORE...

Sample Script: DNS KCC

A sample script for Microsoft Windows 2000 DNS servers. Compares the number of DNS zones on your W2K DNS servers and alerts when they are out of synch. This can be useful in a large distributed environment when you have both primary and secondary DNS servers and multiple regional admins. MORE...

Sample Script: Eventlog monitor for Domain Controllers

A sample script utility to monitor critical events in DC eventlogs and alert by SMTP mail. Download file MORE...