OneDrive and PowerShell

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
localpct
Posts: 285
Joined: Wed Sep 09, 2015 12:53 pm

OneDrive and PowerShell

Post by localpct » Tue Aug 06, 2019 8:44 am

I've created a CSV file that has our models of PCs that I use in a switch statement

I'd like to upload that to OneDrive for Business in my organization so that way I can rely on the cloud, thus having the ability to update just the file and not the application whenever a new model comes out.

It's looking to be a pain right now, is there a simple direction to follow?

User avatar
jvierra
Posts: 13687
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: OneDrive and PowerShell

Post by jvierra » Tue Aug 06, 2019 9:52 am

Just copy the file to your OneDrive. There is no trick, just use "copy-item".

User avatar
localpct
Posts: 285
Joined: Wed Sep 09, 2015 12:53 pm

Re: OneDrive and PowerShell

Post by localpct » Tue Aug 06, 2019 10:50 am

Hi,
Sorry if I wasn't clear
I'd like the application to be able to read from my CSV file that's on my OneDrive

User avatar
jvierra
Posts: 13687
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: OneDrive and PowerShell

Post by jvierra » Tue Aug 06, 2019 10:56 am

You can also use the OneDrive CmdLets to access and manage OneDrive:

https://www.powershellgallery.com/packa ... rive/1.1.3

User avatar
jvierra
Posts: 13687
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: OneDrive and PowerShell

Post by jvierra » Tue Aug 06, 2019 11:14 am

OneDrive is just a local drive. Just use it as a local folder.

Get-ChildItem $env:userprofile\OneDrive

You can use all PS CmdLets to access any file on OneDrive.

User avatar
localpct
Posts: 285
Joined: Wed Sep 09, 2015 12:53 pm

Re: OneDrive and PowerShell

Post by localpct » Tue Aug 06, 2019 11:42 am

Hi, Thanks and I'm working through this OneDrive\Graph API\Azure deal

this application is shared across multiple people and I don't wanna keep it on my PC :D

User avatar
localpct
Posts: 285
Joined: Wed Sep 09, 2015 12:53 pm

Re: OneDrive and PowerShell

Post by localpct » Tue Aug 06, 2019 11:53 am

Looks like I'm going to get stuck at

"needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it."

we're still new to Azure and they aren't around so I guess I'm stuck for now

User avatar
jvierra
Posts: 13687
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: OneDrive and PowerShell

Post by jvierra » Tue Aug 06, 2019 12:34 pm

What you want is to use SharePoint and create a shared drive that all systems are mapped to. Now you can distribute all manner of files and not have to use any APIs to do this.

"Graph" is intended for other things and not just simple file sharing. First configure your SharePoint to share files. Then use Graph or other tools to store the files and maintain the drive. In your request only a shared 1Drive for business is required or a SharePoint drive. From there you can just use basic PS to maintain the files.

User avatar
localpct
Posts: 285
Joined: Wed Sep 09, 2015 12:53 pm

Re: OneDrive and PowerShell

Post by localpct » Tue Aug 06, 2019 2:36 pm

With the way our sharepoint admins are, I'd much rather not.. I do appreciate it

I did end up just using the free azure for a year as I'm hosting a minimal count of files with less than 20 KB in size on a blob storage

All tested and ready to distribute now :D

User avatar
jvierra
Posts: 13687
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: OneDrive and PowerShell

Post by jvierra » Tue Aug 06, 2019 3:03 pm

So share the storage. If your domain is hybrid then just create a share.

Scripting is not the solution.

Post Reply