Hi All,

Was doing a search for getting the default Printer of the logged on PC, but I couldn't find much.

Here is a quick script that may help someone.

Thanks

Code:

? GetDefaultPrinter

Function GetDefaultPrinter()
$oShell = CreateObject("WScript.Shell")
$sRegVal = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
$sDefault = ""
$sDefault = $oShell.RegRead($sRegVal)
$sDefault = Left($sDefault ,InStr($sDefault, ",") - 1)
$GetDefaultPrinter = $sDefault
EndFunction



Edited by Richie19Rich77 (2004-11-10 05:15 PM)