From: wuzzle on
Hello, I am using a script to install printers but I get a strange
error message

Set WshNetwork = WScript.CreateObject("WScript.Network")

PrinterPath = "\\server1\sharedName_hp1"

WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath

When the user logs on for the the first time the receive an error
message

Script (points to GPO where script resides)
Line: 6
Char: 3
Error: "There is no printer called "\\server1\sharedNane_hp1"
Code: 800200009
Source: WSHNetwork.SetDefaultPrinter

The print devices seems to install because it shows up in the printer
and fax list on the remote computers.

Thanks ahead of time
From: LikeToCode on
The error is happening when the script tries to set the default printer. This
is probably because the printer has not finished connecting before the script
tries to set it as default. Try having the script sleep for a few seconds
before it sets the default printer.

From: wuzzle on
On Mar 17, 11:44 am, LikeToCode <LikeToC...(a)discussions.microsoft.com>
wrote:
> The error is happening when the script tries to set the default printer. This
> is probably because the printer has not finished connecting before the script
> tries to set it as default. Try having the script sleep for a few seconds
> before it sets the default printer.

I am script kiddie of sorts..how do I make the script sleep? Within
the script itself? (in the meanwhile I will search). Thanks
From: wuzzle on
On Mar 17, 12:14 pm, wuzzle <wuzz...(a)gmail.com> wrote:
> On Mar 17, 11:44 am, LikeToCode <LikeToC...(a)discussions.microsoft.com>
> wrote:
>
> > The error is happening when the script tries to set the default printer.. This
> > is probably because the printer has not finished connecting before the script
> > tries to set it as default. Try having the script sleep for a few seconds
> > before it sets the default printer.
>
> I am script kiddie of sorts..how do I make the script sleep? Within
> the script itself? (in the meanwhile I will search). Thanks

I think I found it "wscript.sleep xxxx (where x represents time, 3
minutes should be enough time to install a printer) so

Set WshNetwork = WScript.CreateObject("WScript.Network")


PrinterPath = "\\server1\sharedName_hp1"


WshNetwork.AddWindowsPrinterConnection PrinterPath
wscript.sleep 180000
WshNetwork.SetDefaultPrinter PrinterPath


From: Paul Randall on

"wuzzle" <wuzzle1(a)gmail.com> wrote in message
news:769b5aea-a808-4a22-851d-e634b837452f(a)x1g2000prb.googlegroups.com...
On Mar 17, 12:14 pm, wuzzle <wuzz...(a)gmail.com> wrote:
> On Mar 17, 11:44 am, LikeToCode <LikeToC...(a)discussions.microsoft.com>
> wrote:
>
> > The error is happening when the script tries to set the default printer.
> > This
> > is probably because the printer has not finished connecting before the
> > script
> > tries to set it as default. Try having the script sleep for a few
> > seconds
> > before it sets the default printer.
>
> I am script kiddie of sorts..how do I make the script sleep? Within
> the script itself? (in the meanwhile I will search). Thanks

I think I found it "wscript.sleep xxxx (where x represents time, 3
minutes should be enough time to install a printer) so

Set WshNetwork = WScript.CreateObject("WScript.Network")


PrinterPath = "\\server1\sharedName_hp1"


WshNetwork.AddWindowsPrinterConnection PrinterPath
wscript.sleep 180000
WshNetwork.SetDefaultPrinter PrinterPath

-----------------------
Have you found the vbscript help file? it is probably on your system. It
is a .CHM with a good search facility. Searching the index for the word
sleep would have found what you want. Of course, the help file's name is
not obvious. It is script56.chm.

Microsoft's download center is searchable. For instance, you could go to
http://www.microsoft.com/downloads/en/default.aspx and search for *.chm.
Within the first 10 hits you will find: Windows Script 5.6 Documentation

-Paul Randall