1

We are in the middle of migration to One Drive and during that process we had added a generic account as Secondary owner on each one drive account .But when i am trying to remove that account i am getting the error that the URL is not properly formed .My Code is below

$objCreds = Get-Credential

Connect-SPOService -Url "https://tenant-admin.sharepoint.com" -credential $objCreds

$SiteUrl = Get-SPOSite -Identity https://tenant-my.sharepoint.com/personal/XXXX/

Remove-SPOUser -Site $SiteUrl -loginname "migration@test.com" 

The error i am getting is below .I am sure its not with the URL because i added the user to the site using the URL

enter image description here

0

Finally i had used my Set-SPOUser command only to remove the Site Collection Admin Its a small change but i hope it will be helpful for someone .

Set-SPOUser -Site "https://teanant-my.sharepoint.com/personal/****/" -LoginName "******" -IsSiteCollectionAdmin $false
0

If your Site URL ends with / ,then Get-SPOSite is tend to error as "URL is not properly formed".Remove the / at the end of the URL and execute the script.This worked for me. So your script should look like:

$objCreds = Get-Credential
Connect-SPOService -Url "https://tenant-admin.sharepoint.com" -credential $objCreds
$SiteUrl = Get-SPOSite -Identity https://tenant-my.sharepoint.com/personal/XXXX
Remove-SPOUser -Site $SiteUrl -loginname "migration@test.com"

FYR: http://www.tcsc.com/get-sposite-site-not-properly-formed/#comment-261431

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.