Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Map network drive using saved DPAPI password

Posted on 2015-01-14
2
Medium Priority
?
455 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 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