We have a network share over vpn to a windows server in a different city. each person has a username to access the folder (and only that specific folder) his/her folder is same as username. user os is win 10
usr: john_smith; pw: 1234
I'm trying to make a script that will ask for user credentials to map the drive and then based on the credentials to know that after the ip his folder is same as usernamer, automatically adding the folder name to path.
New-PSDrive -Name P -PSProvider FileSystem -Root \\192.168.1.1\ -Credential domain\user
New-PSDrive dose not help me because, again, user has access rights only to his/her folder, any other root folder is unavailable.