Page 1 of 1

Mapping Accessible Network Shares via Powershell

Posted: 2023-Feb-22, 5:34 pm
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?

Re: Mapping Accessible Network Shares via Powershell

Posted: 2023-Mar-03, 10:59 pm
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.