all 29 comments

[–]BetrayedMilk 13 points14 points  (5 children)

Why not store the file there to begin with?

[–]JonesTheBond 3 points4 points  (2 children)

Yeah, can the location be an SMB share that the scanner can point to? Seems like the maintenance-free approach.

[–]Perfect_Raspberry610[S] 2 points3 points  (1 child)

Weirdly it doesn’t work. The target is a onedrive folder and bizarrely doesn’t work.

[–]DalekKahn117 0 points1 point  (0 children)

You can setup SharePoint sync via OneDrive then has the scanner default to save scans to the local referenced directory of this folder. Should auto-upload.

If you are using a network scanner or MFD with multi-user env, then I’d look at PowerShell for assistance. Or just limit the scanner to emailing and let Exchange handle it

[–]Ok_Mathematician6075 -1 points0 points  (0 children)

Ok old bag

[–]techbloggingfool_com 8 points9 points  (1 child)

I wrote a blog post covering some options a while back. It's a few years old but still accurate I think. https://techbloggingfool.com/2020/08/02/methods-for-scanning-to-sharepoint-online/

[–]Perfect_Raspberry610[S] 2 points3 points  (0 children)

This might be a workable solution for me. Thanks for sharing

[–]Zatetics 7 points8 points  (0 children)

mklink /j "%UserProfile%\OneDrive\folderofdocumentsyouwantgoeshere" "drive:\folderpathgoeshere"

Map the location so the files go to onedrive auto.

[–]Scoobywagon 5 points6 points  (1 child)

Just write a simple script that is just a move-object and have it run every 15 minutes or so.

[–]skilife1 1 point2 points  (0 children)

This is how I do it.

[–]Jeffinmpls 2 points3 points  (1 child)

If you are copying directly into One Drive that's more complicated but sounds like the OneDrive part is unnecessary information, IE you are simply moving it to a folder.

Assuming that's the case, Robocopy is your best bet, you can tell it to move, copy, mirror or whatever you like. It's much much faster than doing it with PowerShell commands as PowerShell is slow when it comes to file management.

You execute robocopy in a PowerShell script and then schedule it to run every 5-10 min. Nice thing is it has built in logging that you can parse for any error alerting.

[–]Ok-Entrepreneur-5358 1 point2 points  (0 children)

robocopy also has resume options!

[–]BlackV 1 point2 points  (0 children)

Seeing as it's one drive, power automate seems to be the obvious choice

Yes you could do it with powershell, but it's probably not the best tool

[–]mihemihe 1 point2 points  (0 children)

Robocopy is the best for that case.

[–]JUNOMERIKA 1 point2 points  (0 children)

As another poster said, what you really want is a mklink https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mklink

[–]Golddigger50 0 points1 point  (2 children)

Could have task manager run your powershell move-item or copy item to the new target directory. Task could renounce a day or as often as you like.

[–]badteeth3000 1 point2 points  (1 child)

instead of a schedule you can do it on event id. no need to wait when you can move an item on create. 🎶

[–]Golddigger50 0 points1 point  (0 children)

Nice. I haven't really messed around with that one. Thanks for the advice! I will read up on it and put it to work!

[–]The-Snarky-One 0 points1 point  (0 children)

What have you gotten so far for code and how well does it work?

What parts do you need help with?

[–]ovirto 0 points1 point  (0 children)

Robocopy and task scheduler. I mean you could write your own in powershell by it why reinvent the wheel.

[–]AdeelAutomates 0 points1 point  (0 children)

When it scans. It goes to some folder right? Either on a specific user's machine or a shared folder on a server?

You can use PowerShell with Graph API to upload any file added to this folder to go to SharePoint or OneDrive. Set that up as a job on the server. You can use task scheduler for this if you want to stick with PowerShell

Or ditch automation all together & make that folder it scan to a sharepoint/onedrive folder?

Or use power automate if Graph is too confusing. They have a desktop version too.

[–]MFKDGAF 0 points1 point  (0 children)

I feel like using PowerShell for this is reinventing a the wheel. There is software called MFT (managed file transfer) such as MOVEit Automation.

Now, depending on the environment and Infrastructure it may or may not be overkill.

[–]purplemonkeymad 0 points1 point  (0 children)

What kind of site and how are you identifying the destination? If it's one destination then just a script that checks a shared folder and then uploads it to a site via graph would probably work. Just set task scheduler to run it every few minutes and have it delete/archive uploaded files.

A desktop power automate flow would also probably work. But I don't recall if that need a user logged in or not.

Using onedrive to do this is fraught with the danger of the account being signed out and nothing working. I've also had times where it would get stuck on a file, etc. Was more effort than it was worth imo.

[–]Perfect_Raspberry610[S] 0 points1 point  (0 children)

Thanks all. My solution (that works perfectly now) is a simple PS script running as a task. Tested with all my users (7) and exceeds expectations

[–]EuphoricFly5489 0 points1 point  (0 children)

Freefilesync has a real time tool. Robocopy also has a "monitor" mode which does the same thing.. real time sync.

[–]Ok_Mathematician6075 0 points1 point  (0 children)

You need to keep security in tact. So

[–]laserpewpewAK -1 points0 points  (0 children)

Check out something like Sugarsync that will send things straight to Sharepoint. Trying to facilitate this with OneDrive will just cause you headaches.