UPDATE: Logon Script Problem
- From: jb6000 <jb6000@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 3 Jan 2007 09:11:01 -0800
Hello,
This is an update of a post I did back on Dec 18th regarding a script problem.
My script works fine when I create one script per user but when I try to
create a script with logic (to check for username) I get the following error:
Error: The local device name is already in use.
Code: 80070055
Source: WSHNetwork.mapNetworkDrive
Below is a copy of my script with (or lack of) logic:
NOTE: The only part different between my working script and this script that
gives me the error above is the Do Until section.
'Initialization Section
Option Explicit
' On Error Resume Next
Dim objWshNet
Dim WshShell
Dim strDesktopPath
Dim strStartupPath
Dim objShortcutUrl
Dim objShortcutLnk
Dim strFoundUser
Set objWshNet = WScript.CreateObject("WScript.Network")
Set WshShell = CreateObject("WScript.Shell")
strDesktopPath = WshShell.SpecialFolders("Desktop")
strStartupPath = WshShell.SpecialFolders("AllUsersStartup")
strFoundUser = "no"
'
'***************************
'* Main Processing Section *
'***************************
'
' Check for network username
Do Until strFoundUser = "yes"
If objWshNet.UserName = "jsmith" then
MapDeluxeFolder()
MapCompanyHomeFolder()
MapCommonCompanyFolders()
SetCommonCompanyShortcuts()
SetSalesAssocShortcuts()
strFoundUser = "yes"
End If
If objWshNet.UserName = "sadams" then
MapCompanyHomeFolder()
MapCommonCompanyFolders()
SetCommonITShortcuts()
SetCommonCompanyShortcuts()
strFoundUser = "yes"
End If
If objWshNet.UserName = "vbrown" then
MapDeluxeFolder()
MapCompanyHomeFolder()
MapCommonCompanyFolders()
SetCommonCompanyShortcuts()
SetSalesAssocShortcuts()
strFoundUser = "yes"
End If
strFoundUser = "yes"
Loop
WScript.Quit()
Sub MapNetworkDrive(DriveLetter, NetworkPath)
objWshNet.MapNetworkDrive DriveLetter, NetworkPath
End Sub
'*********************
'* Procedure Section *
'*********************
' START ************ MAPPED NETWORK FOLDERS ************************
Function MapDeluxeFolder()
MapNetworkDrive "G:", "\\Companybdc\GroupFolders\Deluxe39b"
End Function
Function MapCompanyHomeFolder()
MapNetworkDrive "H:", "\\Companybdc\homefolders\%username%"
End Function
Function MapCommonCompanyFolders()
MapNetworkDrive "M:", "\\192.xxx.xxx.5\symreceipts"
MapNetworkDrive "R:", "\\Companybdc\groupfolders\SCS system"
MapNetworkDrive "W:", "\\netcreditserv\ITSR SHARED"
End Function
Function MapCompanyManagerFolders()
MapNetworkDrive "T:", "\\Companybdc\groupfolders\Managers"
End Function
Function MapACCTCODFolders()
MapNetworkDrive "U:", "\\Companybdc\ACCT_COD"
End Function
'END ******************* MAPPED NETWORK FOLDERS *********************
'START ================== SHORTCUTS (INCLUDING STARTUP SHORTCUTS)
=========================
Function SetLendingShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Andera
Online Membership.url")
objShortcutUrl.TargetPath =
"https://secure.andera.com/index.cfm?fiid=B1716D0F36EA482BAB472CEED63A459A&Action=admin.login"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\EFunds.url")
objShortcutUrl.TargetPath = "https://www.efunds.com/"
objshortcutUrl.Save
End Function
Function SetCommonITShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath &
"\IPMonitor.url")
objShortcutUrl.TargetPath = "https://Companymonitor"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\GFI
MailArchive.url")
objShortcutUrl.TargetPath = "http://ffgfiarchive/mailarchiver/main.aspx"
objShortcutUrl.Save
Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\Remote
Desktop.lnk")
objShortcutLnk.TargetPath = "%windir%\system32\mstsc.exe"
objShortcutLnk.Save
End Function
Function SetCommonCompanyShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\EZlabor.url")
objShortcutUrl.TargetPath = "https://xxx.company.com/"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Company
Intranet.url")
objShortcutUrl.TargetPath = "http://192.xxx.xxx.249/"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\CoWWW
Server.url")
objShortcutUrl.TargetPath = "http://192.xxx.xxx.5/cowww5/index.html"
objShortcutUrl.Save
Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\Episys
Online Pub.lnk")
objShortcutLnk.TargetPath =
"\\Companybdc\GroupFolders\Public\EpisysDocs\EpisysOLP.chm"
objshortcutLnk.Save
End Function
Function SetCOPShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Wave
Server.url")
objShortcutUrl.TargetPath = "https://wave.company.org"
objShortcutUrl.Save
End Function
Function SetSalesAssocShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Wave
Server.url")
objShortcutUrl.TargetPath = "https://wave.company.org"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Company DI
Console Server.url")
objShortcutUrl.TargetPath = "https://www.company.org/Admin/"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\MAPP
Server.url")
objShortcutUrl.TargetPath = " http://www.company.com/login.asp"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\KBB
Server.url")
objShortcutUrl.TargetPath = "http://www.kbbcompany.com/"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\MBInet
Server.url")
objShortcutUrl.TargetPath = "https://extranet.advocompanycar.com/Login.asp"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\FedEx
Online Server.url")
objShortcutUrl.TargetPath = " http://www.fedex.com/us/"
objshortcutUrl.Save
Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\SCS
System.lnk")
objShortcutLnk.TargetPath = "R:\SCS FRONT_END\Use this Consolidated
Incentive program.mdb"
objShortcutLnk.Save
End Function
Function SetCompanyManagerShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath &
"\Connections.url")
objShortcutUrl.TargetPath = "https://connections.Companytrust.org"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath &
"\Boardsite.url")
objShortcutUrl.TargetPath = "https://volunteersite.Companytrust.org"
objShortcutUrl.Save
End Function
Function SetAcctShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\Wave
Server.url")
objShortcutUrl.TargetPath = "https://wave.company.org"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\EFunds.url")
objShortcutUrl.TargetPath = "https://www.ecompany.com/"
objshortcutUrl.Save
End Function
Function SetLSVCShortcuts()
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\MAPP
Server.url")
objShortcutUrl.TargetPath = " http://www.company.com/login.asp"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\KBB
Server.url")
objShortcutUrl.TargetPath = "http://www.company.com/"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\MBInet
Server.url")
objShortcutUrl.TargetPath = "https://extranet.advocompanycar.com/Login.asp"
objShortcutUrl.Save
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\FedEx
Online Server.url")
objShortcutUrl.TargetPath = " http://www.fedex.com/us/"
objshortcutUrl.Save
Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\SCS
System.lnk")
objShortcutLnk.TargetPath = "R:\SCS FRONT_END\Use this Consolidated
Incentive program.mdb"
objShortcutLnk.Save
End Function
' END ================= SHORTCUTS (INCLUDING STARTUP SHORTCUTS)
======================
.
- Follow-Ups:
- Re: UPDATE: Logon Script Problem
- From: Al Dunbar [MS-MVP]
- Re: UPDATE: Logon Script Problem
- From: Richard Mueller
- Re: UPDATE: Logon Script Problem
- Prev by Date: Possible to telnet via VBScript
- Next by Date: Re: UPDATE: Logon Script Problem
- Previous by thread: Possible to telnet via VBScript
- Next by thread: Re: UPDATE: Logon Script Problem
- Index(es):
Relevant Pages
|