PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

Geek Sync Live

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.


As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Mapping Network Drives (Part 3)

If you migrated from VBScript to PowerShell, you may remember how VBScript mapped network drives. This option is still available in PowerShell.

$helper = New-Object -ComObject WScript.Network

$helper.MapNetworkDrive('O:','\\dc-01\somefolder',$true) 
$helper.EnumNetworkDrives()

Test-Path -Path O:\
explorer.exe O:\
Get-PSDrive -Name O


$helper.RemoveNetworkDrive('O:', $true, $true) 

If you want to log on with alternate credentials, try this overload instead:

$helper.MapNetworkDrive('O:','\\dc-01\somefolder',$true, 'training\user02', 'topSecret') 

Twitter This Tip! ReTweet this Tip!

Copyright 2012 PowerShell.com. All rights reserved.