public/account/Remove-PSTSAccount.ps1
function Remove-PSTSAccount { param( [Parameter(Mandatory=$true)][string] $account ) begin { $credFile = "$([Environment]::GetFolderPath('ApplicationData'))/REST-Devops/$($account)" if ((Test-Path -Path $credFile ) -eq $false) { Throw [Exception]::new("Account file not found") } } process { try { Remove-Item $credFile } catch { Throw [Exception]::new("Failed to delete the provided account file") } } end { [Environment]::SetEnvironmentVariable("ACCOUNT","") [Environment]::SetEnvironmentVariable("TOKEN","") [Environment]::SetEnvironmentVariable("ENDPOINT","") return $true } } |