Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Windows 2000 server logon script to map network dr

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2011
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Windows 2000 server logon script to map network dr
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Windows 2000 server logon script to map network dr - 2/9/2005 12:28:32 AM   
  Teknophobia

 

Posts: 2
Score: 0
Joined: 2/9/2005
From:
Status: offline
Want the client PC's to map to a network drive using Group Policy logon, then rename the mapped network drive label to more user-friendly name.

For example, instead of -
data on 'server_backup' (Y:)

i want -
Company Data (Y:)

I cannot get the user-friendly mapped network drive 'label' to appear on the client PC. The client PC (Win 2K) is mapping the network drives successfully, but is keeping it's default drive label description - data on 'server_backup' (Y:)

The scripts that I have copied from various sources all appear to use the same method; here's an example of the one I'm using right now...

Option Explicit
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName
'
strDriveLetter = "Y:"
strRemotePath = "\\server_backup\data"
strNewName = "Company Data"

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter & "\").Self.Name = strNewName

WScript.Quit

The only way I've managed to get it to work, and it's a bit dirty, is by removing the renaming of network drive from the script altogether, and adding a desktop.ini file in the root of the shared drive with the following in it:

[.ShellClassInfo]
NetShareDisplayName=Company Data
InfoTip=Documents and Paperwork pertaining to our Company

I got this tip from tacktech (http://www.tacktech.com/display.cfm?ttid=16), but haven't seen anything like it reference elsewhere.

Is there any way I can incorporate this into my script as it get's messy when you've got these files in every share, having to lock them down, etc.

Thanks in advance.
 
 
Post #: 1
 
 Re: Windows 2000 server logon script to map network dr - 2/9/2005 1:31:37 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.Drives.Item("y")
drv.VolumeName = "Company Data"

(in reply to Teknophobia)
 
 
Post #: 2
 
 Re: Windows 2000 server logon script to map network dr - 2/9/2005 3:39:43 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Your script works just add WScript.Sleep 1000

Option Explicit
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName
'
strDriveLetter = "Y:"
strRemotePath = "\\server_backup\data"
strNewName = "Company Data"

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

WScript.Sleep 1000

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter & "\").Self.Name = strNewName

WScript.Quit

(in reply to Teknophobia)
 
 
Post #: 3
 
 Re: Windows 2000 server logon script to map network dr - 2/9/2005 4:39:22 AM   
  Teknophobia

 

Posts: 2
Score: 0
Joined: 2/9/2005
From:
Status: offline
tnoonan - you the man.

I take it the renaming of the network drive was happening too quickly for the client?

Is that sleep command variable in miliseconds?

Thanks a million - this has been driving me nuts.

TEk

(in reply to Teknophobia)
 
 
Post #: 4
 
 Re: Windows 2000 server logon script to map network dr - 2/13/2005 9:37:27 AM   
  mllj

 

Posts: 1
Score: 0
Joined: 12/8/2004
From:
Status: offline
Can this be modified to map a drive based on username?

(in reply to Teknophobia)
 
 
Post #: 5
 
 Re: Windows 2000 server logon script to map network dr - 2/13/2005 9:58:21 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
If InStr(strUser, "tnoonan") Then
wshNetwork.MapNetworkDrive "T:", "\\Treev\treevadm"
End If

example found @

http://www.spoogenet.com/index.php?module=documents&JAS_DocumentManager_op=viewDocument&JAS_Document_id=19

(in reply to Teknophobia)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Windows 2000 server logon script to map network dr Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts