logon scripts connecting printers

A

Apparition

I am very new to scripting.

I am trying to use a logon script to connect users to
printer shares each time they log on. I have written
a .vbs script which works fine when I run it manually,
but I can't get it to work as a per user logon script,
nothing happens when I try.

The only success I have had is when I applied the logon
script to a group policy in active directory. It worked
fine then, but I don't want to do this in this case, I
want to apply the script to the individual user's user
account through the 'Profile' tab.

I know that my path is correct, and there doesn't seem to
be anything wrong with my script, does anyone know why
this might be happening? Does the script need to be in a
particular folder for it work or something?

Thanks,
 
R

Roland Hall

:
: The only success I have had is when I applied the logon
: script to a group policy in active directory. It worked
: fine then, but I don't want to do this in this case, I
: want to apply the script to the individual user's user
: account through the 'Profile' tab.
:
: I know that my path is correct, and there doesn't seem to
: be anything wrong with my script, does anyone know why
: this might be happening? Does the script need to be in a
: particular folder for it work or something?

%systemroot%\sysvol\<DNS domain name>\scripts

This is what is specified in the Help file re: the profile logon script
input box.
This is not what I found to be correct on my server.

I found two directories:
%systemroot%\sysvol\sysvol\<DNS domain name>\scripts
%systemroot%\sysvol\domain\scripts

on the 2nd, domain is actually the word domain

So, possibly one of those unless someone wants to add more info here.

--
Roland

This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose.
-Technet Knowledge Base-
http://support.microsoft.com/default.aspx?scid=fh;EN-US;kbhowto&sd=TECH&ln=EN-US&FR=0
-Technet Script Center-
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
-WSH 5.6 documentation download-
http://www.microsoft.com/downloads/...48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
-MSDN Library-
http://msdn.microsoft.com/library/default.asp
 
Z

ZippyDaPinHead

Lookup articles Q189105 & Q263226 for some examples of
using the printui.dll in scripts.
I would create a login script that all users run and use
case statements to control who gets what printer.
Run: "rundll32 printui.dll,PrintUIEntry /?" at the
command prompt for examples and info.
Q263226 even has a case statement to add printers by user.


FREE CODE:(Dialog box to add printer to all profiles on PC)

Set WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
Set colAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration
Where IPEnabled = True")
For Each objAdapter in colAdapters
machineName = objAdapter.DNSHostName
Next

printer = InputBox("Enter the Server Name and Printer
(Server\Printer)","Add Printer")
manip = Split(printer,"\")
For i = LBound(manip) to UBound(manip)
If manip(i) <> "" then
output = output & "\" & manip(i)
End If
Next
printer = UCase(output)

runit=WshShell.Run ("rundll32
printui.dll,PrintUIEntry /ga /c\\" & machineName & " /n\"
& printer)
WshShell.Popup "Printer will be added when you log off and
back on.",0,"Add Printer"

Good Luck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top