Reply to Message

View discussion in a popup

Replying to:
cH1LL1
Enthusiast
Enthusiast

Use Client Side Preferences:

Group Policy:

User Configuration:>Preferences>Control Panel Settings>Printers> Shared Printer>

Set the printer as a default Printer> True

Only if a local printer is not present: True/False

You can also item level target this to a security group of users or a OU where your users are based./

Departmental/ Office etc.

there is another way...if you dont want to use Client Side preferences

Essentially you are going to create a script to write your currently saved  default printer to a network drive upon logoff.

then upon logon you will create a scheduled task to copy that default printer info from text file back in to the registry.

this is an exact copy of the script we are using to do this today across 650 vms

Save Printer script:

Dim objFSO 'As FileSystemObject

Dim objTextFile 'As Object

Set oShell = CreateObject("WScript.Shell")

strValue = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"

strPrinter = oShell.RegRead(strValue)

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.CreateTextFile("p:\defaultPrinter.txt", True)

objTextFile.Write (strPrinter)

objTextFile.Close

Restore Printer Script:

On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile("p:\defaultprinter.txt", 1)

If Err.Number <> 0 Then

  wscript.echo("Quiting")

  WScript.Quit

End If

Dim arrFileLines()

strPrinter = objFile.ReadLine

objFile.Close

Set oShell = CreateObject("WScript.Shell")

strKey = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"

oShell.RegWrite strKey, strPrinter, "REG_SZ"

Reply
0 Kudos