Wednesday, May 23, 2012

Automate HP Switch Config Backup

Below is a VB Script that I wrote that will open a command prompt, telnet into an HP Procurve switch and copy its runnung config to a TFTP server.

In order for this script to work, you will need a text file will the IP addresses of your switches on a seperate line. You will also need to edit the lines that I have maked in RED.

*Note: Do not click off of the command prompt window while this script is running or you are going to get alot of text where you don't want it and you will not get your switch configs.

'--------Start Of Script--------
Option Explicit
On Error Resume Next
Dim WshShell, strIP, strTFTP, strFile, strPassHP
Dim filesys, filetxt

strFile = "File Name"
strTFTP = "Your TFTP Server Address"
strPassHP = "Your HP Procurve Password"

'Opens IP address file for reading
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.OpenTextFile(strFile, ForReading, True)

'Opens the command prompt
set WshShell = CreateObject("WScript.Shell") "cmd.exe"
WScript.Sleep 1000

Do While Not filetxt.AtEndOfStream

strIP = filetxt.ReadLine

set WshShell = Nothing
set filesys = Nothing

Function Copy(strIP)

WshShell.SendKeys "telnet "& strIP
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000 
WshShell.SendKeys "p"
WshShell.SendKeys strPassHP
WshShell.SendKeys ("{Enter}") 
WshShell.SendKeys "copy running-config tftp " & strTFTP & " " & strIP & ".txt" 
WshShell.SendKeys ("{Enter}")
WshShell.SendKeys "^z"
WshShell.SendKeys "^z"
WshShell.SendKeys "y"
WScript.Sleep 2000
WshShell.SendKeys ("{Enter}")
End Function
'--------End Of Script--------

Tuesday, May 22, 2012

Automate Wireless Deployment

Configuring WLAN Settings Backup
This has been tested on XP SP3, Vista SP1 and Windows 7. There is a note for XP SP2 on the site that indicates something needs to be installed.
  1. Download the wlan.exe file
    Command Switches Info: 
  2. Unzip the file into a directory that you can easily type from a command prompt.
  3. Configure your wireless card to the SSID you want to connect to with all the settings you want. (You can configure multiple SSIDs here, but I did 1 at a time, a more individualized controlled approach)
    Run Command (wlan.exe ei)
    With Wireless configured, open a command prompt and got to the directory where you unzipped the wlan.exe file, run this command and this will give you the GUID for the wireless card. Copy the GUID (Only the Hex part) from the command prompt as you will use it for the next steps. The GUID will be unique to each computer. Most computers will have 1 wireless interface detected in the system. If you have more than 1, this may not work as well. 
  5. LIST the Currently Configured Profiles:
    Run Command (wlan.exe gpl {guid of interface})
    This will list the currently configured wireless profiles, the profle name is used for the next part and is case sensitive. 
    Run Command (wlan.exe gp {guid of interface} YourSSID > profile.xml)
    This will capture the configuration of the wireless info and copy into an xml file that will be used for the deploy/restore. You can name the file anything you want. I used the SSID as the name for easier identification. 
  7. EDIT the CONFIG:
    Open the profile.xml file with notepad and remove the first and last lines and then save the file. I named the xml files the name of the SSID for easier identification.
    1st line will be “The return profile xml is: “Last Line will be “Command "gp" completed successfully.” 
  9. Copy the script below and save it as a batch (.bat) file with the SSID of the wireless as the name. This is case sensitive, so save according.

    Example: SSID1.bat

    ******START OF SCRIPT******
    @echo off
    echo Grabbing WLAN Interface...
    For /F "skip=2 tokens=1,2" %%A IN ('wlan.exe ei') Do If "%%A"=="GUID:" set Interface=%%B

    echo Adding wlan SSID %~n0
    wlan.exe sp %Interface% %~n0.xml
    set Interface =

    echo SSID: %~n0 has been configured!

    ******END OF SCRIPT******

    *Note: Don't for get the extra line after the "exit" command.

  10. RUN the SCRIPT
    Now you should have 3 files in your folder: WLAN.exe, profile.xml (or what ever you named the file in step 6), and the matching batch file. When the script runs, it will get its file name and add the wireless network to the computer.

If you want to add multiple wireless networks, create a new batch file and add the follow commands into it:
start /w SSID3.bat
start /w SSID2.bat
start /w SSID1.bat
This will run each of the batch file you created in step 8. Order the SSIDs from least preferred to most preferred. The last SSID will be the one that connects first.

Original Source: 

Friday, May 18, 2012

Install Windows 7 From A Flash Drive

Install Windows 7 From a Flash

This is a short guide on how to install Windows 7 onto a computer from a USB Flash Drive / USB Stick or Portable Hard Drive. Since read speeds are faster from USB drive than your CD-ROM drive, this actually decreases the install time for Windows 7.

Step 1

The first thing you will need to do is format your USB Flash Drive or Portable Hard Drive so that your computer will read it as a bootable drive. So plug your flash drive into a workstation.

Step 2

Open up Command Prompt / CMD (located in Program Files->Accessories) and type the following commands:
  1. DiskPart
  2. List Disk (this will list the disks currently plugged into your computer. Most likely, the C: drive on that computer will be listed as disk 0, and you will have to look down the list to see which disk your flash drive is. Look at the corresponding disk sizes to easily figure it out.)
  3. Select Disk 3 (I am using 3 as example for assigned flash drive)
  4. Clean
  5. Create Partition Primary
  6. Select Partition 1
  7. Active
  8. Format FS=NTFS Quick
  9. Assign (you can assign a particular drive letter if you want, example: assign=E:)
  10. Exit (this will exit DiskPart)
  11. Exit (this will exit CMD)

Step 3

Next you will need to either insert your Windows 7 CD and browse to the CD or open up your Windows 7 ISO and browse to the folders within it. (If you are using ISO, I would suggest extracting the contents to a new folder)

Step 4

Next you will need to spoof your flash stick so that the computer will think it is an install CD. From within the root of the Windows 7 CD or ISO contents, right click while holding shift key and select “Open Command Windows Here”. This will open up a Command Prompt window within that directory. Then input the following commands:
  1. cd Boot
  2. bootsect /nt60 E: (I am using drive letter E: as my flash drive)
  3. exit (exits command prompt)

Step 5

Next simply copy over the entire contents of your windows 7 CD or ISO to your flash drive.

Step 6

Reboot the computer your are wanting to install Windows 7 on with the flash drive plugged in, hit the boot key (normally F12, DEL, or ESC) to select the boot device, boot to your flash drive, and it will go immediately to the Windows 7 Setup screen.

Original Source:

Automate Wireless Key Deployment (Dell)

If you have a Dell laptop with the Dell Wireless WLAN Card Utility and you want copy the wireless profile settings to another laptop (or in my case, 300+ laptops) that the same program, it is as simple as drag and drop.

On the with the wireless profile you want to copy, export the profile to a WPN file. I have posted previously on how to do this.
Next, on the laptop you want to add the wireless profile, copy the WPN file to the C:\Windows\System32 folder then either reboot the computer or restart the Dell Wireless WLAN Service.

You can use a simple batch file to copy WPN file for you when the computer starts up. Or if you have Kaspersky, WPKG, or a similar push program, you can use that also.

I will be posting directions on how to deploy wireless for Windows machines that do not have the Dell Wireless Utility shortly (In the next day or two).

Export Dell Wireless Profile Settings

How To Export Wireless Settings
  1. Open the Dell Wireless WLAN Card Utility and click on the “Wireless Networks” tab.
  2. Click on the down arrow on “Options”, then click on “Export”.
  3. On “Export Options” window, select the option that you want and click OK.
  4. Enter a name and the location that you want to save the export file. Now click Save.

Delete or Reinitialize offline files cache in Windows XP

If you have your user's My Documents redirected to a server and you are running out of space and not sure where it went, check the C:\Windows\CSC folder. This is a hidden folder. The CSC folder is where all the Offline Files are kept on Windows XP/2003. 

To free up space from the Offline files, follow the directions below.

On Windows XP/2003 machines we can delete or reinitialize offline files/CSC cache in any of the following ways.
  1. Open My computer from start menu
  2. Click on Tools
  3. Click on Folder Options
  4. Select Offline Files tab
  5. Press CTRL+Shift and click on Delete Files. 

Original Source:

Monday, May 14, 2012

Make a Bootable WinPE 2.0 USB Flash Drive

Windows Preinstallation Environment (PE) 2.0 is a slimed down version of Windows (hence all the MiniNT references) that used to be the exclusive domain of OEM's providers. Microsoft has wisely chosen to offer this to the masses as part of the Windows AIK. USB keys can be found just about anywhere these days for next to nothing. Combine the capabilities of WinPE with the portability of a USB key and you just made a very powerful troubleshooting, imaging, and data recovery tool. Here is a quick step by step on how to do just that:

Step 1. ) Get USB Key

You probably already have a few and if not you can purchase these just about anywhere, so I won't tell you where to get one. You should get a USB 2.0 device of at least 512mb in size, but if you plan on putting a lot into a custom PE install or plan on using it to transfer data too then you are better served getting a larger size (2.0-4.0GB)

Step 2.) Download and Install the Windows Automated Installation Kit (Windows AIK)

This deployment oriented tool set contains Windows PE 2.0.

Step 3.) Format the USB key

Note: This must be done from Windows Vista or later.

Start a command prompt and run the following. This set of commands assumes your USB key is detected as disk 1, you should double check that by doing a list of the disks before cleaning it. If you have multiple hard drives you could end up wiping your second drive using this command. You have been warned.
  • Diskpart
  • select disk 1
  • clean
  • create partition primary
  • select partition 1
  • active
  • format fs=fat32
  • assign
  • exit
Step 4.) Setup Windows PE
  • In this step you will create and customize WinPE for your disk. From the machine that you installed the Windows AIK go to the start menu and select "Windows PE Tools Command Prompt" from under the Windows AIK program folder.
  • Run Copype.cmd x86 c:\winpe_x86
    • you can create an 64-bit version by changing the architecture from x86 to amd64
  • Add customizations to WinPE
    • copy any tools you want available to the C:\winpe_x86\iso folder such as imaging tools if you want to use this for capturing images (imagex, wimscript.ini)

Step 5 .) Copy Windows PE to USB Key

Insert the USB key into the machine that you have WinPE on and run the following command to copy the contents to the USB Key
xcopy c:\winpe_x86\iso\*.* /s /e /f e:\
change c: to reflect the drive your files on and e: to be your USB key.

There you have it...a quick way to make a handy USB version of WinPE that you can take with you anywhere. These can be used in almost any modern computer that supports USB booting. More information on this and other great things you can do with Windows PE are located in the Windows AIK.

Free Hot Spot App for Android

If you are like me, you probably have an Android phone. If so, you might be in the same boat as I am with the phone service provider wanting to charge you extra money so you can make your phone a mobile hotspot. Who wants to pay for that? This is where FoxFi comes in.

FoxFi was shared with me by a co-worker.

FoxFi is available in Google Play (Market) and it is free. It is simple to use. All you have to do is setup the SSID you want to broadcast, the encryption you want to use, and the password. After you set all of those, just press turn on HotSpot.

Free Applications From SolarWinds

Bulk User Import
TFTP Server
VM Monitor

Software I Use On a Regular Basis

Software I Use On a Regular Basis

CentOS 6.2 NTFS Support

From the terminal, run the command below. This will give you access to NTFS (Windows) formatted drives.

yum install ntfs-3g

*Note: You need to have RPM Forge installed for the above command to work.

Friday, May 11, 2012

Kaspersky KLMover

If you have Kaspersky Anti-Virus in your organization, here are the switches you can use with the klmover.exe to control the Network Agent.

The utility is started via command prompt and has the following switches:

klmover [-logfile LOGFILE] [-address SERVER_ADDRESS] [-pn NON_SSL_PORT] [-ps SSL_PORT] [-nossl] [-cert CERTIFICATE] [-silent] [- dupfix]

-logfile LOGFILE - create a utility run log. By default, the information will be stored in the stdout.tx file; if run without this switch, error messages will be displayed on the screen;

-address SERVER_ADDRESS - new Administration server name. Can contain IP address, NetBIOS or DNS name;

-pn NON_SSL_PORT - indicates to Network agent an Administration server port for establishing a non-secure connection. This switch is optional; the default port is 14000;

-ps SSL_PORT - indicates to Network agent an Administration server port for establishing a secure connection. This switch is optional; the default port is 13000;

-nossl - connect to Administration server using a non-secure connection, Without this switch, Network agent will connect to Administration server using the secure SSL protocol.

-cert CERTIFICATE - new Administration server certificate file path. This switch is optional;

-silent - silent mode.

-dupfix - this switch is obligatory if you installed Network agent by some alternative method (e.g. restore from a system image) instead of using a distribution package.

For example:
klmover -address admsrv -logfile klmover.log

The utility should be run on a problematic host just once. Multiple execution of the utility on a host will result in appearance of duplicate file names in Kaspersky Administration Kit console.

Original Website:

Thursday, May 10, 2012

Dell Computer Tips

Optiplex 740
  • Flashing amber power light - Bad power supply
  • Solid amber power light - Bad motherboard
Latitude D531
  • Flashing caps light at boot - Bad stick of memory

Wednesday, May 9, 2012

Install FOG on CentOS

  1. Log in as root
  2. On the Desktop loads, open a Terminal (command prompt) by clicking on Application > Accessories > Terminal.
  3. At the prompt, type “yum update”. This will update and patch the system (similar to Windows Update).
  4. You will see output similar to the screen below. Type “y” then press enter. Updating the system may take some time, so be patient.
  5. You should see output similar to the screen below.
  6. If you receive a message about importing a GPG key, type “y” and press enter.
  7. You should see output similar to the screen below.
  8. Once the system has finished updating, open a web browser. Applications > Internet > Firefox Web Browser.
  9. Go to and download the latest version of rpmforge for your OS.
    At the time of this writing (May 8th,2012), the current release for 32-bit CentOS is rpmforge-release-0.5.2-2.el5.rf.i386.rpm
  10. Once you click on the appropriate file, a download options window will appear. Make sure Open with Software Installer (default) is selected and click “OK”.
  11. Once the download has finished, the software will start to install. Click “Apply” on the window that appears.
  12. Click “Install anyway” to install the software.
  13. Click “OK”.
  14. Go back to the web browser and go to
  15. On the left hand side of the screen, click Download.
  16. Download the latest version of FOG. The current version is fog_0.32.tar.gz
  17. Save the file to the Root folder
  18. On the Desktop, open root’s Home
  19. Double click on fog_0.32.tar.gz
  20. On the window that opens, click on “Extract”
  21. Under Extract in folder: make sure root is selected. Click “Extract” and then close the window once it has finished.
  22. You should now have a folder label fog_0.32. Open it.
  23. Open the folder labeled lib.
  24. Open the folder labeled redhat.
  25. Double click on the file labeled
  26. Select Display.
  27. You will need to make the following changes:
    • - Line 22: Remove 'php-gettext' and change 'clamav-update' to 'clamav'
    • - Line 63: Edit to read: 'freshDB="/var/clamav/";
    • - Line 66: Edit to read: 'freshcron="/usr/sbin/freshclam"
    • - Change any reference of "php" to "php53"
  28. Save and close the file.
  29. Close all open folders
  30. Open a Terminal and type “cd fog_0.32/bin/” and press enter.
  31. Type “./” and press enter.
  32. Type 1 for Redhat Based Linux, press enter.
  33. Type N for Normal Server installation, press enter.
  34. Type the IP address for your FOG Server, press enter.
  35. Type N to skip entering a router address for a DHCP server, press enter.
  36. Type N to skip entering a DNS address for a DHCP server, press enter.
  37. Type N to changing the default network interface, press enter.
  38. Type N to skip setting up DHCP service, press enter.
  39. Type N to skip installing internationalization support, press enter.
  40. Type Y to install FOG.
  41. Once the install is finished, close all open windows and log off as root.

Tuesday, May 8, 2012

CentOS 5.7 Install Instructions (Hyper-V) For FOG

CentOS 5.7 Install Instructions (Hyper-V)
  1. Download the ISO of CentOS 5.7 to your Hyper-V server.
  2. Create a virtual server. *Remember, this VM is going to have all your computer images on them so plan hard drive size accordingly. I suggest at least 250GB or more.
  3. Before you boot the server, go into the VM settings. Remove the existing Network Adapter and add a Legacy Network Adapter. Adjust other VM settings as needed and then click OK.
  4. Boot the VM.
  5. Press Enter on the keyboard to install CentOS in a Graphical Interface.
  6. Skip the CD/DVD media test.
  7. Click Next or Alt + N if you are using a keyboard.
  8. Select the Language. English is the default. Click Next.
  9. Select the Keyboard Layout. US English is the default. Click Next.
  10. A warning will appear about the hard drive (hda) is unreadable and will be initialized. Click Yes (Alt + Y on keyboard).
  11. Click Next.
  12. Click Yes on the warning to remove all data.
  13. Network Settings. Click on Edit (Alt + E)
  14. Select Manual configuration and enter an IP address for the server. *Note: Prefix is the Subnet Mask. Clear the Check from Enable IPv6. Click OK
  15. Under Hostname, enter the name of the server. I suggest the school initials followed by “-FOG”. Then under Miscellaneous Settings, enter the Gateway and at least the Primary DNS. Click Next
  16. Select the Time Zone. America/New_York is the default.
  17. Enter a password for the root (administrator) user. Click Next.
  18. Select the additional software packages you would like to install. I suggest to not add or remove any additional software. Click Next.
  19. Click Next to begin the installation of the CentOS operating system.
  20. You will see screens similar to this one.
  21. Once the installation is finished, the system will eject the CD/DVD. (If you are installing CentOS on a physical machine, remove the CD/DVD.) Click Reboot.
  22. After the system reboots, some additional additional settings need to be configured. Click Forward (Alt + N on keyboard)
  23. Set the Firewall to Disabled. Click Forward.
  24. Click Yes on the warning that appears.
  25. Set SELinux to Disabled. Click Forward.
  26. Click Yes on the warning that appears.
  27. Set the Date and Time and Click Forward.
  28. Create a user. I suggest the username admin with the same password the root (administrator) user. Click Forward.
  29. Sound Card. Not Needed for a server. Click Forward.
  30. Configuration Complete. Click Finished.

VLAN Setup On HP Procurve Switch and Cisco Router

If you have a network with a Cisco router and HP Procurve switches and you want to setup VLANs, here is how to do it

Setup for this example:
  • HP Procurve 4200 series switch
  • Cisco Router
  • IP Address Range:
  • VLANs: 200, 20, 21, 22, and 23
  • DHCP Server Address: Subnet Mask:

On the HP Procurve 4200 switch, log on to the command line. Enter the configuration mode by typing "config" and type the following commands:

ip routing
ip route

vlan 200
     ip address
     untagged tagged E1

vlan 20
     ip address
     ip helper-address
     tagged A1-A4,B1-B4,C1-C4,D1-D4
vlan 21
     ip address
     ip helper-address
     tagged A1-A4,B1-B4,C1-C4,D1-D4 
vlan 22
     ip address
     ip helper-address
     tagged A1-A4,B1-B4,C1-C4,D1-D4 
vlan 23
     ip address
     ip helper-address
     tagged A1-A4,B1-B4,C1-C4,D1-D4     
 write memory

These commands tell the Procurve switch that you want to use VLANs on switch ports A1 through D4. Switch port E1 is setup for the connection between the 4200 switch and the Cisco router. If you want to create more than 8 VLANs, you will need to run the below commands first in the configuration mode and then reboot the switch.
max-vlans 30
write memory
On the Cisco router, enter privileged mode and then type "config terminal" to enter the configuration mode. Type the commands below.

int f0/0
     ip address
ip route
ip route
ip route
ip route
copy running-config startup-config

You will need an ip route for every VLAN you want to create.

Remember, if you get stuck and need help remembering a command, type "?" and you will get a list of commands that you can run.

MAC Address Convert (Excel)

If you have a list of MAC addresses and you need to add colons to it, open Microsoft Excel and paste the MAC addresses in the first column. In the second column, paste the formula below.


This is very helpful when you are trying to do an import into a program such as FOG.

Password Management

Do you have a note book filled with usernames and passwords? Maybe you have a monitor surrounded with Post-It notes that have passwords written on them?

There is a better and much more secure way of storing usernames and passwords. That better way is using a password safe such as KeePass.

KeePass allows you to store all your usernames and passwords in one secure, encrypted, password protected file. Other KeePass features include storing website addresses for all your usernames and passwords, password expiration date reminders, a password generator, the ability to touch one button and have your username and password entered for you, and many more.

KeePass is 100% free and can be downloaded from

KeePass works on Windows, Linux, and Mac OS X computers. There is even a version of the software for the iPhone and Android smart phones.