Functions/Set-OnedriveItemAvailability.ps1
function Set-OnedriveItemAvailability { [CmdletBinding()] param ( [Parameter()] [ValidateSet("Online", "Offline", "FreeUpSpace")] [string] $Setting = "Offline", [Parameter()] [string] $Path = ((Get-Location).Path), [Parameter()] [string] $Filter ) $loc = Get-Location Set-Location $Path switch ($Setting) { "Offline" { attrib +P /S /D $Filter } "Online" { attrib -P /S /D $Filter } "FreeUpSpace" { attrib -P +U /S /D $Filter } } Set-Location $loc } |