Jump to content


h4x0r

Completely out of ideas...setting the default printer from TS

Recommended Posts

One of the things we have implemented with our in-place refresh is re-installing printers with a powershell script...yes, I know there are ways to do this with GPO...I'm not going into the details, but suffice to say that GPO printer installs are not an option right now (unfortunately). But here's what I have run into...in my powershell, I'm executing the rundll32 printui.dll command. The script loops through and collects info on the printers which were installed and then choses the appropriate printer from that list to set as default, again using the rundll32 printui command. I have to use the rundll32 method because the prnmngr.vbs requires elevation to install a printer, which I can't get through a TS (at least not easily).

 

If I simply run the script by itself then things work perfectly...all printers install and the default is set at the end. However, when running it from a TS, the only thing which doesn't work is setting the default printer. Since it wasn't working in my PS TS step, I figured I would hard-code it in with a Run Command Line step, passing a TS variable in my PS code. That didn't work either. I even setup a VBScript to set the default printer, but that did not work.

 

I'm out of ideas at this point, and I don't know why it wouldn't be working from a TS other than it might be because it is running under a system context instead of a user? I don't know...I'm just stumped right now, and I'm too close to the project right now to think outside of the box at the moment. Any input would be appreciated. thanks.

Share this post


Link to post
Share on other sites

Well we have a winner...system context will not set the default printer...which makes sense, I guess, being as that is typically a per-user setting. Headed back to google now, but I'll go ahead and ask here as well...

 

So how would I run a script in a TS under the user context?

Share this post


Link to post
Share on other sites

Well we have a winner...system context will not set the default printer...which makes sense, I guess, being as that is typically a per-user setting. Headed back to google now, but I'll go ahead and ask here as well...

 

So how would I run a script in a TS under the user context?

Share this post


Link to post
Share on other sites

Ok, one more step closer to getting this straightened out.

 

If i add a run command line step (rundll32 printui...) to set the default printer in my TS and in the options set it to run as myself--which is the current logged in user--then it will work. However, it has issues if I use a service account, and I suspect that it is because the user is not logged in/the profile is not loaded to make the change.

 

I'm going to create a package with the rundll32 printui... command as a program, and set it to run under the current logged in user and see if that has any success.

Share this post


Link to post
Share on other sites

Well.. to be honest, you won't be able to do that for a user. Only for the user running the command, which doesn;t help you. Another thing you could do is to run it as the SYSTEM, which would cause every user to get it.

 

For an example, see: http://social.technet.microsoft.com/Forums/systemcenter/en-US/18f8f363-8d8d-4508-8a19-19ab739ae343/age-old-question-installing-printers-via-sccm

Share this post


Link to post
Share on other sites

I saw that post, but installing the printers isn't the issue (installing the printers has been the only part of this which is working as it should right now)...the problem comes when trying to set the default printer. If I can set the default printer after the install, the setting seems to stick for other users who logon afterwards...but as of right now, I can't find a method to set the default printer through a TS

Share this post


Link to post
Share on other sites

So far my testing and searches haven't turned anything up...I think I'm going to look at registry modification though. There are a couple settings which modifying doesn't require a restart, and may have the desired effect. but that could also have some very unpredictable results. :unsure:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.