Hi All

Within my Master Login Script I set local printer as default if found, but for some reason it is not working when loggin on, works fine if I run script after I logon,

Looks like Windows will set the default printer if one is not set after a ammount of idle time, the question is can you set a local printer to be default ???

Here is the code:

Code:

$strComputer = "."
$objWMIService = GetObject("winmgmts:\\" + $strComputer + "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_Printer",,48)

? 'Local Printer List'
$x = 0
For Each $objItem in $colItems
? 'Printer Number: '+$x
? 'Printer PortName: '+$objItem.PortName

If $objItem.PortName = "LPT1:"
SetDefaultPrinter ($ObjItem.Name)
? 'Error: '+@ERROR
$DefaultPtr = "Set"
EndIf
$x = $x + 1
Next