Dark Developments Where Knowledge Meets Power

9Aug/110

VBS – Add Favorite IE

Posted by Dark#Basics

Simple VB-script that adds the specified URL to the favorite list, can be used in combination with logon-scripts, Group Policies,...

Select All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
REM Add Favorite in Internet Explorer
 
Const ADMINISTRATIVE_TOOLS = 6
 
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(ADMINISTRATIVE_TOOLS)
Set objFolderItem = objFolder.Self
 
Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFld = objFolderItem.Path
Set objURLShortcut = objShell.CreateShortcut(strDesktopFld & "\Dark Developments.url")
objURLShortcut.TargetPath = "http://www.darkdevelopments.org"
objURLShortcut.Save
4Jul/110

VBS – Adding Printers

Posted by Dark#Basics

Because the forums are still down I'll use the blog to give some information to the public.

Today I had some issues regarding printers. Because all of our printers are spread over 4 servers and I want to be able to distribute 64 & 32bit drivers I've setup a 2008R2 server. But then I needed to add a whole batch of printers. This is the way I did it, using some VBS-scripts that are available in R2 and some basic copy/pasting to a batch file.

Step 1 : use prnport.vbs to define the port.
Step 2 : use prndrvr to add the driver(s).
Step 3 :  use prnmngr so that port and driver is connected/used with the correct printer and give it a generic name for example TYPE_COMPANYDEPARTMENT
Step 4 : use prncnfg to define additional parameters (shared, published, sharename,...)

Select All Code:
1
2
3
4
5
6
7
8
'Add Port - http://technet.microsoft.com/en-us/library/bb490975.aspx 
prnport.vbs -a -r IP_10.0.10.5 -h 10.0.10.5 -o raw -n 9100
'Add Driver - http://technet.microsoft.com/en-us/library/bb490972.aspx 
prndrvr -a "Canon iR 3025 PCL 6" -h C:\Drivers\Canon\IR3025\X64\ -i IN40VCB.inf
'Define Printer & Driver - http://technet.microsoft.com/en-us/library/bb490974.aspx 
prnmngr.vbs -a -p "CANONiR3025_DEPXYZ" -m "Canon iR 3025 PCL 6" -r IP_10.0.10.5
'Set Properties (Sharename, Location, Shared, Published) - http://technet.microsoft.com/en-us/library/bb490971.aspx 
prncnfg.vbs -t -p "CANONiR3025_DEPXYZ" -h "Canon Invoice Printer DEP XYZ" -l "1FLOOR DEPXYZ" +shared +published