LindsayeCroft
Technical User
Hi everyone, i work in a school and we have several computer rooms which the pupils could be in any one of. I would like to create a logon script which gets the computer name and installs the network printer in that room. so far i have the following
On error resume next
Set objNetwork = Wscript.CreateObject("WScript.Network")
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set colSystemEnvVars = objShell.Environment("System")
Set colUserEnvVars = objShell.Environment("User")
Set objNetwork = Wscript.CreateObject("Wscript.Network")
samUser = objNetwork.UserName
computerName = objNetwork.ComputerName
if objnetwork.ComputerName = "IT02" then
objNetwork.AddWindowsPrinterConnection "\\SERVER\F11"
objNetwork.SetDefaultPrinter "\\SERVER\F11"
end if
which works fine as i have only tested it with one computer name, what i would like to know is can i change it so instead of saying if computername=IT02 it says if computername starts with IT ie. so it will work for a full room of computers.
Hope this makes sense.
Thanks
Lindsay
On error resume next
Set objNetwork = Wscript.CreateObject("WScript.Network")
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set colSystemEnvVars = objShell.Environment("System")
Set colUserEnvVars = objShell.Environment("User")
Set objNetwork = Wscript.CreateObject("Wscript.Network")
samUser = objNetwork.UserName
computerName = objNetwork.ComputerName
if objnetwork.ComputerName = "IT02" then
objNetwork.AddWindowsPrinterConnection "\\SERVER\F11"
objNetwork.SetDefaultPrinter "\\SERVER\F11"
end if
which works fine as i have only tested it with one computer name, what i would like to know is can i change it so instead of saying if computername=IT02 it says if computername starts with IT ie. so it will work for a full room of computers.
Hope this makes sense.
Thanks
Lindsay