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
Solved

Map network drive using saved DPAPI password

Posted on 2015-01-14
2
365 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

839 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