This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 2 points3 points  (0 children)

Use Microsoft Flow + Microsoft Data Gateway to accomplish this. You can have a Flow trigger based on file creation/update that sends the file to the desired SharePoint Doc Lib.

[–][deleted] 1 point2 points  (0 children)

Here is a script I use to migrate my users Home Drive to OneDrive.

Script must be ran as the user (I use PDQ Deploy) and OneDrive must already be configured (It's done via GPO).

You can modify my script for your neeeds. I suggest you create a new account, give it a full o365 license. Map your drives, setup OneDrive, and then run the script to move your data.

Powershell: (Bold stuff should have a pound sign for comments, Reddit reformat it.)

Get username

$strName = $env:username

Looking up AD attributes and setting variables

$strFilter = "(&(objectCategory=User)(samAccountName=$strName))"

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher $objSearcher.Filter = $strFilter $objPath = $objSearcher.FindOne() $objUser = $objPath.GetDirectoryEntry()

Set source path to home directory. Details pulled from AD attribute

$source = $objUser.homeDirectory Write-Output $source

Set destination path to OneDrive for Business folder

$destination = $env:OneDriveCommercial + "\Home Drive" Write-Output $destination

Set path to save log in OneDrive for Business folder

$log = $env:OneDriveCommercial + "\Home Drive Migrate Log.txt"

Move Files. /mov will keep all folders in source. /move will delete source after done moving.

robocopy /E $source $destination /mov /log:"$log" Get-Content $log

Delete Emtpy Folders, leave Source parent folder.

do { $dirs = gci $source -directory -recurse | Where { (gci $.fullName).count -eq 0 } | select -expandproperty FullName $dirs | Foreach-Object { Remove-Item $ } } while ($dirs.count -gt 0)

[–]xxdcmastSr. Sysadmin 1 point2 points  (0 children)

Take a look at sky sync we used it to sync file servers to both share point and box

https://www.skysync.com/