|
| |||||||||
| Tags: full, hide, mapped |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Hide full path in Windows explorer of mapped drive
I am not sure which group this should go in so forgive me for posting the same question in several groups. I am using net use in the login script to show mapped drives in Windows Explorer for my users. it appears as Share on 'server\share' (V:) Is there a way to just have it show as Share (V:)? I don't want the full path there? Thanks, |
|
#2
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Hello, you can mount the network drives with vbscript. After the mounting you can use this snippet: ------------------------ sDrive = "V:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "Data" ------------------------- -- Viele Grüße Frank Röder MVP Windows Server System - Directory Services "Ex oriente lux" |
|
#3
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
I have never used vbscript before. What do you mean by mount the network drive with vbscript? Thanks, "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:e3CEoTJVJHA.1224@TK2MSFTNGP04.phx.gbl... > Hello, > > you can mount the network drives with vbscript. After the mounting you can > use this snippet: > ------------------------ > sDrive = "V:\" > Set oShell = CreateObject("Shell.Application") > oShell.NameSpace(sDrive).Self.Name = "Data" > ------------------------- > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
|
#4
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Hello Sam, you can write the whole logonscript in vbscript: --------------------------------------------------- Set objWSHNet = CreateObject("WScript.Network") objWSHNet.MapNetworkDrive "V:", "\\servername\share" if err.number=0 then sDrive = "V:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "Data" end if ----------------------------------------------- -- Viele Grüße Frank Röder MVP Windows Server System - Directory Services "Ex oriente lux" |
|
#5
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
I added to my logon script and when it ran received this error: 'objWSHNet.MapNetwrokDrive' is not recognized as an internal or external command "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:%23bDLOPWVJHA.3908@TK2MSFTNGP06.phx.gbl... > Hello Sam, > > you can write the whole logonscript in vbscript: > --------------------------------------------------- > Set objWSHNet = CreateObject("WScript.Network") > objWSHNet.MapNetworkDrive "V:", "\\servername\share" > if err.number=0 then > sDrive = "V:\" > Set oShell = CreateObject("Shell.Application") > oShell.NameSpace(sDrive).Self.Name = "Data" > end if > ----------------------------------------------- > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
|
#6
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Hello Sam, copy the full source code to a normal textfile an rename the file to "whatever.vbs". Assign this file to a user as a logonscript. After this it should work. -- Viele Grüße Frank Röder MVP Windows Server System - Directory Services "Ex oriente lux" |
|
#7
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
If I have other login information can I just copy the code for the drive mapping and how would I call this VBS from within the login script? Thanks, "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:eWoXAeXVJHA.4280@TK2MSFTNGP02.phx.gbl... > Hello Sam, > > copy the full source code to a normal textfile an rename the file to > "whatever.vbs". Assign this file to a user as a logonscript. After this it > should work. > > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
|
#8
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
It worked. I just pointed to the vbs file in my login script and it ran. One of my mapped drives failed however because it had %username% as in the following: objWSHNet.MapNetworkDrive "X:", "\\server\share\%username%" Can I call this and what would be the proper syntax for this? Thanks again for all your help. "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:eWoXAeXVJHA.4280@TK2MSFTNGP02.phx.gbl... > Hello Sam, > > copy the full source code to a normal textfile an rename the file to > "whatever.vbs". Assign this file to a user as a logonscript. After this it > should work. > > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
|
#9
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Hello, you cant use environment variables directly. Try this: ----------------------------------------------------------------- set objShell = CreateObject("Wscript.Shell") strUserName = objShell.ExpandEnvironmentStrings("%username%") Set objWSHNet = CreateObject("WScript.Network") objWSHNet.MapNetworkDrive "V:", "\\servername\share" if err.number=0 then sDrive = "V:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "Data" end if 'Map drive for Username objWSHNet.MapNetworkDrive "H:", "\\servername\" & strUsername if err.number=0 then sDrive = "H:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "User-Data" end if -- Viele Grüße Frank Röder MVP Windows Server System - Directory Services "Ex oriente lux" |
|
#10
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Thanks that worked great. One more question. I tried to modify your code as follows to include variable for computername: et objShell = CreateObject("Wscript.Shell") strUserName = objShell.ExpandEnvironmentStrings("%username%") strCompName = objShell.ExpandEnvironmentStrings("%computername%") 'Map drive for Username objWSHNet.MapNetworkDrive "I:", "\\" & strCompName & "\lotus\" & strUsername if err.number=0 then sDrive = "I:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "Writeup" end if I received the following error: Line 6 Char 1 Error Object required 'objWSHNet' What is the correct syntax for this? Thanks, "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:uMawSRtVJHA.4896@TK2MSFTNGP02.phx.gbl... > Hello, > > you cant use environment variables directly. > Try this: > ----------------------------------------------------------------- > set objShell = CreateObject("Wscript.Shell") > strUserName = objShell.ExpandEnvironmentStrings("%username%") > Set objWSHNet = CreateObject("WScript.Network") > objWSHNet.MapNetworkDrive "V:", "\\servername\share" > if err.number=0 then > sDrive = "V:\" > Set oShell = CreateObject("Shell.Application") > oShell.NameSpace(sDrive).Self.Name = "Data" > end if > 'Map drive for Username > objWSHNet.MapNetworkDrive "H:", "\\servername\" & strUsername > if err.number=0 then > sDrive = "H:\" > Set oShell = CreateObject("Shell.Application") > oShell.NameSpace(sDrive).Self.Name = "User-Data" > end if > > > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
|
#11
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Hello Sam, > I received the following error: > Line 6 > Char 1 > Error Object required 'objWSHNet' you need a Wscript.Network Object before you call the "mapnetworkdrive" method. Here is the correct syntax: set objWSHNet = CreateObject("Wscript.Network") set objShell = CreateObject("Wscript.Shell") strUserName = objShell.ExpandEnvironmentStrings("%username%") strCompName = objShell.ExpandEnvironmentStrings("%computername%") 'Map drive for Username objWSHNet.MapNetworkDrive "I:", "\\" & strCompName & "\lotus\" & strUsername if err.number=0 then sDrive = "I:\" Set oShell = CreateObject("Shell.Application") oShell.NameSpace(sDrive).Self.Name = "Writeup" end if -- Viele Grüße Frank Röder MVP Windows Server System - Directory Services "Ex oriente lux" |
|
#12
| |||
| |||
| Re: Hide full path in Windows explorer of mapped drive
Thanks very very much. Everything works great now. "Frank Röder [MVP]" <heidenau@web.de> wrote in message news:O1xIJSLWJHA.200@TK2MSFTNGP02.phx.gbl... > Hello Sam, > >> I received the following error: >> Line 6 >> Char 1 >> Error Object required 'objWSHNet' > > you need a Wscript.Network Object before you call the "mapnetworkdrive" > method. > Here is the correct syntax: > > set objWSHNet = CreateObject("Wscript.Network") > set objShell = CreateObject("Wscript.Shell") > strUserName = objShell.ExpandEnvironmentStrings("%username%") > strCompName = objShell.ExpandEnvironmentStrings("%computername%") > 'Map drive for Username > objWSHNet.MapNetworkDrive "I:", "\\" & strCompName & "\lotus\" & > strUsername > if err.number=0 then > sDrive = "I:\" > Set oShell = CreateObject("Shell.Application") > oShell.NameSpace(sDrive).Self.Name = "Writeup" > end if > > -- > Viele Grüße > Frank Röder > MVP Windows Server System - Directory Services > "Ex oriente lux" |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Hide full path in Windows explorer of mapped drive" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Full path in Windows Explorer and file access in Windows 7 Professional | mANICKAVASAN | Operating Systems | 4 | 13-12-2010 05:34 PM |
| Windows 7 mapped network drives locking explorer up | teena_pansare | Operating Systems | 5 | 06-04-2010 04:59 PM |
| Disconnect a network mapped drive in Windows XP | Ebadaah | Networking & Security | 3 | 27-07-2009 02:20 PM |
| Start Explorer in Drive View and hide drive letter in Windows 7 | Alexis25 | Windows Software | 3 | 08-05-2009 02:41 PM |
| Unable to run exe on mapped drive via explorer | Pablo Pecanto | Windows Server Help | 5 | 22-11-2006 05:47 PM |