Scripts/Get-BPAServer.ps1
function Get-BPAServer { <# .SYNOPSIS Gets AutoMate BPA server information. .DESCRIPTION Get-BPAServer gets information about the server. .PARAMETER Type The type of server information to retrieve. .PARAMETER BPAServer The AutoMate BPA management server. .EXAMPLE # Get information about the management server Get-BPAServer -Type Management .NOTES Author(s): : David Seibel Contributor(s) : Date Created : 08/24/2016 Date Modified : 02/27/2018 .LINK https://github.com/davidseibel/PoshBPA #> [CmdletBinding()] param( [ValidateSet("Server","Execution","Management")] [ValidateNotNullOrEmpty()] [string]$Type = "Server", [ValidateNotNullOrEmpty()] [string]$BPAServer ) switch ($Type) { "Server" { $result = Invoke-BPARestMethod -Resource "info/get" -RestMethod "Get" -BPAServer $BPAServer $result | Foreach-Object {$_.PSObject.TypeNames.Insert(0,"BPAConstructType.Server")} } "Execution" { $result = Invoke-BPARestMethod -Resource "metrics/execution/get" -RestMethod "Get" -BPAServer $BPAServer $result | Foreach-Object {$_.PSObject.TypeNames.Insert(0,"BPAConstructType.ServerExecution")} } "Management" { $result = Invoke-BPARestMethod -Resource "metrics/management/get" -RestMethod "Get" -BPAServer $BPAServer $result | Foreach-Object {$_.PSObject.TypeNames.Insert(0,"BPAConstructType.ServerManagement")} } } return $result } |