Published: 2017.11.19
Category: PowerShell
Get-OneDriveDirectory
Get-OneDriveDirectory returns location of the OneDrive files.
We could have on the computer two OneDrive’s one Personal and second one Corporate (Business). Script by default returns both, but we could use switch parameter to precise our request.
To return directory path module searches through registry.
Get-OneDriveDirectory Get-OneDriveDirectory -Personal Get-OneDriveDirectory -Business Get-OneDriveDirectory -Personal -JustDirectory Get-OneDriveDirectory -Business -JustDirectory Get-OneDriveDirectory -JustDirectory

Information about OneDrive accounts is stored in
HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts
Under this location we could have two items:
- Personal
- Business
Each account has registry string value (UserFolder) which tells us what is the location of particular OneDrive.
