העברת קבצים מחשבון Microsoft OneDrive שלך למשתמש אחר קלה במובן זה שאתה יכול להוריד את התוכן מה-OneDrive שלך, ואז להעלות אותם ידנית לחשבון האחר. בפוסט זה נראה לכם כיצד לעשות זאת להעביר קבצי OneDrive למשתמש אחר באמצעות PowerShell .
כיצד ליצור צילום מסך לקישור
דברים שיש לקחת בחשבון
כשזה מגיע להעלאת קבצים מה-OneDrive שלך לחשבון אחר, זו משימה שתיקח קצת זמן מכיוון שלא ניתן בשלב זה להעלות קבצים גדולים מ-250MB. החדשות הטובות הן ש- PowerShell ירשום את כל הקבצים שהיא לא יכולה להעלות, כך שתוכל לחפש אותם ולשתף אותם בשיטה הרגילה.
לפני העלאת הקבצים לחשבון OneDrive האחר, הקבצים יורדו תחילה למחשב שלך, אז וודא שיש לך מספיק מקום בכונן הקשיח או ב-SSD לפני שתתקדם. ומכיוון שחיבור האינטרנט שלך נדרש, מהירות ההעברה הכוללת תהיה תלויה באיכות הרשת.
כעת, עלינו לשים לב שאימות דו-גורמי אינו קיים בחשבון המנהל, אז צור חשבון אדמין זמני שאין לו 2FA למטרה זו בלבד.
דברים שתצטרכו
נשתמש בסקריפט מיוחד כדי להעביר את הקבצים מחשבון OneDrive אחד לאחר. אז כדי שהתסריט יעבוד עם בעיות, אנא התקן את מודולי PowerShell הבאים עכשיו:
SharePoint PnP PowerShell מודול
פתח את הכלי PowerShell כמנהל, ולאחר מכן הפעל את הפקודה הבאה:
Install-Module SharePointPnPPowerShellOnline -Force
מעטפת ניהול מקוונת של SharePoint
מטרת הכלי הזה היא לשנות את ההרשאות בחשבון OneDrive של המשתמשים.
הורד והתקן אותו בחינם מ microsoft.com .
מודול Powershell MSOnline V1
על מנת להתקין את המודול הסופי הזה, אנא הפעל את הפקודה הבאה ב-PowerShell כמנהל:
Install-Module MSOnline -Force
כיצד להעביר קבצי OneDrive לחשבון אחר
כדי להעביר קבצים מחשבון OneDrive שלך לאחר, עליך לפתוח את PowerShell ולאחר מכן להפעיל את הסקריפט שסופק.
פתח את PowerShell
פתח את Visual Studio Code, או PowerShell.
אתה יכול לעשות זאת על ידי לחיצה על כפתור החיפוש ולאחר מכן חפש את PowerShell.
משם, לחץ לחיצה ימנית על האפליקציה ולאחר מכן בחר באפשרות שנועדה לפתוח את הכלי במצב Admin.
הפעל את הסקריפט
לבדוק חומרה Windows 10
לאחר מכן, עליך להפעיל את הסקריפט הרלוונטי. אתה יכול למצוא אותו בתחתית המאמר.
בחרנו לעשות זאת כי התסריט די ארוך.
לאחר הוספת הסקריפט, הקש על מקש Enter במקלדת שלך.
העבר את הקבצים
לבסוף, הגיע הזמן להעביר את הקבצים לחשבון OneDrive אחר.
אתה רואה, מיד לאחר הקשה על מקש Enter, תתבקש להוסיף את חשבון הדוא'ל שם המשתמש של המשתמש היוצא .
תצטרך גם שם המשתמש של משתמש היעד . זהו משתמש OneDrive שאליו יועתקו ויועברו הקבצים.
לבסוף, תתבקש להוסיף שם המשתמש של מנהל Office 365 שלך .
המתן עד שהתסריט יעשה את שלו לפני שתבדוק את החשבון המקבל כדי לראות אם הקבצים הועברו כהלכה.
העתק והדבק את הסקריפט שלהלן:
$departinguser = Read-Host "Enter departing user's email" $destinationuser = Read-Host "Enter destination user's email" $globaladmin = Read-Host "Enter the username of your Global Admin account" $credentials = Get-Credential -Credential $globaladmin Connect-MsolService -Credential $credentials $InitialDomain = Get-MsolDomain | Where-Object {$_.IsInitial -eq $true} $SharePointAdminURL = "https://$($InitialDomain.Name.Split(".")[0])-admin.sharepoint.com" $departingUserUnderscore = $departinguser -replace "[^a-zA-Z]", "_" $destinationUserUnderscore = $destinationuser -replace "[^a-zA-Z]", "_" $departingOneDriveSite = "https://$($InitialDomain.Name.Split(".")[0])-my.sharepoint.com/personal/$departingUserUnderscore" $destinationOneDriveSite = "https://$($InitialDomain.Name.Split(".")[0])-my.sharepoint.com/personal/$destinationUserUnderscore" Write-Host "`nConnecting to SharePoint Online" -ForegroundColor Blue Connect-SPOService -Url $SharePointAdminURL -Credential $credentials Write-Host "`nAdding $globaladmin as site collection admin on both OneDrive site collections" -ForegroundColor Blue # Set current admin as a Site Collection Admin on both OneDrive Site Collections Set-SPOUser -Site $departingOneDriveSite -LoginName $globaladmin -IsSiteCollectionAdmin $true Set-SPOUser -Site $destinationOneDriveSite -LoginName $globaladmin -IsSiteCollectionAdmin $true Write-Host "`nConnecting to $departinguser's OneDrive via SharePoint Online PNP module" -ForegroundColor Blue Connect-PnPOnline -Url $departingOneDriveSite -Credentials $credentials Write-Host "`nGetting display name of $departinguser" -ForegroundColor Blue # Get name of departing user to create folder name. $departingOwner = Get-PnPSiteCollectionAdmin | Where-Object {$_.loginname -match $departinguser} # If there's an issue retrieving the departing user's display name, set this one. if ($departingOwner -contains $null) { $departingOwner = @{ Title = "Departing User" } } # Define relative folder locations for OneDrive source and destination $departingOneDrivePath = "/personal/$departingUserUnderscore/Documents" $destinationOneDrivePath = "/personal/$destinationUserUnderscore/Documents/$($departingOwner.Title)'s Files" $destinationOneDriveSiteRelativePath = "Documents/$($departingOwner.Title)'s Files" Write-Host "`nGetting all items from $($departingOwner.Title)" -ForegroundColor Blue # Get all items from source OneDrive $items = Get-PnPListItem -List Documents -PageSize 1000 $largeItems = $items | Where-Object {[long]$_.fieldvalues.SMTotalFileStreamSize -ge 261095424 -and $_.FileSystemObjectType -contains "File"} if ($largeItems) { $largeexport = @() foreach ($item in $largeitems) { $largeexport += "$(Get-Date) - Size: $([math]::Round(($item.FieldValues.SMTotalFileStreamSize / 1MB),2)) MB Path: $($item.FieldValues.FileRef)" Write-Host "File too large to copy: $($item.FieldValues.FileRef)" -ForegroundColor DarkYellow } $largeexport | Out-file C:\temp\largefiles.txt -Append Write-Host "A list of files too large to be copied from $($departingOwner.Title) have been exported to C:\temp\LargeFiles.txt" -ForegroundColor Yellow } $rightSizeItems = $items | Where-Object {[long]$_.fieldvalues.SMTotalFileStreamSize -lt 261095424 -or $_.FileSystemObjectType -contains "Folder"} Write-Host "`nConnecting to $destinationuser via SharePoint PNP PowerShell module" -ForegroundColor Blue Connect-PnPOnline -Url $destinationOneDriveSite -Credentials $credentials Write-Host "`nFilter by folders" -ForegroundColor Blue # Filter by Folders to create directory structure $folders = $rightSizeItems | Where-Object {$_.FileSystemObjectType -contains "Folder"} Write-Host "`nCreating Directory Structure" -ForegroundColor Blue foreach ($folder in $folders) { $path = ('{0}{1}' -f $destinationOneDriveSiteRelativePath, $folder.fieldvalues.FileRef).Replace($departingOneDrivePath, '') Write-Host "Creating folder in $path" -ForegroundColor Green $newfolder = Ensure-PnPFolder -SiteRelativePath $path } Write-Host "`nCopying Files" -ForegroundColor Blue $files = $rightSizeItems | Where-Object {$_.FileSystemObjectType -contains "File"} $fileerrors = "" foreach ($file in $files) { $destpath = ("$destinationOneDrivePath$($file.fieldvalues.FileDirRef)").Replace($departingOneDrivePath, "") Write-Host "Copying $($file.fieldvalues.FileLeafRef) to $destpath" -ForegroundColor Green $newfile = Copy-PnPFile -SourceUrl $file.fieldvalues.FileRef -TargetUrl $destpath -OverwriteIfAlreadyExists -Force -ErrorVariable errors -ErrorAction SilentlyContinue $fileerrors += $errors } $fileerrors | Out-File c:\temp\fileerrors.txt # Remove Global Admin from Site Collection Admin role for both users Write-Host "`nRemoving $globaladmin from OneDrive site collections" -ForegroundColor Blue Set-SPOUser -Site $departingOneDriveSite -LoginName $globaladmin -IsSiteCollectionAdmin $false Set-SPOUser -Site $destinationOneDriveSite -LoginName $globaladmin -IsSiteCollectionAdmin $false Write-Host "`nComplete!" -ForegroundColor Green
אתה יכול למצוא את התסריט על זה עמוד Reddit .
לקרוא : כיצד לייצא CSV ב-PowerShell ב-Windows
האם PowerShell יכול לגשת ל-OneDrive?
SharePoint Online PowerShell יאפשר למשתמשים להתחבר לחשבון OneDrive אחר באמצעות הכלי PowerShell. זה יבקש ממך להכניס את הסיסמה שלך כדי ש-PowerShell יתחיל לעבוד על חשבונות OneDrive שלך באמצעות cmdlets.
האם משתמשים חיצוניים יכולים לגשת ל-OneDrive?
משתמשים חיצוניים יכולים לגשת לחשבון OneDrive שלך, אך רק אם תאפשר זאת. למשתמשים תהיה גישה לקבצים שלך לנצח או לתקופת זמן מוגדרת. אתה יכול גם להגביל את מה שהם יכולים לעשות.
כיצד להעתיק קבצים מ-OneDrive של אדם אחר?
יש לך את האפשרויות הבאות אם אתה רוצה להעתיק קבצים מ-OneDrive של אדם אחר:
- פתח את OneDrive בדפדפן שלך באמצעות הקישור, בחר את הקבצים שברצונך להעתיק ולחץ על הורד. זה יוריד אותו למחשב שלך.
- פתח את חשבון OneDrive באמצעות הקישור, בחר את הקבצים שברצונך להעתיק ולחץ על העתק אל.
זהו זה!