+ Post New Thread
Results 1 to 11 of 11
Scripts Thread, Mapping Network Drives in Coding and Web Development; Using this example from the Wiki page: Code: On Error Resume next Dim WshNetwork Set WshNetwork = WScript.CreateObject("WScript.Network") Set objSysInfo ...
  1. #1

    Join Date
    Jun 2008
    Posts
    718
    Thank Post
    118
    Thanked 64 Times in 52 Posts
    Rep Power
    31

    Mapping Network Drives

    Using this example from the Wiki page:

    Code:
    On Error Resume next
    Dim WshNetwork
     
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    Set objSysInfo = CreateObject("ADSystemInfo")
    Set objNetwork = CreateObject("Wscript.Network")
     
    strUserPath = "LDAP://" & objSysInfo.UserName
    Set objUser = GetObject(strUserPath)
     
    WshNetwork.RemoveNetworkDrive "H:"
    WshNetwork.RemoveNetworkDrive "I:"
    WshNetwork.RemoveNetworkDrive "J:"
    WshNetwork.RemoveNetworkDrive "K:"
    WshNetwork.RemoveNetworkDrive "L:"
    WshNetwork.RemoveNetworkDrive "M:"
    WshNetwork.RemoveNetworkDrive "O:"
    WshNetwork.RemoveNetworkDrive "P:"
    WshNetwork.RemoveNetworkDrive "Q:"
    WshNetwork.RemoveNetworkDrive "R:"
    WshNetwork.RemoveNetworkDrive "S:"
    WshNetwork.RemoveNetworkDrive "T:"
    WshNetwork.RemoveNetworkDrive "U:"
    WshNetwork.RemoveNetworkDrive "V:"
    WshNetwork.RemoveNetworkDrive "W:"
    WshNetwork.RemoveNetworkDrive "X:"
    WshNetwork.RemoveNetworkDrive "Y:"
    WshNetwork.RemoveNetworkDrive "Z:"
     
    For Each strGroup in objUser.MemberOf
     strGroupPath = "LDAP://" & strGroup
     Set objGroup = GetObject(strGroupPath)
     strGroupName = objGroup.CN
     
     Select Case strGroupName
     
     
     Case "AD GROUP NAME1"
     	objNetwork.MapNetworkDrive "S:", "\\server\share$"
     
     Case "AD GROUP NAME2"
     	objNetwork.MapNetworkDrive "T:", "\\server\share$"
     
     End Select
    Next
    How would one map a network drive so that it remains hidden but still accessbible except from My Computer. Any ideas?

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    This will do the job, this is what we use.

    Using Group Policy Objects to hide specified drives

    Instead of using all that VBS code you can use a batch file

    Code:
    net use * /d /y
    net use s: "\\sevrer\share"
    net use t: "\\server\share"
    or instead of using all that code to disconnect all those drives you can use this VBS code, providing your home drive letter is T, you can alter it though

    Code:
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ':::   Disconnect network drives left from previous login   :::
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    on error resume next
    
    Set objNetwork = CreateObject("Wscript.Network")
    
    For intLoop = Asc ("A:") To Asc ("s:")
    	objNetwork.RemoveNetworkDrive  Chr (intLoop) & ":", TRUE, TRUE
    Next
    For intLoop = Asc ("U:") To Asc ("Z:")
    	objNetwork.RemoveNetworkDrive  Chr (intLoop) & ":", TRUE, TRUE
    Next
    Wscript.Quit
    for you it will go

    Code:
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ':::   Disconnect network drives left from previous login   :::
    '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    on error resume next
    
    Set objNetwork = CreateObject("Wscript.Network")
    
    For intLoop = Asc ("H:") To Asc ("Z:")
    	objNetwork.RemoveNetworkDrive  Chr (intLoop) & ":", TRUE, TRUE
    Next
    Wscript.Quit
    You will need to take out
    Wscript.Quit
    if you are putting it into another script.
    Last edited by FN-GM; 21st August 2008 at 01:23 PM. Reason: Error in VBS

  3. #3

    Join Date
    Jun 2008
    Posts
    718
    Thank Post
    118
    Thanked 64 Times in 52 Posts
    Rep Power
    31
    Ooo, that's an interesting one. I will save that for later use.

    However, what I was after was to map a network, e.g. K: and have it hidden, i.e. not viewable in My Computer or any other place. But can be accessed, say, from MS Word --> File --> Open and the corresponding drive letter typed in to show you what's on there.

    The reason why I want it this way is to give Google Earth a place to write its cache files and whatnot rather than on the C drive of every computer. Also, I don't want people to be able to view the files but can write to it.

    I hope that makes sense.

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    the link in my previous post will allow this - Using Group Policy Objects to hide specified drives

    We use this to hide the sims drive.

    z

  5. #5

    Join Date
    Jun 2008
    Posts
    718
    Thank Post
    118
    Thanked 64 Times in 52 Posts
    Rep Power
    31
    Quote Originally Posted by FN-Greatermanchester View Post
    the link in my previous post will allow this - Using Group Policy Objects to hide specified drives

    We use this to hide the sims drive.

    z
    It seems like I would need to create my own binary numerical values.

    What would the binary number be for drive letters E, which is our SIMS drive, and drive letter Z, which is going to be where Google Earth can write to?

  6. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    i Think it is

    1100100
    Last edited by FN-GM; 21st August 2008 at 02:11 PM.

  7. #7
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    427
    Thank Post
    68
    Thanked 90 Times in 75 Posts
    Rep Power
    61
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Policies\Explorer]
    "NoDrives"=dword:00800000

    this hides my X: drive

    this page will give you the values

    Hide Drives in My Computer at Registry Guide for Windows

    E: 16 + Z: 33554432 = 33554448 = (n hex) 2000010





    BoX
    Last edited by box_l; 21st August 2008 at 02:16 PM.

  8. #8
    originofsymmetry's Avatar
    Join Date
    Jun 2007
    Posts
    186
    Thank Post
    9
    Thanked 14 Times in 11 Posts
    Rep Power
    17
    I use Hidecalc: HideCalc - A Tool for Hiding Drive

    Creates a custom .ADM Template with the drives you request hidden.

    When using it however, remove any of the standard windows group policies for hiding drives as confusion occurs.

  9. #9

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    Just to add i don't think any of those methods work for vista.

  10. #10
    originofsymmetry's Avatar
    Join Date
    Jun 2007
    Posts
    186
    Thank Post
    9
    Thanked 14 Times in 11 Posts
    Rep Power
    17
    Quote Originally Posted by FN-Greatermanchester View Post
    Just to add i don't think any of those methods work for vista.
    I've tried Hidecalc on Vista and it worked fine

  11. #11

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    ah right thats good then.

    This is another nice little feature server 2008 has, makes life much more simple

SHARE:
+ Post New Thread

Similar Threads

  1. Mapping local drives (not network drives)
    By Pyroman in forum How do you do....it?
    Replies: 4
    Last Post: 11th June 2008, 03:19 PM
  2. Replies: 8
    Last Post: 7th May 2008, 02:00 PM
  3. mapping drives
    By rjsmith in forum *nix
    Replies: 2
    Last Post: 14th November 2007, 05:42 PM
  4. mapping drives
    By chrbb in forum Wireless Networks
    Replies: 3
    Last Post: 3rd November 2007, 03:18 PM
  5. Mapping Network Drives ?
    By mac_shinobi in forum Scripts
    Replies: 9
    Last Post: 8th March 2007, 03:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •