categories/OneDrive.ps1
|
# OneDrive category: runs Microsoft's own uninstaller. Irreversible within Octa (no automated # reinstall action) - reinstall manually from onedrive.com or use the System Restore Point. function Get-OctaOneDriveCategory { [CmdletBinding()] param() return [pscustomobject]@{ Id = 'onedrive' DisplayName = 'OneDrive' Description = 'Uninstall/unlink OneDrive' RequiresElevation = $true ContainsIrreversibleActions = $true GetActionsFunction = 'Get-OctaOneDriveActions' ApplyActionFunction = 'Set-OctaOneDriveAction' } } function Get-OctaOneDriveActions { [CmdletBinding()] param() $installed = Test-Path (Join-Path $env:LOCALAPPDATA 'Microsoft\OneDrive\OneDrive.exe') if (-not $installed) { return @() } return @( New-OctaAction -TargetType Package -TargetIdentifier 'OneDrive' ` -CurrentValue 'Installed' -PlannedValue 'Uninstalled' -Reversible $false ` -IrreversibleReason 'Reinstall manually from onedrive.com, or use the System Restore Point.' ) } function Set-OctaOneDriveAction { [CmdletBinding()] param([Parameter(Mandatory)]$Action) $uninstaller = Join-Path $env:SystemRoot 'SysWOW64\OneDriveSetup.exe' if (-not (Test-Path $uninstaller)) { $uninstaller = Join-Path $env:SystemRoot 'System32\OneDriveSetup.exe' } if (Test-Path $uninstaller) { Start-Process -FilePath $uninstaller -ArgumentList '/uninstall' -Wait -NoNewWindow } } |