[CmdletBinding()] param ( [Parameter(Mandatory = $true, HelpMessage = "Common Name for cert")] [string] $CommonName ) Import-Module ITD.Infra-Certificate-External.JsonDB Write-Verbose -Verbose "Set DB Environment" Set-JDEnvironment -Name prod $PreviousThumbprint=(Select-JDJson -TableName certcache -CommonName $commonname).Thumbprint #Unreg from cert log if ($PreviousThumbprint) { $table=@("certlog") Foreach ($t in $table) { Set-JDJson -TableName $t ` -Where { param($row) $row.CommonName -eq $commonname } ` -Set @{ is_retired = $true; PreviousThumbprint = 'OLD-000-XYZ' } ` -Verbose } #end of foreach } #end of if $Previous thumbprint #delete from certcache Remove-JDJson -TableName certcache -Where { param($o) $o.commonname -eq $commonname }