How to hide the full path for mapped drive in Windows Explorer (VBScript)

Introduction

This VBScript shows how to hide the full path for mapped drive in Windows Explorer.

Scenarios

This script needs to hide the full path of the mapped drive. In a network environment, administrator wants to map a drive, but don't want to show the directory for security.

Script

Step 1: Double click the script and it will hidden the mapped network drives' full path.

 

Here are some code snippets for your references.

VBS
Edit|Remove
For Each objItem in colItems 
    sDrive =  objItem.Name 
    oShell.NameSpace(sDrive).Self.Name = "MappedDrive"
    WScript.StdOut.WriteLine "Hidden " & objItem.Name & "(" & objItem.ProviderName & ") successfully"
Next

Prerequisite

Windows Server 2008 or higher version

 

Microsoft All-In-One Script Framework is an automation script sample library for IT Professionals. The key value that All-In-One Script Framework is trying to deliver is Scenario-Focused Script Samples driven by IT Pros' real-world pains and needs. The team is monitoring all TechNet forums, IT Pros' support calls to Microsoft, and script requests submitted to TechNet Script Repository. We collect frequently asked IT scenarios, and create script samples to automate the tasks and save some time for IT Pros. The team of All-In-One Script Framework sincerely hope that these customer-driven automation script samples can help our IT community in this script-centric move.