OneDrive and PowerShell

Ask your 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.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

OneDrive and PowerShell

Post by localpct »

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?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: OneDrive and PowerShell

Post by jvierra »

Just copy the file to your OneDrive. There is no trick, just use "copy-item".
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: OneDrive and PowerShell

Post by localpct »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: OneDrive and PowerShell

Post by jvierra »

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

https://www.powershellgallery.com/packa ... rive/1.1.3
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: OneDrive and PowerShell

Post by jvierra »

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: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: OneDrive and PowerShell

Post by localpct »

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: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: OneDrive and PowerShell

Post by localpct »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: OneDrive and PowerShell

Post by jvierra »

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: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: OneDrive and PowerShell

Post by localpct »

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
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: OneDrive and PowerShell

Post by jvierra »

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

Scripting is not the solution.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked