Mapped Drive with Encrypted Password

Mapped Drive with Encrypted Password

Sometimes there is the need to create a mapped drive but you want to use an encrypted password for security reasons, this will work for you. First

Changing PWDLASTSET in Active Directory
Fixing Domain Trust Relationships!
IP Address Geo-Location

Sometimes there is the need to create a mapped drive but you want to use an encrypted password for security reasons, this will work for you.

First you need to create an encrypted password file with these commands: (Yes type in the password at **enter your password** before you execute the command)

$File = “c:\temp\password.txt”
$Password = “**enter your password**” | ConvertTo-SecureString -AsPlainText -Force
$Password | ConvertFrom-SecureString | Out-File $File

Second, these are the commands to run to create the mapped drive, in this example I mapped the “S” drive to location “\\192.168.10.10\SQLBackups”:

$encrypted = Get-Content c:\temp\password.txt | ConvertTo-SecureString
$credential = New-Object System.Management.Automation.PsCredential(“asmlan\svcpsscripts”, $encrypted)
New-PSDrive -name “S” -PSProvider FileSystem -Root “\\10.20.0.61\SQLBackups” -Persist -Credential $credential

COMMENTS

WORDPRESS: 0