I have a script that adds a user or group to everyone one drive for business. The input file has a list of users that the script run against. Below is the set-spouser command.

Set-SPOUser -Site $fullsitepath -LoginName $Group -IsSiteCollectionAdmin $true -ErrorAction Continue 


Set-SPOUser -Site "https://testuser.test.com/personal/testuser_test_com" -LoginName "c:0t.c|tenant|groupnamexxxxx" -IsSiteCollectionAdmin $true -ErrorAction Continue

However, the script stops running when it hit an invalid one drive or doesn't the URL. I have added ErrorAction Continue, ErrorAction Ignore, ErrorAction Continue SilentlyContinue but it still giving the error. How do I make it the script to continue to run and ignore if the URL or the one drive doesn't exist?

Set-SPOUser : File Not Found. At line:1 char:1 + Set-SPOUser -Site "https://testuser.test.com/personal/testuser... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-SPOUser], ServerException + FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

Your Answer

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

Browse other questions tagged or ask your own question.