Solved

Map network drive using saved DPAPI password

Posted on 2015-01-14
2
383 Views
Last Modified: 2015-01-15
Hi,

I need to map a network drive in a workgroup environment to a secure NAS share without using a plain text password.

I'm using a powershell script to create the password in DPAPI and output to a txt file.  I now need to map the network drive using the stored DPAPI password.
My powershell script so far is as follows:

# Prompt the user to enter a password
$secureString = Read-Host -AsSecureString "Enter a secret password"

$secureString | ConvertFrom-SecureString | Out-File .\storedPassword.txt
0
Comment
Question by:Ace-IT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
Ace-IT earned 0 total points
ID: 40552724
I figured it out myself.  Syntax as follows to map an L: Drive to a NAS network path with the NAS "users" account.

#create secure password file
$secureString = Read-Host -AsSecureString "Enter a secret password"
$secureString | ConvertFrom-SecureString | Out-File c:\scripts\pass.txt
#map drive
$password = get-content c:\scripts\pass.txt | convertto-securestring
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist "users",$password
New-PSDrive –Name “L” –PSProvider FileSystem –Root “\\nas01\users” -credential $credentials –Persist
0
 
LVL 1

Author Comment

by:Ace-IT
ID: 40552756
BTW: The mapped drive is only available within PowerShell. It doesn't show up in DOS\Windows.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
A brief introduction to what I consider to be the best editor for PowerShell.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question