Managing OneDrive: Converting Files to Online-Only with PowerShell
28/06/2024 - 23.34 | Edit: Some of the information provided here is not fully comlpete. Further research has been done and an update is coming soon!
Hello there, another quick one to finish off the day. Let’s dive into a quick breakdown of a useful little PowerShell script we stumbled upon in Tristan Tyson’s tech blog whilst looking into Getting OneDrive File States with PowerShell. This small but handy script is all about converting your OneDrive (Commercial) files into online-only mode. This can be scoped for OneDrive (Personal) files as well.
This simple little script could be used to change the attribute of OneDrive files to ‘Cloud Only’, which would free up available disk space as any locally synced files are uploaded to OneDrive.
Let’s break it down step by step.
The Script: Streamlining Online-Only Conversion
The script focuses on using PowerShell to set your OneDrive (Commercial) files as online-only, saving local storage. You can check out the original post here, courtesy of Tristan Tyson.
Here’s the script laid out for you:
|
|
The Breakdown: What Each Part Does
Gathering OneDrive Files: We start by using
Get-ChildItem
to get the OneDrive directory contents (recursively). The-File
switch ensures we focus on files, and-Recurse
dives into subdirectories.Choosing the Right Ones: With
Where-Object
, we pick files with specific attributes. Those with ‘ReparsePoint’ or ‘525344’ attributes are targeted as these attributes relate to locally availabile files (See my previous post: Getting OneDrive File States with PowerShell).Making the Change: For each chosen file, we employ
attrib.exe
to do the magic. The+U -P /s
commands shift the file to online-only mode.
Embrace Streamlined OneDrive Management
And there you have it, folks! A straightforward dive into Tristan Tyson’s script for transforming OneDrive files into online-only mode. With a few lines of PowerShell, you can streamline your file management, making the most of online storage.
Feel free to use this script to optimize your OneDrive experience. Here’s to more efficient digital spaces and simplified file management!
With this script in your toolkit, you’ve got the power to make your OneDrive files online-only and keep things tidy. Stay tuned for more useful script breakdowns and tips!