Another Remote Logon script issue
Home › Forums › Scripting › Windows Script Host › Another Remote Logon script issue
- This topic has 1 reply, 2 voices, and was last updated 3 years, 1 month ago by
wullieb1.
-
AuthorPosts
-
CremoMemberDec 07, 2017 at 4:05 pm #167335Hi there.
I have a new smaller client that is rolling out new Windows 10 laptops to users to work remotely. This is my first exposure to Windows 10… and VBS.I’ll start by saying – my VB experience is zero – but I can sort of follow the logic on some parts, but others are like heiroglypics. I’ve always worked with Batch Files for logon scripts.
Now the Script works well onsite while connected to the domain. We are happy there, although I’ve yet to work out how to map the user share
My issue is when the user is offsite, their mapped drives disappear.
My experience is with logon scripts was via batch files, where when you were offsite, the drives were still listed in Windows Explorer, but with red X until you connected to the network via VPN.With my test Windows 10 laptop, when offsite the mapped drives dont even show up at all. And when you VPN in – nothing is there. If I double click a shortcut to the script while VPN’ed in – it maps the drives. but I cant expect users to do this
Can anyone shine some light on it for me?
This is their script I’ve inherited.
Option Explicit
Dim objNetwork, strDrive, objShell, objUNC, objFSO
Dim strRemotePath1, strDriveLetter1, strNewName1
Dim strRemotePath2, strDriveLetter2, strNewName2
Dim strRemotePath3, strDriveLetter3, strNewName3
Dim strRemotePath4, strDriveLetter4, strNewName4
Dim strRemotePath5, strDriveLetter5, strNewName5
Dim strRemotePath6, strDriveLetter6, strNewName6‘ NEEDED FOR IF THEN
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objNetwork = CreateObject(“Wscript.Network”)‘ DECLARING DRIVES AND UNC PATHS
strDriveLetter1 = “G:”
strRemotePath1 = “\servername.FQDNdocs”
strNewName1 = “Docs”
‘ Change the Letter, Path, and NamestrDriveLetter2 = “T:”
strRemotePath2 = “\servername.FQDNTech”
strNewName2 = “Technical”
‘ Change the Letter, Path, and NamestrDriveLetter3 = “J:”
strRemotePath3 = “\servername.FQDNfinance”
strNewName3 = “Finance”
‘ Change the Letter, Path, and NamestrDriveLetter4 = “S:”
strRemotePath4 = “\servername.FQDNSales”
strNewName4 = “Sales”
‘ Change the Letter, Path, and NamestrDriveLetter5 = “V:”
strRemotePath5 = “\servername.FQDNHR”
strNewName5 = “HR Drive”
‘ Change the Letter, Path, and NamestrDriveLetter6 = “W:”
strRemotePath6 = “\servername.FQDNDatabase”
strNewName6 = “Database”
‘ Change the Letter, Path, and Name‘ CHECKING TO SEE IF DRIVE IS MAPPED, IF IT IS IT IGNORES IT AND MOVES ON, IF IT IS NOT IT MAPS IT.
‘ Section to map the G network drive
If (objFSO.DriveExists(“G:”) = True) Then
objNetwork.RemoveNetworkDrive “G:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1‘ Section which actually (re)names the G Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1‘ Section to map the T network drive
If (objFSO.DriveExists(“T:”) = True) Then
objNetwork.RemoveNetworkDrive “T:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2‘ Section which actually (re)names the T Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2‘ Section to map the J network drive
If (objFSO.DriveExists(“J:”) = True) Then
objNetwork.RemoveNetworkDrive “J:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3‘ Section which actually (re)names the J Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3‘ Section to map the S network drive
If (objFSO.DriveExists(“S:”) = True) Then
objNetwork.RemoveNetworkDrive “S:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4‘ Section which actually (re)names the S Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter4).Self.Name = strNewName4‘ Section to map the V network drive
If (objFSO.DriveExists(“V:”) = True) Then
objNetwork.RemoveNetworkDrive “V:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5‘ Section which actually (re)names the V Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter5).Self.Name = strNewName5‘ Section to map the W network drive
If (objFSO.DriveExists(“W:”) = True) Then
objNetwork.RemoveNetworkDrive “W:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter6, strRemotePath6‘ Section which actually (re)names the W Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter6).Self.Name = strNewName6WScript.Quit
‘ End of VBScript.[/CODE]
Thanks
Cremo[/FONT]
[CODE]Option Explicit
Dim objNetwork, strDrive, objShell, objUNC, objFSO
Dim strRemotePath1, strDriveLetter1, strNewName1
Dim strRemotePath2, strDriveLetter2, strNewName2
Dim strRemotePath3, strDriveLetter3, strNewName3
Dim strRemotePath4, strDriveLetter4, strNewName4
Dim strRemotePath5, strDriveLetter5, strNewName5
Dim strRemotePath6, strDriveLetter6, strNewName6‘ NEEDED FOR IF THEN
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objNetwork = CreateObject(“Wscript.Network”)‘ DECLARING DRIVES AND UNC PATHS
strDriveLetter1 = “G:”
strRemotePath1 = “\servername.FQDNdocs”
strNewName1 = “Docs”
‘ Change the Letter, Path, and NamestrDriveLetter2 = “T:”
strRemotePath2 = “\servername.FQDNTech”
strNewName2 = “Technical”
‘ Change the Letter, Path, and NamestrDriveLetter3 = “J:”
strRemotePath3 = “\servername.FQDNfinance”
strNewName3 = “Finance”
‘ Change the Letter, Path, and NamestrDriveLetter4 = “S:”
strRemotePath4 = “\servername.FQDNSales”
strNewName4 = “Sales”
‘ Change the Letter, Path, and NamestrDriveLetter5 = “V:”
strRemotePath5 = “\servername.FQDNHR”
strNewName5 = “HR Drive”
‘ Change the Letter, Path, and NamestrDriveLetter6 = “W:”
strRemotePath6 = “\servername.FQDNDatabase”
strNewName6 = “Database”
‘ Change the Letter, Path, and Name‘ CHECKING TO SEE IF DRIVE IS MAPPED, IF IT IS IT IGNORES IT AND MOVES ON, IF IT IS NOT IT MAPS IT.
‘ Section to map the G network drive
If (objFSO.DriveExists(“G:”) = True) Then
objNetwork.RemoveNetworkDrive “G:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1‘ Section which actually (re)names the G Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter1).Self.Name = strNewName1‘ Section to map the T network drive
If (objFSO.DriveExists(“T:”) = True) Then
objNetwork.RemoveNetworkDrive “T:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2‘ Section which actually (re)names the T Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter2).Self.Name = strNewName2‘ Section to map the J network drive
If (objFSO.DriveExists(“J:”) = True) Then
objNetwork.RemoveNetworkDrive “J:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3‘ Section which actually (re)names the J Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter3).Self.Name = strNewName3‘ Section to map the S network drive
If (objFSO.DriveExists(“S:”) = True) Then
objNetwork.RemoveNetworkDrive “S:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4‘ Section which actually (re)names the S Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter4).Self.Name = strNewName4‘ Section to map the V network drive
If (objFSO.DriveExists(“V:”) = True) Then
objNetwork.RemoveNetworkDrive “V:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter5, strRemotePath5‘ Section which actually (re)names the V Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter5).Self.Name = strNewName5‘ Section to map the W network drive
If (objFSO.DriveExists(“W:”) = True) Then
objNetwork.RemoveNetworkDrive “W:”, True, True
End If
Set objNetwork = CreateObject(“WScript.Network”)
objNetwork.MapNetworkDrive strDriveLetter6, strRemotePath6‘ Section which actually (re)names the W Mapped Drive
Set objShell = CreateObject(“Shell.Application”)
objShell.NameSpace(strDriveLetter6).Self.Name = strNewName6WScript.Quit
‘ End of VBScript.[/CODE]
Thanks
Cremo -
AuthorPosts
You must be logged in to reply to this topic.