meznehemia
asked on
Script for populating specific \\server\shares under 'My Network Places"
Hi,
I am sick of emails asking I need access to A,B, C,D...Z drive when I have no idea to what server\share each user may map their local drive lettlers. My company has about 2000 very mobile users and 15 US sites with one main data center in somewhereville. For exapmple each site has a local file server and users by convention map their drive letter P to the \\citylocalserver\public. I want to get away from drive letters as much as possible and just recomend to my network adding each server\share available on users desktop 'My Network Places' for all users logging into our US Domain. Is it possible to write a VBS script the same way you can add for example a drive letter "objNetwork.MapNetworkDriv e "P:", "\\filesvr1\public","False " " ?
I am sick of emails asking I need access to A,B, C,D...Z drive when I have no idea to what server\share each user may map their local drive lettlers. My company has about 2000 very mobile users and 15 US sites with one main data center in somewhereville. For exapmple each site has a local file server and users by convention map their drive letter P to the \\citylocalserver\public. I want to get away from drive letters as much as possible and just recomend to my network adding each server\share available on users desktop 'My Network Places' for all users logging into our US Domain. Is it possible to write a VBS script the same way you can add for example a drive letter "objNetwork.MapNetworkDriv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
'************************S
Option Explicit
dim strNethoodNameLdrive '= "First L drive"
dim strNethoodNameATLPdrive '= "2nd Public"
dim strNethoodNamePRNPdrive '= "3rd Public"
dim strNethoodNameCLVPdrive '= "4th Public"
dim strNethoodNameCHIPdrive '= "fifth Public"
dim strNetAddressLdrive '= "\\firstsvr1\public"
dim strNetAddressATLPdrive '= "\\2ndsvr1\Public"
dim strNetAddressPRNPdrive '= "\\3rdsvr1\public"
dim strNetAddressCLVPdrive '= "\\4rgsvr1\public"
dim strNetAddressCHIPdrive '= "\\5thsvr1\public"
dim strNethoodPath
dim strNetPlaceDir
dim FILEIni
dim F 'desktop.ini
dim objWshScript
dim objFilesys
dim objNethood
strNethoodNameLdrive = "Location 1 L drive"
strNetAddressLdrive = "\\firstsvr1\public"
strNethoodNameATLPdrive = "Location 2 Public"
strNetAddressATLPdrive = "\\2ndvr1\Public"
strNethoodNamePRNPdrive = "Location 3 Public"
strNetAddressPRNPdrive = "\\3rdsvr1\public"
strNethoodNameCLVPdrive = "Location 4 Public"
strNetAddressCLVPdrive = "\\4thsvr1\public"
strNethoodNameCHIPdrive = "Location 5 Public"
strNetAddressCHIPdrive = "\\5thsvr1\public"
set objWshScript = WScript.CreateObject("WScr
set objFilesys = CreateObject("Scripting.Fi
'*********************Firs
strNethoodPath = objWshScript.SpecialFolder
strNetPlaceDir = strNethoodPath + "\" + strNethoodNameLdrive
If objFilesys.FolderExists (strNetPlaceDir) Then
msgbox("folder exists")
WScript.quit
End If
objFilesys.CreateFolder (strNetPlaceDir)
' 1 = ReadOnly, 16 = Folder
Set F = objFilesys.GetFolder(strNe
F.Attributes = 17
'target.lnk
set objNethood = objWshScript.CreateShortcu
objNethood.TargetPath = strNetAddressLdrive
objNethood.Save
'target.lnk
'32 = Archive
'Set F = objFilesys.GetFile(strNetP
'F.Attributes = 32
'desktop.ini
Set FILEIni = objFilesys.CreateTextFile(
FILEIni.WriteLine("[.Shell
& ("ComfirmFileOp=0") & vbcrlf _
& ("CLSID2={0AFACED1-E828-11
& ("Flags=2")
FILEIni.Close
'desktop.ini
' 2 = Hidden, 4 = System
Set F = objFilesys.GetFile(strNetP
F.Attributes = 6
'******************** 2nd Public Share **************************
strNetPlaceDir = strNethoodPath + "\" + strNethoodNameATLPdrive
If objFilesys.FolderExists (strNetPlaceDir) Then
msgbox("folder exists")
WScript.quit
End If
objFilesys.CreateFolder (strNetPlaceDir)
' 1 = ReadOnly, 16 = Folder
Set F = objFilesys.GetFolder(strNe
F.Attributes = 17
'target.lnk
set objNethood = objWshScript.CreateShortcu
objNethood.TargetPath = strNetAddressATLPdrive
objNethood.Save
'target.lnk
'32 = Archive
'Set F = objFilesys.GetFile(strNetP
'F.Attributes = 32
'desktop.ini
Set FILEIni = objFilesys.CreateTextFile(
FILEIni.WriteLine("[.Shell
& ("ComfirmFileOp=0") & vbcrlf _
& ("CLSID2={0AFACED1-E828-11
& ("Flags=2")
FILEIni.Close
'desktop.ini
' 2 = Hidden, 4 = System
Set F = objFilesys.GetFile(strNetP
F.Attributes = 6
'********************* 3rd Public Share **************************
strNetPlaceDir = strNethoodPath + "\" + strNethoodNamePRNPdrive
If objFilesys.FolderExists (strNetPlaceDir) Then
msgbox("folder exists")
WScript.quit
End If
objFilesys.CreateFolder (strNetPlaceDir)
' 1 = ReadOnly, 16 = Folder
Set F = objFilesys.GetFolder(strNe
F.Attributes = 17
'target.lnk
set objNethood = objWshScript.CreateShortcu
objNethood.TargetPath = strNetAddressPRNPdrive
objNethood.Save
'target.lnk
'32 = Archive
'Set F = objFilesys.GetFile(strNetP
'F.Attributes = 32
'desktop.ini
Set FILEIni = objFilesys.CreateTextFile(
FILEIni.WriteLine("[.Shell
& ("ComfirmFileOp=0") & vbcrlf _
& ("CLSID2={0AFACED1-E828-11
& ("Flags=2")
FILEIni.Close
'desktop.ini
' 2 = Hidden, 4 = System
Set F = objFilesys.GetFile(strNetP
F.Attributes = 6
'*************************
strNetPlaceDir = strNethoodPath + "\" + strNethoodNameCLVPdrive
If objFilesys.FolderExists (strNetPlaceDir) Then
msgbox("folder exists")
WScript.quit
End If
objFilesys.CreateFolder (strNetPlaceDir)
' 1 = ReadOnly, 16 = Folder
Set F = objFilesys.GetFolder(strNe
F.Attributes = 17
'target.lnk
set objNethood = objWshScript.CreateShortcu
objNethood.TargetPath = strNetAddressCLVPdrive
objNethood.Save
'target.lnk
'32 = Archive
'Set F = objFilesys.GetFile(strNetP
'F.Attributes = 32
'desktop.ini
Set FILEIni = objFilesys.CreateTextFile(
FILEIni.WriteLine("[.Shell
& ("ComfirmFileOp=0") & vbcrlf _
& ("CLSID2={0AFACED1-E828-11
& ("Flags=2")
FILEIni.Close
'desktop.ini
' 2 = Hidden, 4 = System
Set F = objFilesys.GetFile(strNetP
F.Attributes = 6
'*************************
strNetPlaceDir = strNethoodPath + "\" + strNethoodNameCHIPdrive
If objFilesys.FolderExists (strNetPlaceDir) Then
msgbox("folder exists")
WScript.quit
End If
objFilesys.CreateFolder (strNetPlaceDir)
' 1 = ReadOnly, 16 = Folder
Set F = objFilesys.GetFolder(strNe
F.Attributes = 17
'target.lnk
set objNethood = objWshScript.CreateShortcu
objNethood.TargetPath = strNetAddressCHIPdrive
objNethood.Save
'target.lnk
'32 = Archive
'Set F = objFilesys.GetFile(strNetP
'F.Attributes = 32
'desktop.ini
Set FILEIni = objFilesys.CreateTextFile(
FILEIni.WriteLine("[.Shell
& ("ComfirmFileOp=0") & vbcrlf _
& ("CLSID2={0AFACED1-E828-11
& ("Flags=2")
FILEIni.Close
'desktop.ini
' 2 = Hidden, 4 = System
Set F = objFilesys.GetFile(strNetP
F.Attributes = 6