Saturday, September 26, 2009

A problem that I often have is trying to get the UNC path for a mapped drive so that I can pass it to somebody or that they can pass the UNC path to me. My ideal solution would be to execute a command passing the drive letter as an argument and having the UNC path copied to the clipboard so that I can then paste the UNC path in an email or instant message, so I wrote the following script using PowerShell and the PowerShell community extensions (PSCX).

If you don't already have them installed install the following:

Then save my script to a folder on your computer and run it as follows

.\DrivePath z

Where 'z' is the drive letter for the mapped drive, the UNC path will then be on your clipboard and you can then paste it wherever you like.

param(
    [Parameter(position=0, Mandatory=$true)]
    [string] $Drive = "Z:"
)

# ensure the supplied param ends with ':' 
$Drive = $Drive.ToUpper().ToCharArray()[0] + ":"

$logicalDisk = Gwmi Win32_LogicalDisk -filter "DriveType = 4 AND DeviceID = '$Drive'"

out-clipboard $logicalDisk.ProviderName

 

Download script: DrivePath.zip

posted on Saturday, September 26, 2009 10:27:29 PM (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [0]
 Wednesday, September 02, 2009

IEEE Career Watch is running with an article that talks about the most sought after skills at the moment and it looks good for .NET developer as Microsoft .NET and Ajax are some of the hottest skills at the moment. With the Microsoft Certified Solutions Developer carrying the highest pay premium for developer certificates. Check out the full report here.

posted on Wednesday, September 02, 2009 6:19:51 PM (GMT Standard Time, UTC+00:00)  #    Add Comment | Comments [0]