Get-OMEReportType.ps1

Function Get-OMEReportType
{

    <#
    .SYNOPSIS
        Gets the types of OME reports.
    .DESCRIPTION
        Gets the types of OME reports.
    .PARAMETER Session
        Specifies the Session Id for the OME server.
 
    .EXAMPLE
        Get-OMEReportType
         
        AgentSummary
        IDracServiceModuleSummary
        AlertsPerDevice
        ServerOverview
        ServerComponentsAndVersions
        AssetAcquisitionInformation
        AssetMaintenanceInformation
        AssetSupportInformation
        HardDriveInformation
        EsxInformation
        HyperVInformation
        FruInformation
        LicenseInformation
        DeviceLocationInformation
        MemoryInformation
        ModularEnclosureInformation
        NicInformation
        PciDeviceInformation
        PerformanceMinimumMaximum
        PerformanceAveragePeak
        ProcessorInformation
        StorageControllerInformation
        VirtualDiskInformation
        WarrantyInformation
        BiosConfiguration
        IDracNetworkConfiguration
        DeviceConfigurationCompliance
        TemplateAssociation
        AssignedIdentities
        AllIdentityAttributes
        AgentHealthStatus
 
    .NOTES
        Author: Mike Khar
    .LINK
        http://www.dell.com/support/home/us/en/04/product-support/product/dell-openmanage-essentials-v2.2/research
        https://$Server:$Port/api/OME.svc/Reports
    #>
  

    [CmdletBinding(
    )]
    Param(
        $Session="OMEConnection.DefaultOMESession"
    )
    
    Begin
    {
        $CurrentSession = Get-Variable -Scope Global -Name $Session -ErrorAction SilentlyContinue -ValueOnly
        If (!$CurrentSession) {
            Write-Warning "Please use Set-OMEConnection first"
            Break
            Return
        }
        else {
            $BaseUri="https://"+$CurrentSession.Server+":"+$CurrentSession.Port+"/api/OME.svc"
        }
    }
    
    Process
    {    
        Try {
            $uri=$BaseUri+"/Reports"
            if ($CurrentSession.Credentials) {
                $result = Invoke-WebRequest -Uri $uri -Credential $CurrentSession.Credentials
            }
            else {
                $result = Invoke-WebRequest -Uri $uri -UseDefaultCredentials
            }
            if ($result.StatusCode -ne 200) {
                Out-OMEException -Exception $_
                return
            }
            else {
                Write-Debug "HTTP request: $uri HTTP status code: $($result.StatusCode)"
                [xml]$xml=$result.Content
                [string[]]$result=$xml.GetReportTypesResponse.GetReportTypesResult.string
                return $result
            }
        }
        Catch {
            Out-OMEException -Exception $_
        }
    }
    
    End{}                
}