Home All Groups Group Topic Archive Search About

Using VBScript for logon scripts rather than BAT files



Author
24 Nov 2007 2:44 PM
Laphan
Hi All

It seems to be that using VBscript files are better (more reliable??) than
BAT files when it comes to adding/removing/setting default printers - is
this the case?

Due to the blessed HP2600N printer I've had to install this printer manually
on each PC rather than pushing it via GPO logon scripts, but when the other
printers get pushed through to each user account via GPO they take the
default printer status away from my locally installed HP2600N printers -
there anyway I can correct this in a BAT file or do I have to go the VB
script route?

It's just that I don't know how to do certain things like move files about
and map drives in VBScript so it would be nice if there was a simple command
in the BAT file configs that would allow me to set my chosen local printer
as the default.

Thanks

Laphan

Author
24 Nov 2007 3:55 PM
Pegasus (MVP)
See below.

"Laphan" <admin@DontSpam.com> wrote in message
news:%23YsYIiqLIHA.280@TK2MSFTNGP03.phx.gbl...
> Hi All
>
> It seems to be that using VBscript files are better (more reliable??) than
> BAT files when it comes to adding/removing/setting default printers - is
> this the case?

*** No, the quality of the script depends on its author, not
*** on the language.

> Due to the blessed HP2600N printer I've had to install this printer
> manually
> on each PC rather than pushing it via GPO logon scripts, but when the
> other
> printers get pushed through to each user account via GPO they take the
> default printer status away from my locally installed HP2600N printers -
> there anyway I can correct this in a BAT file or do I have to go the VB
> script route?

*** You can do it either way. In a batch file the command would be
*** rundll32 printui.dll,PrintUIEntry /y /n \\<server>\<printername>
*** In a script file it is a little more involved (and far more versatile!).

Show quote
> It's just that I don't know how to do certain things like move files about
> and map drives in VBScript so it would be nice if there was a simple
> command
> in the BAT file configs that would allow me to set my chosen local printer
> as the default.
>
> Thanks
>
> Laphan
>
>
Author
26 Nov 2007 4:01 AM
Thom Paine
> It's just that I don't know how to do certain things like move files about
> and map drives in VBScript so it would be nice if there was a simple
> command
> in the BAT file configs that would allow me to set my chosen local printer
> as the default.


I do this all the time. I set the mappings with the batch file, and then the
last line is to call a vb script file to load printers.

I'm slowly working up to tricks like setting a default printer based on the
computer they are logging on to, but for now I have different groups call a
different script for the printer.

Here is an example of mine.

logon.bat
REM
net use n: \\pdc-scps-2006\distributor
net use i: \\pdc-scps-2006\schedule
net use s: \\pdc-scps-2006\shared
net use t: \\pdc-scps-2006\forms
net use u: \\pdc-scps-2006\policies
net use q: \\pdc-scps-2006\court
call \\pdc-scps-2006\netlogon\logon.vbs


logon.vbs
ON ERROR RESUME NEXT
Dim net
set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\pdc-scps-2006\dispatch"
net.AddWindowsPrinterConnection "\\pdc-scps-2006\1720disp"
net.AddWindowsPrinterConnection "\\pdc-scps-2006\admincolour"
net.SetDefaultPrinter "\\pdc-scps-2006\dispatch"

If you leave the last line off, the set default printer, I think the default
printer of the local pc one will stay, but YMMV.

-=/>Thom
Author
28 Nov 2007 5:14 PM
Nex6
I have all my logon scripts in vbscript. it makes things very easy, once you
template everything out.

-Nex6

Show quote
"Laphan" <admin@DontSpam.com> wrote in message
news:%23YsYIiqLIHA.280@TK2MSFTNGP03.phx.gbl...
> Hi All
>
> It seems to be that using VBscript files are better (more reliable??) than
> BAT files when it comes to adding/removing/setting default printers - is
> this the case?
>
> Due to the blessed HP2600N printer I've had to install this printer
> manually
> on each PC rather than pushing it via GPO logon scripts, but when the
> other
> printers get pushed through to each user account via GPO they take the
> default printer status away from my locally installed HP2600N printers -
> there anyway I can correct this in a BAT file or do I have to go the VB
> script route?
>
> It's just that I don't know how to do certain things like move files about
> and map drives in VBScript so it would be nice if there was a simple
> command
> in the BAT file configs that would allow me to set my chosen local printer
> as the default.
>
> Thanks
>
> Laphan
>
>

AddThis Social Bookmark Button