public/Get-ProofpointOdinToken.ps1
Function Set-ProofpointOdinToken{ [CmdletBinding(SupportsShouldProcess = $true)] Param( [Parameter(Mandatory=$true)] [string]$Domain, [string]$UserEmail ) $Body = @{ user_to_impersonate= "$($UserEmail)" } $jsonBody = $Body | ConvertTo-Json if(!($PPheaders)){ Write-Error "Not Connected to Proofpoint." } try{ Invoke-RestMethod -Uri "$PPURI/token/$Domain" -Headers $PPheaders -Method post -Body $jsonBody -ContentType 'application/json' }Catch{ Write-Output "$_" } } |