Apply a Drive Letter to OneDrive Folder

Vince DiNenna 20 Reputation points


This is the Scenario:

Company is moving away from Home folders on Windows file server to each user having a Home folder in business OneDrive.

A portion of the company needs to save files back to their desktop via a drive letter as this is what the RDP session and virtual application requires.

The existing Home drive is H: and would like to use H: letter again for the new Home folder in OneDrive.

Original H: comes from Default Domain Policy.

New H: comes from a new GPO at the OU level.

What I have tried:

  1. GPO to Drive Maps delete H:
  2. Same GPO to Drive Maps to create H:, Path: \localhost\users%username%\OneDrive - CompanyName\Home. Tried with and without quotes around UNC path. Also used F3 to get syntax for ComputerName and LogOnUser. I did not enforce at OU level. Trying to avoid enforcing the GPO.

The above with and without Common Option to Run in logged-on user's security context (user policy option) and with and without Item-Level targeting "username".

In user's BAT file, net use H: /delete, followed by net use H: \localhost\users%username%\OneDrive - CompanyName\Home.

Tried a Network Location share, but RDP needs a drive letter.

All the above works for me (domain admin), but not for other users and another domain admin.

What I'm thinking is I shared the new OneDrive Home folder to myself at some point and it's allowing me to map the H: drive to OneDrive. Also ran on two laptops without sharing OneDrive Home folder and also created a test user that is only a domain user in AD. Still works. Any ideas how to get this to work? Also, if there is a better way to have an RDP session and virtual app save to OneDrive, I'm all ears. If I can share any info that will help, please ask.



Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,586 questions
A Microsoft file hosting and synchronization service.
801 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,091 questions
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,566 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,110 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 31,571 Reputation points

    Can you use subst?

    C:\>subst /?
    Associates a path with a drive letter.
    SUBST [drive1: [drive2:]path]
    SUBST drive1: /D
      drive1:        Specifies a virtual drive to which you want to assign a path.
      [drive2:]path  Specifies a physical drive and path you want to assign to
                     a virtual drive.
      /D             Deletes a substituted (virtual) drive.
    Type SUBST with no parameters to display a list of current virtual drives.

    Maybe like this.

    subst H: "c:\users\%username%\OneDrive - CompanyName\Home"

0 additional answers

Sort by: Most helpful