This function requires PowerShell 2.0 and utilizes the Wscript.Network COM object to enumerate the locally mapped network drives. The output of the Wscipt.Network COM object is a collection of strings. This function takes those strings and converts it into objects.

 This script file contains a function, in order to be able to use this function should be dot sourced first. To dot source this script use the following code:

 

PowerShell
Edit|Remove
. .\Get-MappedDrive.ps1
 
Version 1.0 - Initial Upload
PowerShell
Edit|Remove
<# 
.SYNOPSIS    
This function will return the mapped network drives 
     
.DESCRIPTION  
This function requires PowerShell 2.0 and utilizes the Wscript.Network COM object to enumerate the 
locally mapped network drives. The output of the Wscipt.Network COM object is a collection of strings. 
This function takes those strings and converts it into objects. 
 
.NOTES    
Name:        Get-MappedDrive 
Author:      Jaap Brasser 
DateCreated: 2014-07-22 
Version:     1.0 
DateUpdated: - 
 
.LINK 
http://www.jaapbrasser.com 
 
.EXAMPLE    
Get-MappedDrive 
 
Description  
-----------      
Returns the mapped network drives as objects. The output is separated in two properties: LocalPath and NetworkPath. 
#>