Link to home
Create AccountLog in
Avatar of Pkafkas
Pkafkas

asked on

How to set the default printer with a batch file in a roaming profile?

Hello:

We have a Windows AD network at my work.  We have local profiles for PC's and laptops; but we use roaming profile when users logon to Citrix Farm.  The roaming profiles are created in the Remote Desktop Services profile tab, in Active Directory.  The Citrix Farm Servers are Windows 2008 R2 Sp1.

One user is having a problem with his default printer continuously changing on him.  I think that his local printer is for some reason not keeping the normal default printer and it randomly puts another printer as the default.  Then the said users logas on via Remote Desktop and his remote desktop default printer is this other printer.

I am thinking of creating a batch file on the user's laptop (startup folder) to select the desired printer to always be his default.

put in the c:\ProgramData\Microsoft\Windows\Start Menu\programs\Startup, on the user's Windows 7 laptop.

REM Set printer as default
rundll32 printui.dll,PrintUIEntry /y /n\\Printer_Server_Name\Printer_Share_Name


But is there a way to force the default printer to be set after the user logs on to the Citrix Server?  Can I put the same batch file on the Citrix Server's local profile settings, for this user?  Perhaps put a delay of 10 seconds in order to wait for all of the printers to load first and then execute the batch file?
Avatar of Pkafkas
Pkafkas

ASKER

Could it be in:  C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs - folder

How can I put a delay in the batch file?

Should I use a sleep command?  http://www.robvanderwoude.com/wait.php  //sleep does not seem to work.  Any other commands that can pause the execution of the batch file?

sleep 20
rundll32 printui.dll,PrintUIEntry /y /n\\COMPUTER\PRINTER
ASKER CERTIFIED SOLUTION
Avatar of Pkafkas
Pkafkas

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Pkafkas

ASKER

No one replied and I figured this out myself.