Share via

How to map network shared drive when server is NOT network joined.

Michael Knichel 60 Reputation points
2026-05-21T10:54:59.98+00:00

We have a server that is NOT network joined, just a file server. Our endpoints are AzureAD joined and using Intune. I see all the posts on mounting a network drive where the server IS network joined. Can this be done with a script from Azure? I don't mind mounting the share using a single user credential for everyone. There are only about 8 people in an ORG with 200 employees that need this.

TIA,

M

Microsoft Security | Intune | Other

2 answers

Sort by: Most helpful
  1. Michael Knichel 60 Reputation points
    2026-05-28T11:27:19.7033333+00:00

    Thanks for the info. However, this works when run manually, but not via Intune. It displays the drive with a red X over it. Opening the drive prompts for credentials. Not what I wanted...

    MK

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-05-21T10:55:16.4333333+00:00

    Yes. For Azure AD–joined devices managed by Intune, a non-domain-joined file server can still be mapped as a network drive by using a common local account on the server and deploying a script or configuration via Intune.

    Key points and options:

    1. Basic requirement
    • The file server must expose an SMB share and be reachable over the network (IP or DNS name).
    • A local account on the server (for example, filesvc) with permissions on the share will be used by all 8 users.
    1. Map the share with net use and explicit credentials Use a script that runs in the user context on each Azure AD–joined device, for example:
    net use Z: \\FILESERVER\ShareName /user:FILESERVER\filesvc P@ssw0rd /persistent:yes
    

    Notes:

    • FILESERVER is the server’s NetBIOS name or IP.
    • filesvc is a local account on the server.
    • /persistent:yes reconnects at logon.
    1. Deploy via Intune (PowerShell script)
    • Create a PowerShell script in Intune that runs in the user context and calls net use:
    $driveLetter = 'Z:'
    $sharePath   = '\\FILESERVER\ShareName'
    $username    = 'FILESERVER\filesvc'
    $password    = 'P@ssw0rd'
    
    # Remove existing mapping if present
    if (Get-PSDrive -Name $driveLetter.TrimEnd(':') -ErrorAction SilentlyContinue) {
        net use $driveLetter /delete /y
    }
    
    net use $driveLetter $sharePath /user:$username $password /persistent:yes
    
    • Assign the script to the Azure AD user group that contains the 8 users.
    1. Alternative: Map without a fixed drive letter Some apps work better with UNC paths. You can also map without a fixed letter:
    net use * \\FILESERVER\ShareName /user:FILESERVER\filesvc P@ssw0rd
    
    1. Security considerations
    • A single shared credential is simple but less secure and not auditable per user.
    • Store credentials securely (for example, using Intune’s script obfuscation and limiting script assignment only to the required users). Avoid hard-coding passwords in scripts where possible.
    1. If the server were Azure Files instead of a physical file server
    • Azure Files supports mapping via net use from Azure AD–joined devices using identity-based authentication or storage account keys. The same net use approach applies, but the UNC path would be:
    net use Z: \\<YourStorageAccountName>.file.core.windows.net\<FileShareName>
    

    with credentials as described in the Azure Files documentation.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.