Functions/Set-OnedriveItemAvailability.ps1


function Set-OnedriveItemAvailability {
    [CmdletBinding()]
    param (
        [Parameter()] [ValidateSet("Online", "Offline", "FreeUpSpace")] [string] $Setting = "Offline",
        [Parameter()] [string] $Path = ((Get-Location).Path)
    )

    
    $loc = Get-Location

    Set-Location $Path
    switch ($Setting) {
        "Offline" { attrib +P /S /D }
        "Online" { attrib -P /S /D }
        "FreeUpSpace" { attrib -P +U /S /D }
    }

    Set-Location $loc

}