Friday, May 18, 2012

Create Network Printers at Logon With vbs and Batch File

Create Network Printers at Logon With vbs and Batch File

The following vbs script can be run from a batch file like a logon.bat file that you may already have in your NETLOGON folder. Or simply create a new one. Be sure to add the logon.bat to your users' account  profiles in AD.  You'll need to get the fmember exe from Microsoft, or you may already have it.

Set WshNetwork = CreateObject("WScript.Network")

Set objShell = CreateObject("Wscript.Shell")

WSHNetwork.MapNetworkDrive "N:", \\DC01\Netlogon

WshNetwork.RemovePrinterConnection \\PrintServer01\Printer1
WshNetwork.RemovePrinterConnection \\PrintServer01\Printer2

strCommand = "%comspec% /c N:\IfMember.exe FirstFloor"
intReturn = objShell.Run(strCommand, 2, True)
If intReturn = 1 Then

WshNetwork.AddWindowsPrinterConnection \\PrintServer01\Printer1
WshNetwork.SetDefaultPrinter \\PrintServer01\Printer1

End If

strCommand = "%comspec% /c N:\IfMember.exe SecondFloor"
intReturn = objShell.Run(strCommand, 2, True)
If intReturn = 1 Then

WshNetwork.AddWindowsPrinterConnection \\PrintServer01\Printer2
WshNetwork.SetDefaultPrinter \\PrintServer01\Printer2

End If

WshNetwork.RemoveNetworkDrive "N:"

The above logon vbs script works great but you may encounter and issue with Windows 7 computers.

For Windows 7 use the following in a batch file:

@echo off

rundll32 printui.dll,PrintUIEntry /q /ga /n \\dc01\Printer-duplex


The above will add a printer at the machine level quietly - No user messages. If run without the quiet switch, the user will will see a message indicating the printer already exists upon logon. The first user will not see the message of course when the entry is first added to the logon script. I used a .cmd file.

 PRINTUI.EXE can be used instead of  RUNDLL32 PRINTUI.DLL,PrintUIEntry  on Windows 7 but then you'll have to add some conditional code to determine if the user is loging in from a windows 7 computer or not.

Create Network Printers with a Logon script batch (.bat) file or cmd file

RUNDLL32 PRINTUI.DLL command line options / switches


RUNDLL32 PRINTUI.DLL,PrintUIEntry [ options ] [ @commandfile ]/a[file] binary file name

/b[name] base printer name

/c[name] unc machine name if the action is on a remote machine

/dl delete local printer

/dn delete network printer connection

/dd delete printer driver

/e display printing preferences

/f[file] either inf file or output file

/ga add per machine printer connections

/ge enum per machine printer connections

/gd delete per machine printer connections

/h[arch] driver architecture, one of the following:


/ia install printer driver using inf file

/id install printer driver using add printer driver wizard

/if install printer using inf file

/ii install printer using add printer wizard with an inf file

/il install printer using add printer wizard

/in add network printer connection

/j[provider] print provider name

/k print test page to specified printer, cannot be combined with command when installing a printer

/l[path] printer driver source path

/m[model] printer driver model name

/n[name] printer name

/o display printer queue view

/p display printer properties

/q quiet mode, do not display error messages

/r[port] port name

/s display server properties

/Ss Store printer settings into a file

/Sr Restore printer settings from a file

Store or restore printer settings option flags that must be placed at the end of command:



c Color Profile

d PrinterData

s Security descriptor

g Global DevMode

m Minimal settings

u User DevMode

r Resolve name conflicts

f Force name

p Resolve port

/u use the existing printer driver if it's already installed

/t[#] zero based index page to start on

/v[version] driver version, one of the following:

Windows 95 or 98
Windows NT 3.1
Windows NT 3.5 or 3.51
Windows NT 3.51
Windows NT 4.0
Windows NT 4.0 or 2000
Windows 2000

/w prompt the user for a driver if specified driver is not found in the inf

/y set printer as the default

/Xg get printer settings

/Xs set printer settings

/z do not auto share this printer

/Z share this printer, can only be used with the /if option

/? help this message

@[file] command line argument file


Tuesday, January 24, 2012

Basic Differences Between CAT5, CAT5E, CAT6, CAT6e, CAT6a Cables

  RJ45 Pin-out for Network Connection 

Basic Difference Between CAT5,CAT6,CAT6e and CAT6a Cables
Category 5
Category 5 cabling transmits at a frequency of 100MHz. This provides a rated line speed of up to 100Mbit/s and a cable segment length of 100 meters maximum. Most Category 5 cables, were designed for earlier networks replacing cat 3, only used two twisted pairs of wires. However, older Category 5 cabling continues to make up the majority of the world’s network cabling infrastructure.

Category 5e
Category 5e was later introduced as an improved specification to the very popular Category 5 that replaced Cat 3.  The improvement was in noise reduction. By reducing the noise and signal interference beyond Cat 5, Category 5e rated transfer speeds increased to 350 Mbit/s over 100 meters. The new 5e cabling standard however also required all the cabling to include four twisted pairs not just two like with Cat 5. All eight contacts has to be used. Cat 5e introduced and optimized encoding scheme that allows up to 50-meter lengths of Category 5e cable to provide at or near Gigabit Ethernet (1000BASE-T) speeds. This was during the era of the early stages of Gigabit

Category 6
Gigabit Ethernet (1000BASE-T) became mainstream and required new industry-standard cables capable of transmitting at a higher frequencies than Cat 5e to go beyond the 50 meter limitation. Cat 6e transmits at 250 MHz. The new Category 6 cable uses thicker-gauge wire to attain the higher frequencies, it has increased shielding, and more pair twists per inch to reduce signal noise and interference. The new tighter specifications introduced with Cat 6 cabling guarantee that 100-meter runs of Category 6 are capable of 1000 Mbit/s transfer speeds. As with 5e reducing the cable length can achieve higher speeds than the category types design goal so 10-Gigabit Ethernet speeds can be achieved  when reducing cable lengths to less than 50 meters.

Category 6e
The limitation of 50 meters of 10Gugabit was over come with Category 6 Enhanced (6e).  Cat 6e is an augmented specification designed to double transmission frequency of Cat 6 to 500 MHz. It has the more pair twists per inch as does Cat 6 but it's also wrapping Category 6 in grounded foil shielding, a full 10-Gigabit Ethernet speeds can be achieved without sacrificing the max cable length of 100 meters.

Category 6a
Category 6a (or Augmented Category 6) is defined at frequencies up to 500 MHz—twice that of Cat. 6 but he same as 6e. Because it is shielded, Cat 6a performs at improved specifications over 6 and 6e, in particular in the area of alien cross-talk when compared to Cat 6 UTP   Cat 6 UTP exhibited high alien noise in high frequencies.6A. To reduce the noise, 6a EA specification (not EIA/TIA) require a new generation of connecting hardware that offers far superior performance. 6A connectors performs 3 dB better than a Cat 6a connector that conforms with the EIA/TIA specification. 3 dB equates to 100% increase of near-end cross-talk noise reduction. 

More wire specifications and a practical case example use of 10GB is available at this additional location - Differences Between Category 5 and Category 6 . The use of special case cables such as cross-over cables is also covered at the same article location.

Wednesday, January 18, 2012

Exchange Management Shell Create New User with Exchange 2010 Shell

Exchange Management Shell Create New User with Exchange 2010 Shell


New-Mailbox -Name 'new user' -Alias 'nuser' -UserPrincipalName '' -SamAccountName 'nuser' -FirstName 'new' -Initials '' -LastName 'user' -Password 'System.Security.SecureString' -ResetPasswordOnNextLogon $false

I used this just today and it worked very nicely. I suspect the command can be oput into a script or batch file to create many accounts without the need for exchange 2010 Managment console.