Map a network share based on varibles

Home Forums Scripting General Scripting Map a network share based on varibles

This topic contains 2 replies, has 3 voices, and was last updated by JeremyW JeremyW 3 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Avatar

    Hello everyone,
    I am new to the community, I recently stumbled on this sire while looking for good reliable resources using widows server. I found your scripting section and thought I might see if anyone would be able to help with and idea i had.
    Basically I want to create a script to map a network share, but the thing that makes it complex is that I want the script to prompt for windows credenitals when run and then based on the username entered the specific folder is mapped. But it cannot map based on the local user logged in. It needs to be other credentials because the user logged in will only be accessing their files
    To be more clear I need to map the network share for a specific user but the script to ask the user name first because everyone has their own personal share and the location is different for everyone.

    Example :

    1. user runs script;
    2. dialouge box asks for username (Student1)
    3. script then amps share based on username entered (\servershareusername “from step 2”
    4. Windows prompts for credentials for access to their folder.

    I appreciate any help that can be given with this idea. I honestly don’t care what language it is in. As long as it performs.

    Thanks again, I look forward to seeing what ideas people have.


    Wouldn’t it be easier to set the Home Folder path in AD?


    I assume this is for someone to access other users’ folders?
    Here’s a quick Powershell script to do it:

    $creds = Get-Credential
    $driveLetter = “x”

    New-PSDrive -Name $driveLetter -PSProvider FileSystem -Credential $creds -Root “servershare$($creds.UserName)”[/CODE][CODE]$creds = Get-Credential
    $driveLetter = “x”

    New-PSDrive -Name $driveLetter -PSProvider FileSystem -Credential $creds -Root “servershare$($creds.UserName)”[/CODE]

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.