Share via


NEW-PSDRIVE - Active Directory Persistence

Question

Wednesday, March 9, 2016 12:09 PM

Hi 

I'm trying to set up new PSDrives on my local machine so that I can administer remote domains without having to log on to the various serves in those domains.

I have used the following command to create the drive, it works and I have no issues.

*New-PSDrive -Name remotedomain -PSProvider ActiveDirectory -Server "192.168.0.1" -Credential (Get-Credential "domain\administrator") -Root "//RootDSE/" -Scope Global *

The issue I have is that when I shut down by powershell session those newley created PSdrive are gone.  I've tried using the           -persist option but that gives me the following message:

New-PSDrive : When you use the Persist parameter, the root must be a file system location on a remote computer.

How would I get them to stay put when I close my powershell session.

All replies (4)

Wednesday, March 9, 2016 12:52 PM ✅Answered

You can modify your PS profile, so that way every time you start a session it will automatically run and map the drive for you.

http://www.howtogeek.com/50236/customizing-your-powershell-profile/

If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.


Wednesday, March 9, 2016 12:55 PM ✅Answered

Hi,

Since the -Persist switch isn't available, you could put the commands into your profile. This will automatically recreate them each time you open the console (be aware that this means every time).


Wednesday, March 9, 2016 2:48 PM

Great will give that a go. 


Wednesday, March 9, 2016 2:49 PM

Will give that a go, thanks for the reply.