Public/Get-AppEnhancerApplication.ps1
|
function Get-AppEnhancerApplication { <# .SYNOPSIS This script gets information for specific application. .NOTES Name: Get-AppEnhancerApplication Author: Bruce Stump .DESCRIPTION This script gets information for specific applications in Application Enhancer. .EXAMPLE Get-AppEnhancerApplication -Cred $credentials -serverUrl $serverUrl -Database $database #> param ( [Parameter(Mandatory=$true)] [pscredential]$Cred, [Parameter(Mandatory=$true)] [string]$serverUrl, [Parameter(Mandatory=$true)] [string]$Database ) begin { # Define your credentials $username = $Cred.UserName $password = $Cred.GetNetworkCredential().password } process { # Convert credentials to Base64 for Basic Authentication $pair = $username + ':' + $password $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) $base64 = [Convert]::ToBase64String($bytes) $authHeader = "Basic $base64" # Define headers with Basic Authentication $headers = @{ "Authorization" = $authHeader "Content-Type" = "application/json" } # Define the URL to get the list of applications $applicationsUrl = "$serverUrl/AppEnhancerReST/api/AXDataSources/$Database/axapps" # Retrieve the list of applications Invoke-RestMethod -Uri $applicationsUrl -Method Get -Headers $headers } end {} } |