PowerShell Ping Test

Posted by gygon on Wednesday, November 16th, 2011

Used this little script the other day for a basic network test to an access point I was testing. It just pings the device every 10 seconds (or whatever you set it at) and only outputs when there is an error and the time it occurred. Made for an easy way to leave this running over […]

continue reading

Using PowerShell to monitor a web server

Posted by gygon on Monday, November 14th, 2011

A couple years ago I posted about a PowerShell script that would read in a web page. I used that to setup a basic web site test to go through a list of web sites/servers and make sure they were up and running and email an alert if they were down or the size of […]

continue reading

Monitoring the Event Log with PowerShell

Posted by gygon on Saturday, March 21st, 2009

One of my goals with learning more about PowerShell is to be able to monitor the event logs on servers and notify me via email when certain events happen. The system I’m looking to monitor are not part of a domain, are in remote locations on isolated networks. Some of the main things I’m looking […]

continue reading

Map Printer and Set to Default in Batch File

Posted by gygon on Wednesday, December 8th, 2010

While setting up a new thin client system (HP t5740e) to test with I wanted to make things as easy on myself as possible when it came to the printers. I know we go through printers and have to change them out as they die…I didn’t want to have to log in to each system and change the printer settings and then save the updated image….especially if it happens during a busy time. So I went with what I think is a good solution to update the printers easily…map them and set the default through a batch file that is stored on the server.

The thin clients are currently running Windows Embedded Starndard 2009 (aka Embedded XP) and once we finish testing I plan to upgrade them to Windows 7 Embedded to compare. Here’s the batch file that is on the server that is run to map the printer, the original was found at

@echo off
REM Add printer
echo If Prompted, enter the following login information...
echo  - Username: demo
echo  - Password: DemoPass
echo Installing [HP2015] on []!
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\\HP2015
echo Your default printer is [HP2015] on []
REM Set Default Printer 
RunDll32.EXE printui.dll,PrintUIEntry /y /n \\\HP2015

Just to note, lines 3-5 are there for the systems that are not on a domain and are just connecting to another computer on the same workgroup. To make testing easier I just have the user enter the credentials.

Posted in: Tips, Windows.

2 Responses to “Map Printer and Set to Default in Batch File”

  1. Aaron Says:

    I am trying to create a batch file to map a HP printer (HP LaserJet M425dn)to a group of PCs. I have a question about lines 6-8 and 10. I am obviously supposed to replace the HP2015 with the printer name I have, but the IP address is supposed to be the printer’s IP address?
    I have tried the batch a few different ways but each time it says Connecting to the printer and then an IRQ shows and says I need to Connect to Printer. “Windows couldn’t connect to the printer. Check the printer name and try again.”
    All I changed from the script you posted was the printer name and the ip address the printer was assigned with. The printer is on a network and all of the computers are connected to a domain. E-mail me if you have any questions. Thanks in advance for your help.

  2. gygon Says:

    The script here is for mapping to a shared printer on another computer…if you’re trying to use a network printer I’d suggest just installing the drivers on the system to connect directly to the printer. If you need to make sure it’s set as the default after than, you can use this