Map Network Drive Based on Usershared drive attribute.

Hi, Guys, Would you be able to help me to create a script to map a network drive based on file share mapped on usershareddrive attribute in AD. Any idea would be helpful. I am not sure if this can be done via GPO. Thanks in advance.

Can we see your code. You will need to capture the username, look it up in AD and … Lets see some code. This would be done via GPO or make it part of your login script.

Here is what I was trying to but seems not getting it properly. I would then use it as logon script.

$share=Get-ADUser -Identity $env:USERNAME -Properties * |select userSharedFolder

New-PSDrive -Name G -PSProvider FileSystem -Root “$share”

$share=Get-ADUser -Identity $env:USERNAME -Properties * |select userSharedFolder

New-PSDrive -Name G -PSProvider FileSystem -Root $share.userSharedFolder -Persist

Tried this one now, seems its happening, but cant see the drive in windows explorer.

This worked for:
$shared = (get-aduser -Identity $env:USERNAME -Properties *).HomeDirectory
new-psdrive -Name G -PSProvider FileSystem -Root $shared

No need to use Quotation marks in “$share”

Yeah you are right mate. But the problem is the script will run on win 7 clients. Now not all of them would have AD module installed. Do you think we can run it there somehow. I am thinking of using invoke command to some server where ad moudle would be there. Or if you have some other idea.

You can always import the modules from another computer