Counting the number of files in a directory, command line style

by File in: script

I needed to count the number of files in a directory on a Windows 2003 server.  Here’s the command that can easily be scripted: dir/b/a-d c:\directory | find /v /c “::” You can also specify a file share instead of a directory name: dir/b/a-d \\server\share | find /v /c “::” If you want to count the number […]

Script to remotely list Windows local administrator group membership

by File in: script

The following script can be run against remote Windows machines, and will enumerate the contents of the remote server’s local administrators group. It requires Sysinternals PSExec utility, and must be run with administrative credentials.  Set the four paths to the correct locations for your workstation. REM set path to PSexec on machine the script is […]

Script to find and email files in a directory

by File in: script

I needed to write a batch file that would email some files, and could be run as a scheduled task.  I chose to use Blat as my email program, you can download it for free from SourceForge. The batch file requirements were:  1.  Had to email all the .xls files in one directory from the current date. […]

Capturing Virtual Machine Blue Screens via Powershell

by File in: script

Eric Sloof at has a nice post on how to capture screen shots of virtual machine blue screens using Powershell.  You can find the code here. He then incorporated a Powershell script from Carter Shanklin that pushes a screenshot through Microsoft Office Document Imaging Library (MODI), OCR software found in Office 2003+, to extract […]

.cmd script that determines if a directory is empty and sends email notification of status

by File in: script

I have an email archiving application on a Windows 2003 server that requires a lot more manual intervention than I prefer.  As the application moves the mail messages throughout it’s various directory queues, sometimes it experiences an event that causes processing to halt.  This results in a particular directory filling up until an administrator manually […]

Script to backup Groupwise configuration files on Netware Part I

by File in: backup, Groupwise, script

I performed a Groupwise 6.5 to 7.0.3 upgrade this weekend on the domain and post office servers, and wrote a quick script to backup the agent configuration files.  It’s not a pretty script, but I wrote it in about 10 minutes and it worked on all my Netware servers.  I call this script part I […]

Simple script to backup Groupwise 7 configuration files on SLES Linux

by File in: Groupwise, script

I’m about to upgrade our Groupwise infrastructure, and I wanted to write a simple script that would backup and archive important Groupwise configuration files.  I’m not proficient at scripting, but here’s what I came up with.  Please recommend additional files to include if I have overlooked anything. [sourcecode language=’cpp’] #################################### ### Begin ### script to backup […]

Powershell script to change from static to dynamic IP addressing

by File in: script

I’ve been working on validating an email server migration plan which has required utilizing test servers isolated from the production network.  Because they are offnet, I have to frequently switch my laptop from the production to test networks, which involves reconfiguring my network card from dynamic to static IP addresses. I could use Windows XP’s […]

Getting started with Powershell for system administration

by File in: script

SynJunkie has written a nice, detailed post that shows some of the administrative tasks that can be performed with Powershell.  He shows how to perform many different system administration functions, from editing the registry to filtering event logs. If you’ve never used Powershell before, I’d recommend you check it out.  It’s a free download from Microsoft, and is available […]

Script to securely backup and export IIS 6.0 Configuration

by File in: script

Last week I posted a basic script that took advantage of file encryption to securely backup the iis metabase. Today’s script builds upon it by backing up the IIS configuration and exporting it using iiscnfg.vbs. REM delete mapping for H: if it exists net use h: /del REM map H: to remote server share net […]