Jump to content

Using VBScript for logon scripts rather than BAT files


Recommended Posts

Posted

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

  • Replies 3
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: Using VBScript for logon scripts rather than BAT files

 

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!).

> 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

>

>

Guest Thom Paine
Posted

Re: Using VBScript for logon scripts rather than BAT files

 

> 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

Posted

Re: Using VBScript for logon scripts rather than BAT files

 

I have all my logon scripts in vbscript. it makes things very easy, once you

template everything out.

 

-Nex6

 

"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

>

>


×
×
  • Create New...