BACKGROUND: I had this same issue when deploying new printers quick. Since our company doesn't utilize a login script for this yet, I figured doing simple VB script much like what Bill posted would do the trick. WRONG. Again, I execute manually on the machine and it works great, but always fails in DS. I came to the conclusion that it's not working under the specific user that's logged in. What's more is, if the PC is logged off, it still won't work using this type of script. Yes, I've tried the 'Run script in console user session' too and that doesn't work.
MY SOLUTION: I actually use two simple VB scripts. The first script is the one that I push with DS to my clients. I can push this whether or not the client is logged on or off. It adds 2 entries to the Active Setup registry path. One entry references the original script, which is in a network location accessible by all, and the other entry I use as a versioning marker with just the date.
For those of you who don't know what Active Setup does, it will run anything you wish for that particular user, under the elevated NTAUTHORITY/System account which gives that user the permissions required to 'install'. I can't post URLs for some dumb reason, but do a google search for 'Active Setup'. There's a great explanation on AppDeploy's site.
CONS: The only con about doing it this way that I don't like is that if the user is logged on, they must logoff and then back on to get the printers.
PROS: However, the good thing is that you can install this now from a logged off PC, AND this setting will take effect for all other users that login.
Here is one of the scripts I send out through DS, that adds the Active Setup reg setting:
Code:
'Add Canon7000 Printer - User must logoff and logon for printer to add
Set WshShell = WScript.CreateObject("WScript.Shell")
'**********************Add Canon7000 to Active Setup******************************
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\Canon7000\StubPath","\\Server\filelocation\Canon7000.vbs","REG_SZ"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\Canon7000\Version","04.08.09","REG_SZ"
Make sure that on the following line, you change the name for each different application you wish to install via Active Setup...
EXAMPLE:
Currently I have this for the Canon7000 Printer:
"HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\
Canon7000\StubPath"
If I wanted to install say an HP4300 Printer I'd change it to this:
"HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\
HP4300\StubPath"
This is essential for Active Setup to work.. Each application or install needs to be in a unique reg key.
My Canon7000.vbs code looks like this:
Code:
'Add Canon 7000 Printer
On Error Resume Next
sPrinterPath = "\\printsvr1\Canon_7000"
Set wshNetwork = WScript.CreateObject("WScript.Network")
WSHNetwork.AddWindowsPrinterConnection sPrinterPath
Sorry for the long post, but hope this helps everyone!