Solved

Map network drive using saved DPAPI password

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now