Okay according to out current domain sturcture i no longer have access to group policys. So i am trying to map my printers by way of a logon script. I have a naming scheme for my computers so this is what i want to do. I would like to script that uses an if statement that checks the computername and maps to the correct printer.
This is my script so far
The problem with this script
is that the computername that i am working on is 5001-Admin01 and it will not install the printers?? if i put a ( ' ) in front of my "IF" and my "End if" it ends up installing. Why would this script not map my printers if the computername is what it says it is in the script? Am i missing something ?
'Map Printers for Shenandoah
'Drew Dorben Jan 28th
'---------------------------'
Option Explicit
'Declaring Variables
Dim obj2200
Dim obj810c
Dim unc2200CL
Dim unc810ccl
Dim Objcomputername
Dim Computername
'Set type
Set obj2200 = CreateObject("Wscript.Network")
Set obj810c = CreateObject("Wscript.Network")
Set objcomputername = Wscript.CreateObject("Wscript.Network")
'Introducing values to variables
UNC2200cl = "\\5001-CL31-6488\2200"
unc810ccl = "\\5001-CL31-6488\810c"
computerName = objcomputername.ComputerName
'Script body
if Computername = 5001-admin01 Then
obj2200.AddWindowsPrinterConnection UNC2200cl
obj810c.addwindowsprinterConnection Unc810ccl
wscript.echo "Printers were connected successfully"
End if
'Confirmation
This is my script so far
The problem with this script
is that the computername that i am working on is 5001-Admin01 and it will not install the printers?? if i put a ( ' ) in front of my "IF" and my "End if" it ends up installing. Why would this script not map my printers if the computername is what it says it is in the script? Am i missing something ?
'Map Printers for Shenandoah
'Drew Dorben Jan 28th
'---------------------------'
Option Explicit
'Declaring Variables
Dim obj2200
Dim obj810c
Dim unc2200CL
Dim unc810ccl
Dim Objcomputername
Dim Computername
'Set type
Set obj2200 = CreateObject("Wscript.Network")
Set obj810c = CreateObject("Wscript.Network")
Set objcomputername = Wscript.CreateObject("Wscript.Network")
'Introducing values to variables
UNC2200cl = "\\5001-CL31-6488\2200"
unc810ccl = "\\5001-CL31-6488\810c"
computerName = objcomputername.ComputerName
'Script body
if Computername = 5001-admin01 Then
obj2200.AddWindowsPrinterConnection UNC2200cl
obj810c.addwindowsprinterConnection Unc810ccl
wscript.echo "Printers were connected successfully"
End if
'Confirmation