For Each the Computer In aryP1

If UCASE(theComputer) = UCASE(strComputer) Then

            Printer1

End If

Next

 
I wonder why you have to put this in an array and do it this way. But then, you understand your requirement and setup better. Also, are the spaces "\\Local_Print_Server \P1 " and other just typos or intentional?
 
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Active Directory
www.akomolafe.com
www.iyaburo.com
Do you now realize that Today is the Tomorrow you were worried about Yesterday?  -anon


From: Raymond McClinnis
Sent: Sat 4/3/2004 2:33 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] OT: Logon-Script Help

Hi All;

I’m trying to set up each computer at my remote locations to use a specific Default Printer (also needs to be mapped to LPT3: ) using an array.  I used IF…THEN…ELSEIF, but it required more coding than I really wanted to do (but it worked fine).  After I put the Arrays in place no matter what the Computer Name it always executes Sub Printer1 and ignores Sub Printer2.  I’m pretty sure I’m missing a call to the obj.Network.ComputerName or something, I’m just not sure where to put it

Any help will be greatly appreciated.

 

Thanks in Advance,

Raymond McClinnis

Begin Script:

 

Set objNetwork = CreateObject("Wscript.Network")

strComputer = objNetwork.ComputerName

strUser =  objNetwork.Username

aryP1 = Array("COMPUTER1", " COMPUTER2", " COMPUTER3", " COMPUTER4")

aryP2 = Array("COMPUTER5", " COMPUTER6", " COMPUTER7", " COMPUTER8", " COMPUTER9")

'Logon script start

' Mapping ALL LOCAL Network Printers

objNetwork.AddWindowsPrinterConnection "\\Local_Print_Server \P1 "

objNetwork.AddWindowsPrinterConnection "\\Local_Print_Server \P2"

‘objNetwork.AddWindowsPrinterConnection "\\Remote_Print_Server \P1"

‘objNetwork.AddWindowsPrinterConnection "\\Remote_Print_Server \P2"

'--==In the event of \\Local_Print_Server Hardware failure, remove the ' from in front of \\Remote_Print_Server==--

'--==And put them in front of \\Local_Print_Server ==--

 

 

'  Setting Default Printers by DEV#

For Each objNetwork.ComputerName In aryP1

            Printer1

Next

For Each objNetwork.ComputerName In aryP2

            Printer2

Next

wscript.echo "Your logon to is Complete. Thank You, Have A Nice Day!"

wscript.Quit

Sub Printer1

            objNetwork.AddPrinterConnection "LPT3:", “\\Local_Print_Server\P1"

                        objNetwork.SetDefaultPrinter “\\\\Remote_Print_Server\P1”

‘           objNetwork.AddPrinterConnection "LPT3:", “\\Remote_Print_Server\P1"

‘                       objNetwork.SetDefaultPrinter “\\Remote_Print_Server\P1”

'--==In the event of \\Local_Print_Server Hardware failure, remove the ' from in front of \\Remote_Print_Server==--

'--==And put them in front of \\Local_Print_Server ==--

End Sub

Sub Printer2

            objNetwork.AddPrinterConnection "LPT3:", “\\Local_Print_Server\P2"

                        objNetwork.SetDefaultPrinter “\\Local_Print_Server\P2”

‘           objNetwork.AddPrinterConnection "LPT3:", “\\Remote_Print_Server\P2"

‘                       objNetwork.SetDefaultPrinter “\\Remote_Print_Server\P2”

'--==In the event of \\Local_Print_Server Hardware failure, remove the ' from in front of \\Remote_Print_Server==--

'--==And put them in front of \\Local_Print_Server ==--

End Sub

 

Reply via email to