Skip to main content
Get OneDrive URL
Updated over 2 weeks ago

Command

Get-OneDriveURL

Description

The command to get a user's OneDrive URL, or provision the URL so it can be migrated to.

Note: It can take up to 24 hours for a OneDrive to be provisioned in Microsoft 365.

Examples

Get URL for a single user's existing OneDrive site using browser authentication.

$tenant = Connect-Site -Url "https://mytenant-admin.sharepoint.com" -Browser
Get-OneDriveUrl -Tenant $tenant -Email [email protected]

Send a provisioning request for a user's OneDrive site and wait for the response.

$tenant = Connect-Site -Url "https://mytenant-admin.sharepoint.com" -Browser
Get-OneDriveUrl -Tenant $tenant -Email [email protected] -ProvisionIfRequired

Send a provisioning request for a user's OneDrive site and do not wait for the response.

$tenant = Connect-Site -Url "https://mytenant-admin.sharepoint.com" -Browser
Get-OneDriveUrl -Tenant $tenant -Email [email protected] -ProvisionIfRequired -DoNotWaitForProvisioning

Send provisioning requests for multiple users from a CSV file.

This will be much quicker than waiting on each result. You can then rerun the same command once the OneDrive sites have been provisioned and you will have all the URLs.

$tenant = Connect-Site -Url "https://mytenant-admin.sharepoint.com" -Browser
$csvFile = "C:\CSVfile.csv"
$table = Import-Csv $csvFile -Delimiter ","
foreach ($row in $table) {
Get-OneDriveUrl -Tenant $tenant -Email $row.Email -ProvisionIfRequired -DoNotWaitForProvisioning
}

Note: You need a CSV file with a row titled Email and all your users' email addresses underneath. Modify "c:\CSVfile.csv" to match its location.

Syntax

Get-OneDriveUrl-Email <String> 
-Tenant <Site>
[-ProvisionIfRequired <SwitchParameter>] 
[-DoNotWaitForProvisioning <SwitchParameter>]

Parameters

-DoNotWaitForProvisioning <SwitchParameter>

Skip waiting for the completion of the provisioning.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Email <String>

Specifies the user's email address.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-ProvisionIfRequired <SwitchParameter>

Provision the user's one drive if it has not already been provisioned.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Tenant <Site>

Specifies the SharePoint admin center site.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue, ByPropertyName)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Note: The URL of the provisioned OneDrive site if already available or if the ProvisionIfRequired and WaitOnProvision flags are set.

Did this answer your question?