Mapping Accessible Network Shares via Powershell

Microsoft Windows
Post Reply
ProgrammerHumorx
Posts: 1
Joined: 2023-Feb-22, 5:28 pm

Mapping Accessible Network Shares via Powershell

Post by ProgrammerHumorx »

I have written the following script: line 1: cmdkey /add:pcname /user:network\username /pass:password
line 2: New-PSDrive -Name "E" -Root "\\vm-beta\ShareOne" -Persist -PSProvider "FileSystem".

I want to rewrite this script in that once the login credentials to the NAS have been entered into and saved in Credential Manager, only the network shares that the given user has access to (On the NAS) will be mapped in Windows Explorer instead of having to manually type in those network shares in the script.

Is this doable in Powershell?
User avatar
Simon Sheppard
Posts: 190
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Mapping Accessible Network Shares via Powershell

Post by Simon Sheppard »

There isn't quite enough info in your question to give much advice, it really depends how you have structured all the file shares.

If you turn on Access-based Enumeration then you can just map one level and the sub folders will automatically appear if the user has permission to them.
Post Reply