Script Onedrive For Business

I have an onedrive for business script that basically copies one onedrive to another.

But it has been presenting some errors, could you post this script for someone to help me?

I think it’s simple.

You’re going to have to be more specific. If you have the script already, you should post it so that we can look at it. What errors are you receiving?

Hi, how are you? I can share the file.

I have already installed the sharepoint shell and sharepoint pnp installed.

The script is on this site.
Where I’m following the step by step.

I am logging in via PowerISE

https://gcits.com/knowledge-base/transfer-users-onedrive-files-another-user-via-powershell/

The error is occurring after I enter the initial data

 

Connecting to SharePoint Online

Adding rods@xxx.onmicrosoft.com as site collection admin on both OneDrive site collections
Set-SPOUser : Arquivo Não Encontrado.
No C:\Users\xxx\Desktop\Script-PW.ps1:21 caractere:1

  • Set-SPOUser -Site $departingOneDriveSite -LoginName $globaladmin -IsS …
  • CategoryInfo : NotSpecified: (:slight_smile: [Set-SPOUser], ServerException
  • FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

Set-SPOUser : Arquivo Não Encontrado.
No C:\Users\xxx\Desktop\Script-PW.ps1:22 caractere:1

  • Set-SPOUser -Site $destinationOneDriveSite -LoginName $globaladmin -I …
  • CategoryInfo : NotSpecified: (:slight_smile: [Set-SPOUser], ServerException
  • FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

Connecting to rods@xxx.onmicrosoft.com’s OneDrive via SharePoint Online PNP module
Connect-PnPOnline : O servidor remoto retornou um erro: (404) Não Localizado.
No C:\Users\xxx\Desktop\Script-PW.ps1:26 caractere:1

  • Connect-PnPOnline -Url $departingOneDriveSite -Credentials $credentia …
  • CategoryInfo : NotSpecified: (:slight_smile: [Connect-PnPOnline], WebException
  • FullyQualifiedErrorId : System.Net.WebException,SharePointPnP.PowerShell.Commands.Base.ConnectOnline

Getting display name of rods@xxx.onmicrosoft.com
Get-PnPSiteCollectionAdmin : No connection, please connect first with Connect-PnPOnline
No C:\Users\xxx\Desktop\Script-PW.ps1:30 caractere:19

  • $departingOwner = Get-PnPSiteCollectionAdmin | Where-Object {$_.login …
  • CategoryInfo : NotSpecified: (:slight_smile: [Get-PnPSiteCollectionAdmin], InvalidOperationException
  • FullyQualifiedErrorId : System.InvalidOperationException,SharePointPnP.PowerShell.Commands.Site.GetSiteCollectionAdmin

Getting all items from Departing User
Get-PnPListItem : No connection, please connect first with Connect-PnPOnline
No C:\Users\xxx\Desktop\Script-PW.ps1:46 caractere:10

  • $items = Get-PnPListItem -List Documents -PageSize 1000
  • CategoryInfo : NotSpecified: (:slight_smile: [Get-PnPListItem], InvalidOperationException
  • FullyQualifiedErrorId : System.InvalidOperationException,SharePointPnP.PowerShell.Commands.Lists.GetListItem

Connecting to ale@xxx.onmicrosoft.com via SharePoint PNP PowerShell module
Connect-PnPOnline : O servidor remoto retornou um erro: (404) Não Localizado.
No C:\Users\xxx\Desktop\Script-PW.ps1:62 caractere:1

  • Connect-PnPOnline -Url $destinationOneDriveSite -Credentials $credent …
  • CategoryInfo : NotSpecified: (:slight_smile: [Connect-PnPOnline], WebException
  • FullyQualifiedErrorId : System.Net.WebException,SharePointPnP.PowerShell.Commands.Base.ConnectOnline

Filter by folders

Creating Directory Structure

Copying Files

Removing rods@xxx.onmicrosoft.com from OneDrive site collections
Set-SPOUser : Arquivo Não Encontrado.
No C:\Users\rodrigo.balista\Desktop\Script-PW.ps1:90 caractere:1

  • Set-SPOUser -Site $departingOneDriveSite -LoginName $globaladmin -IsS …
  • CategoryInfo : NotSpecified: (:slight_smile: [Set-SPOUser], ServerException
  • FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

Set-SPOUser : Arquivo Não Encontrado.
No C:\Users\xxx\Desktop\Script-PW.ps1:91 caractere:1

  • Set-SPOUser -Site $destinationOneDriveSite -LoginName $globaladmin -I …
  • CategoryInfo : NotSpecified: (:slight_smile: [Set-SPOUser], ServerException
  • FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

 

grokkit I sent the errors that are presenting but I think the message is still to be approved by the moderator.

But the script is this.

https://gcits.com/knowledge-base/transfer-users-onedrive-files-another-user-via-powershell/