Scripts/Utility/update-cohesitycmdletconfig.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
function Update-CohesityCmdletConfig { [CmdletBinding(SupportsShouldProcess = $True, ConfirmImpact = "High")] param( [Parameter(Mandatory = $true)] $CurrentConfig ) Begin { [CohesityConfig]$configObject = [CohesityConfig]::New() $configFileName = $configObject.ConfigFileName $cohesityFolder = $configObject.ConfigFolder $cmdletConfigPath = "$HOME/" + $cohesityFolder + "/" + $configFileName } Process { if ($PSCmdlet.ShouldProcess("Cmdlet configuration")) { $resp = $CurrentConfig | Get-Member -Name RefreshToken if($null -eq $resp) { $CurrentConfig | Add-Member -NotePropertyName RefreshToken -NotePropertyValue $false $CurrentConfig | ConvertTo-Json -depth 100 | Out-File $cmdletConfigPath } } } End { } } |