Solved

Map network drive using saved DPAPI password

Posted on 2015-01-14
2
332 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
Comment Utility
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
Comment Utility
BTW: The mapped drive is only available within PowerShell. It doesn't show up in DOS\Windows.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Why would I want to create a function for tracking messages? I am glad you asked. As with most monotonous/routine tasks, human error tends to creep in after doing the same task over and over again. By creating a function, you load the function once…
The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

9 Experts available now in Live!

Get 1:1 Help Now