Forum Discussion

jamestocknell's avatar
jamestocknell
Copper Contributor
Jan 28, 2026

Check (and modify) network drive mappings as an admin for other users

It does not appear that admins can check/modify a user's network drive mappings (e.g. from `\\server\shares` to a drive letter) via powershell? The various `Smb-` commands seem to be per user, and as far as I can tell, there is no way to run a powershell command as a different user without using their credentials (which seems to be poor security hygiene to ask users for their passwords), even if you are an admin. Am I missing something, or is this not possible?

In case it helps clarify things, what I am asking about is the Windows equivalent to `sudo -u some_user some_command`. 

4 Replies

  • Noreen's avatar
    Noreen
    Iron Contributor

    The RunAs cmdlet can be used to run a command with alternate credentials, but it requires the user to enter their own credentials, which is not what you're looking for.

  • Leroy95's avatar
    Leroy95
    Brass Contributor

    You're correct in observing that managing other users' network drive mappings directly via PowerShell or standard admin commands isn't straightforward. Network drive mappings are stored in each user's profile, specifically in their user registry hive, and are generally session-specific. Because of security and session isolation, an administrator cannot directly modify another user's drive mappings without their credentials, and PowerShell commands like New-PSDrive or net use typically run in the context of the current user session.

  • Matthiasar's avatar
    Matthiasar
    Iron Contributor

    As an administrator, you cannot directly modify another user's network drive mappings via PowerShell without their credentials.

  • Kamrynim's avatar
    Kamrynim
    Iron Contributor

    Network drive mappings created with New-PSDrive or net use are stored within a user's session. These mappings are not system-wide and are tied to the user's logon session, which makes them difficult for an administrator to modify directly without impersonating that user.