Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

how to create mapped network drive in PowerShell (Running as an administrator)

$
0
0

Hi

Using Windows Server 2012 R2 with Powershell 5 installed.

Running PowerShell in a Non Elevated shell i cant run:

New-PSDrive -Name g -PSProvider FileSystem -Root "\\vm01\share" -Credential $cred -Persist 

A network share is now visible in windows explorer.

Problem:

I need to create the share in an elevated powershell (Run As administrator) and still be able to access the share though windows explorer. How do i do this?

The problem is that Windows explorer is run as non-elevated.
I know that Non-elevated and Elevated use 2 different tokens.

It hought ablout EnableLinkedConnections. But setting this did nothing:

New-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLinkedConnections -Value 1 –Force

Any tips on how i can solve this using an elevated powershell window?

brgs

Bjørn


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>