Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ad script default printers

Status
Not open for further replies.

3rdJoey

MIS
Mar 28, 2007
22
US
Is it possible to set a default printer based on username using ad scripts? If so can anyone help me with the corret format.

Thanks
 
Something like this may give you a start, but you'll undoubtedly be better off looking in the VBScript forum at
Code:
Option Explicit

Dim strComputer
Dim strUserName
Dim strDefaultPrinter
Dim objWMIService
Dim objNetwork

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & _
  "{impersonationLevel=impersonate}!\\" & _
  strComputer & "\root\cimv2")
Set objNetwork = CreateObject("Wscript.Network")

strUserName = objNetwork.UserName
strDefaultPrinter = "\\ServerName\PrinterName"

If lcase(strUserName) = "johnd" Then
  WScript.Echo "set default printer"
  'objNetwork.SetDefaultPrinter strDefaultPrinter
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top