# VBScript Help



## levi.rogers (Jun 23, 2006)

The following code is meant to be a logon script for certain users in a domain. However, when I try and use it it gives me an error. Of course it can't be just that ease it only gives me an error when used as a logon script, but if I just open it up and run it on my desktop it does fine. The following is the code:


'----------------------------------------------------'

'Mapping Teller Printers'

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\2k3srvr\HP8150"
WshNetwork.SetDefaultPrinter "\\2k3srvr\HP8150"

'---------------------------------------------------------------------------------------------'
'Mapping Folder to Desktop


set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Teller Work File.lnk")
oShellLink.TargetPath = "\\2k3srvr\company share\tellerWorkFile"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "explorer.exe, 1"
oShellLink.Description = "Network R Drive"
oShellLink.WorkingDirectory = "\\2k3srvr\company share\tellerWorkFile"
oShellLink.Save
Set WshShell = Nothing
Set oShellLink = Nothing 

'--------------------------------------------------------------------------------------------'
'Mapping Networki Drives


On Error Resume Next
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "S:" , "\\2k3srvr\company share"
On Error Resume Next
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "R:" , "\\2k3srvr\company share\tellerWorkFile"
On Error Resume Next
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "Q:" , "\\nnbkearney-img\imageview"



Any help would be appreciated. 

Thanks, 

LR


----------

