From 4f1cc3c1e1db8f337eef89a871b160801bc934a5 Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 14:45:26 +0000 Subject: [PATCH 1/8] Create Get-AutomateGroup.ps1 --- Public/Get-AutomateGroup.ps1 | 101 +++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 Public/Get-AutomateGroup.ps1 diff --git a/Public/Get-AutomateGroup.ps1 b/Public/Get-AutomateGroup.ps1 new file mode 100644 index 0000000..53d2001 --- /dev/null +++ b/Public/Get-AutomateGroup.ps1 @@ -0,0 +1,101 @@ +function Get-AutomateGroup { + <# + .SYNOPSIS + Get Group information out of the Automate API + .DESCRIPTION + Connects to the Automate API and returns one or more full Group objects + .PARAMETER AllGroups + Returns all Groups in Automate, regardless of amount + .PARAMETER Condition + A custom condition to build searches that can be used to search for specific things. Supported operators are '=', 'eq', '>', '>=', '<', '<=', 'and', 'or', '()', 'like', 'contains', 'in', 'not'. + The 'not' operator is only used with 'in', 'like', or 'contains'. The '=' and 'eq' operator are the same. String values can be surrounded with either single or double quotes. IE (RemoteAgentLastContact <= 2019-12-18T00:50:19.575Z) + Boolean values are specified as 'true' or 'false'. Parenthesis can be used to control the order of operations and group conditions. + .PARAMETER OrderBy + A comma separated list of fields that you want to order by finishing with either an asc or desc. + .PARAMETER GroupName + Group name to search for, uses wildcards so full Group name is not needed + .PARAMETER GroupID + GroupID to search for, integer, -GroupID 1 + .OUTPUTS + Client objects + .NOTES + Version: 1.0 + Author: Marcus Tedde + Creation Date: 2023-12-11 + Purpose/Change: Initial script development + .EXAMPLE + Get-AutomateGroup -AllGroups + .EXAMPLE + Get-AutomateGroup -GroupId 4 + .EXAMPLE + Get-AutomateGroup -GroupName "Rancor" + .EXAMPLE + Get-AutomateGroup -Condition "(TypeName = 'Patching')" + #> + param ( + [Parameter(Mandatory = $false, Position = 0, ParameterSetName = "IndividualGroup")] + [Alias('ID')] + [int32[]]$GroupId, + + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [switch]$AllGroups, + + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$Condition, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$IncludeFields, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$ExcludeFields, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$OrderBy, + + [Alias("Group")] + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [string]$GroupName + ) + + $ArrayOfConditions = @() + + + if ($ClientID) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -IDs $(($GroupID) -join ",") + } + + if ($AllClients) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + } + + if ($Condition) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -Condition $Condition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + } + + if ($ClientName) { + $ArrayOfConditions += "(Name like '%$GroupName%')" + } + + $ClientFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions + + $Clients = Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -Condition $ClientFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + + $FinalResult = @() + foreach ($Client in $Clients) { + $ArrayOfConditions = @() + $ArrayOfConditions += "(Client.Id = '$($Client.Id)')" + $LocationFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions + $Locations = Get-AutomateAPIGeneric -AllResults -Endpoint "locations" -Condition $LocationFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + $FinalClient = $Client + Add-Member -inputobject $FinalClient -NotePropertyName 'Locations' -NotePropertyValue $locations + $FinalResult += $FinalClient + } + + return $FinalResult + } From 61a1cbb8e57845dad7fe28ee0cc732acb2bd0987 Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 14:54:55 +0000 Subject: [PATCH 2/8] Create Get-AutomateGroup.md --- Docs/Get-AutomateGroup.md | 191 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 Docs/Get-AutomateGroup.md diff --git a/Docs/Get-AutomateGroup.md b/Docs/Get-AutomateGroup.md new file mode 100644 index 0000000..b71487a --- /dev/null +++ b/Docs/Get-AutomateGroup.md @@ -0,0 +1,191 @@ +--- +external help file: AutomateAPI-help.xml +Module Name: AutomateAPI +online version: +schema: 2.0.0 +--- + +# Get-AutomateGroup + +## SYNOPSIS +Get Group information out of the Automate API + +## SYNTAX + +### IndividualGroup +``` +Get-AutomateGroup [[-GroupId] ] [] +``` + +### AllResults +``` +Get-AutomateGroup [-AllGroups] [-IncludeFields ] [-ExcludeFields ] [-OrderBy ] + [] +``` + +### ByCondition +``` +Get-AutomateGroup [-Condition ] [-IncludeFields ] [-ExcludeFields ] + [-OrderBy ] [] +``` + +### CustomBuiltCondition +``` +Get-AutomateGroup [-IncludeFields ] [-ExcludeFields ] [-OrderBy ] + [-GroupName ] [] +``` + +## DESCRIPTION +Connects to the Automate API and returns one or more full Group objects + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AutomateGroup -AllGroups +``` + +### EXAMPLE 2 +``` +Get-AutomateGroup -GroupId 4 +``` + +### EXAMPLE 3 +``` +Get-AutomateGroup -GroupName "PatchGroup1" +``` + +### EXAMPLE 4 +``` +Get-AutomateGroup -Condition "(TypeName = 'Patching')" +``` + +## PARAMETERS + +### -GroupId +GroupId to search for, integer, -GroupId 1 + +```yaml +Type: Int32[] +Parameter Sets: IndividualGroup +Aliases: ID + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AllGroups +Returns all Groups in Automate, regardless of amount + +```yaml +Type: SwitchParameter +Parameter Sets: AllResults +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Condition +A custom condition to build searches that can be used to search for specific things. +Supported operators are '=', 'eq', '\>', '\>=', '\<', '\<=', 'and', 'or', '()', 'like', 'contains', 'in', 'not'. +The 'not' operator is only used with 'in', 'like', or 'contains'. +The '=' and 'eq' operator are the same. +String values can be surrounded with either single or double quotes. +IE (RemoteAgentLastContact \<= 2019-12-18T00:50:19.575Z) +Boolean values are specified as 'true' or 'false'. +Parenthesis can be used to control the order of operations and group conditions. + +```yaml +Type: String +Parameter Sets: ByCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IncludeFields +{{ Fill IncludeFields Description }} + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExcludeFields +{{ Fill ExcludeFields Description }} + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrderBy +A comma separated list of fields that you want to order by finishing with either an asc or desc. + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupName +Group name to search for, uses wildcards so full Group name is not needed + +```yaml +Type: String +Parameter Sets: CustomBuiltCondition +Aliases: Group + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Client objects +## NOTES +Version: 1.0 +Author: Marcus Tedde +Creation Date: 2023-12-11 +Purpose/Change: Initial script development + +## RELATED LINKS From 17fa838d4da0ba661fd45e9dabbe8aa757574d10 Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 14:56:00 +0000 Subject: [PATCH 3/8] Update Get-AutomateGroup.ps1 --- Public/Get-AutomateGroup.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Public/Get-AutomateGroup.ps1 b/Public/Get-AutomateGroup.ps1 index 53d2001..62a3f3e 100644 --- a/Public/Get-AutomateGroup.ps1 +++ b/Public/Get-AutomateGroup.ps1 @@ -17,7 +17,7 @@ function Get-AutomateGroup { .PARAMETER GroupID GroupID to search for, integer, -GroupID 1 .OUTPUTS - Client objects + Group objects .NOTES Version: 1.0 Author: Marcus Tedde @@ -28,7 +28,7 @@ function Get-AutomateGroup { .EXAMPLE Get-AutomateGroup -GroupId 4 .EXAMPLE - Get-AutomateGroup -GroupName "Rancor" + Get-AutomateGroup -GroupName "PatchingGroup1" .EXAMPLE Get-AutomateGroup -Condition "(TypeName = 'Patching')" #> From 51956ba678da59b8cd19ec4c20b5adc19c2e5ada Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 15:29:47 +0000 Subject: [PATCH 4/8] Update Get-AutomateGroup.ps1 --- Public/Get-AutomateGroup.ps1 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Public/Get-AutomateGroup.ps1 b/Public/Get-AutomateGroup.ps1 index 62a3f3e..70b59d0 100644 --- a/Public/Get-AutomateGroup.ps1 +++ b/Public/Get-AutomateGroup.ps1 @@ -66,11 +66,11 @@ function Get-AutomateGroup { $ArrayOfConditions = @() - if ($ClientID) { + if ($GroupID) { Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -IDs $(($GroupID) -join ",") } - if ($AllClients) { + if ($AllGroups) { Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy } @@ -78,23 +78,23 @@ function Get-AutomateGroup { Return Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -Condition $Condition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy } - if ($ClientName) { + if ($GroupName) { $ArrayOfConditions += "(Name like '%$GroupName%')" } - $ClientFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions + $GroupFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions - $Clients = Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -Condition $ClientFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + $Groups = Get-AutomateAPIGeneric -AllResults -Endpoint "Groups" -Condition $GroupFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy $FinalResult = @() - foreach ($Client in $Clients) { + foreach ($Group in $Groups) { $ArrayOfConditions = @() - $ArrayOfConditions += "(Client.Id = '$($Client.Id)')" + $ArrayOfConditions += "(Group.Id = '$($Group.Id)')" $LocationFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions $Locations = Get-AutomateAPIGeneric -AllResults -Endpoint "locations" -Condition $LocationFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy - $FinalClient = $Client - Add-Member -inputobject $FinalClient -NotePropertyName 'Locations' -NotePropertyValue $locations - $FinalResult += $FinalClient + $FinalGroup = $Group + Add-Member -inputobject $FinalGroup -NotePropertyName 'Locations' -NotePropertyValue $locations + $FinalResult += $FinalGroup } return $FinalResult From 6da7916ae5eaa38d03cf883b2043b63b5ebf70aa Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 15:44:42 +0000 Subject: [PATCH 5/8] Create Get-AutomatePatchingGroup.ps1 --- Public/Get-AutomatePatchingGroup.ps1 | 101 +++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 Public/Get-AutomatePatchingGroup.ps1 diff --git a/Public/Get-AutomatePatchingGroup.ps1 b/Public/Get-AutomatePatchingGroup.ps1 new file mode 100644 index 0000000..ab87e7b --- /dev/null +++ b/Public/Get-AutomatePatchingGroup.ps1 @@ -0,0 +1,101 @@ +function Get-AutomatePatchingGroup { + <# + .SYNOPSIS + Get Group Patching information out of the Automate API + .DESCRIPTION + Connects to the Automate API and returns one or more full Group Patching objects + .PARAMETER AllGroups + Returns all Patching Groups in Automate, regardless of amount + .PARAMETER Condition + A custom condition to build searches that can be used to search for specific things. Supported operators are '=', 'eq', '>', '>=', '<', '<=', 'and', 'or', '()', 'like', 'contains', 'in', 'not'. + The 'not' operator is only used with 'in', 'like', or 'contains'. The '=' and 'eq' operator are the same. String values can be surrounded with either single or double quotes. IE (RemoteAgentLastContact <= 2019-12-18T00:50:19.575Z) + Boolean values are specified as 'true' or 'false'. Parenthesis can be used to control the order of operations and group conditions. + .PARAMETER OrderBy + A comma separated list of fields that you want to order by finishing with either an asc or desc. + .PARAMETER GroupName + Group name to search for, uses wildcards so full Patching Group name is not needed + .PARAMETER GroupID + GroupID to search for, integer, -GroupID 1 + .OUTPUTS + Client objects + .NOTES + Version: 1.0 + Author: Marcus Tedde + Creation Date: 2023-12-11 + Purpose/Change: Initial script development + .EXAMPLE + Get-AutomatePatchingGroup -AllGroups + .EXAMPLE + Get-AutomatePatchingGroup -GroupId 4 + .EXAMPLE + Get-AutomatePatchingGroup -GroupName "PatchingGroup1" + .EXAMPLE + Get-AutomatePatchingGroup -Condition "(MicrosoftUpdatePolicy/Name = 'MSUPDATE')" + #> + param ( + [Parameter(Mandatory = $false, Position = 0, ParameterSetName = "IndividualGroup")] + [Alias('ID')] + [int32[]]$GroupId, + + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [switch]$AllGroups, + + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$Condition, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$IncludeFields, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$ExcludeFields, + + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [Parameter(Mandatory = $false, ParameterSetName = "AllResults")] + [Parameter(Mandatory = $false, ParameterSetName = "ByCondition")] + [string]$OrderBy, + + [Alias("Group")] + [Parameter(Mandatory = $false, ParameterSetName = "CustomBuiltCondition")] + [string]$GroupName + ) + + $ArrayOfConditions = @() + + + if ($GroupID) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "GroupPatchingPolicies" -IDs $(($GroupID) -join ",") + } + + if ($AllGroups) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "GroupPatchingPolicies" -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + } + + if ($Condition) { + Return Get-AutomateAPIGeneric -AllResults -Endpoint "GroupPatchingPolicies" -Condition $Condition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + } + + if ($GroupName) { + $ArrayOfConditions += "(GroupName like '%$GroupName%')" + } + + $GroupFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions + + $Groups = Get-AutomateAPIGeneric -AllResults -Endpoint "GroupPatchingPolicies" -Condition $GroupFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + + $FinalResult = @() + foreach ($Group in $Groups) { + $ArrayOfConditions = @() + $ArrayOfConditions += "(Group.Id = '$($Group.Id)')" + $LocationFinalCondition = Get-ConditionsStacked -ArrayOfConditions $ArrayOfConditions + $Locations = Get-AutomateAPIGeneric -AllResults -Endpoint "locations" -Condition $LocationFinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + $FinalGroup = $Group + Add-Member -inputobject $FinalGroup -NotePropertyName 'Locations' -NotePropertyValue $locations + $FinalResult += $FinalGroup + } + + return $FinalResult + } From b56a0ea6a8857c70d063df25d95d5acad401233b Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Mon, 11 Dec 2023 15:47:52 +0000 Subject: [PATCH 6/8] Create Get-AutomatePatchingGroup.md --- Docs/Get-AutomatePatchingGroup.md | 191 ++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 Docs/Get-AutomatePatchingGroup.md diff --git a/Docs/Get-AutomatePatchingGroup.md b/Docs/Get-AutomatePatchingGroup.md new file mode 100644 index 0000000..ffeda7a --- /dev/null +++ b/Docs/Get-AutomatePatchingGroup.md @@ -0,0 +1,191 @@ +--- +external help file: AutomateAPI-help.xml +Module Name: AutomateAPI +online version: +schema: 2.0.0 +--- + +# Get-AutomatePatchingGroup + +## SYNOPSIS +Get Group Patching information out of the Automate API + +## SYNTAX + +### IndividualGroup +``` +Get-AutomatePatchingGroup [[-GroupId] ] [] +``` + +### AllResults +``` +Get-AutomatePatchingGroup [-AllGroups] [-IncludeFields ] [-ExcludeFields ] [-OrderBy ] + [] +``` + +### ByCondition +``` +Get-AutomatePatchingGroup [-Condition ] [-IncludeFields ] [-ExcludeFields ] + [-OrderBy ] [] +``` + +### CustomBuiltCondition +``` +Get-AutomatePatchingGroup [-IncludeFields ] [-ExcludeFields ] [-OrderBy ] + [-GroupName ] [] +``` + +## DESCRIPTION +Connects to the Automate API and returns one or more full Patching Group objects + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AutomatePatchingGroup -AllGroups +``` + +### EXAMPLE 2 +``` +Get-AutomatePatchingGroup -GroupId 4 +``` + +### EXAMPLE 3 +``` +Get-AutomatePatchingGroup -GroupName "PatchingGroup1" +``` + +### EXAMPLE 4 +``` +Get-AutomatePatchingGroup -Condition "(MicrosoftUpdatePolicy/Name = 'MSUPDATE')" +``` + +## PARAMETERS + +### -GroupId +GroupId to search for, integer, -GroupId 1 + +```yaml +Type: Int32[] +Parameter Sets: IndividualGroup +Aliases: ID + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AllGroups +Returns all Patching Groups in Automate, regardless of amount + +```yaml +Type: SwitchParameter +Parameter Sets: AllResults +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Condition +A custom condition to build searches that can be used to search for specific things. +Supported operators are '=', 'eq', '\>', '\>=', '\<', '\<=', 'and', 'or', '()', 'like', 'contains', 'in', 'not'. +The 'not' operator is only used with 'in', 'like', or 'contains'. +The '=' and 'eq' operator are the same. +String values can be surrounded with either single or double quotes. +IE (RemoteAgentLastContact \<= 2019-12-18T00:50:19.575Z) +Boolean values are specified as 'true' or 'false'. +Parenthesis can be used to control the order of operations and group conditions. + +```yaml +Type: String +Parameter Sets: ByCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IncludeFields +{{ Fill IncludeFields Description }} + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExcludeFields +{{ Fill ExcludeFields Description }} + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrderBy +A comma separated list of fields that you want to order by finishing with either an asc or desc. + +```yaml +Type: String +Parameter Sets: AllResults, ByCondition, CustomBuiltCondition +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GroupName +Group name to search for, uses wildcards so full Group name is not needed + +```yaml +Type: String +Parameter Sets: CustomBuiltCondition +Aliases: Group + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Client objects +## NOTES +Version: 1.0 +Author: Marcus Tedde +Creation Date: 2023-12-11 +Purpose/Change: Initial script development + +## RELATED LINKS From dd2e44b1bff7bdc6b67b7acda1f892e01735af29 Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Tue, 12 Dec 2023 11:15:23 +0000 Subject: [PATCH 7/8] Create Get-AutomateComputerServices.ps1 --- Public/Get-AutomateComputerServices.ps1 | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Public/Get-AutomateComputerServices.ps1 diff --git a/Public/Get-AutomateComputerServices.ps1 b/Public/Get-AutomateComputerServices.ps1 new file mode 100644 index 0000000..eed8a54 --- /dev/null +++ b/Public/Get-AutomateComputerServices.ps1 @@ -0,0 +1,34 @@ +function Get-AutomateComputerServices { + <# + .SYNOPSIS + Get Computer's Services information out of the Automate API + .DESCRIPTION + Connects to the Automate API and returns all services for specified computer object. + .PARAMETER ComputerID + Can take either single ComputerID integer, IE 1, or an array of ComputerID integers, IE 1,5,9. Limits results to include only specified IDs. + .OUTPUTS + Computer Services Objects + .NOTES + Version: 1.0 + Author: Marcus Tedde + Creation Date: 2023-12-12 + Purpose/Change: Initial script development + .EXAMPLE + Get-AutomateComputerServices -ComputerID 1 + #> + param ( + [Parameter(Mandatory = $false, Position = 0)] + [Alias('ID')] + [int32[]]$ComputerID + ) + + $RequestParameters = @{ + 'AllResults' = $True + 'Endpoint' = "computers/$ComputerID/services" + } + + Get-AutomateAPIGeneric @RequestParameters + + # $FinalResult = Get-AutomateAPIGeneric -AllResults -Endpoint "computers" -Condition $FinalCondition -IncludeFields $IncludeFields -ExcludeFields $ExcludeFields -OrderBy $OrderBy + # return $FinalResult +} From ef3f988fc0723d1328a2012d4798866956a582f3 Mon Sep 17 00:00:00 2001 From: Marcus Tedde Date: Tue, 12 Dec 2023 11:18:40 +0000 Subject: [PATCH 8/8] Create Get-AutomateComputerServices.md --- Docs/Get-AutomateComputerServices.md | 57 ++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Docs/Get-AutomateComputerServices.md diff --git a/Docs/Get-AutomateComputerServices.md b/Docs/Get-AutomateComputerServices.md new file mode 100644 index 0000000..35c029e --- /dev/null +++ b/Docs/Get-AutomateComputerServices.md @@ -0,0 +1,57 @@ +--- +external help file: AutomateAPI-help.xml +Module Name: AutomateAPI +online version: +schema: 2.0.0 +--- + +# Get-AutomateComputerServices + +## SYNOPSIS +Get Computer's Services information out of the Automate API + +## SYNTAX + +## DESCRIPTION +Connects to the Automate API and returns all services for specified computer object. + +## EXAMPLES + +### EXAMPLE 1 +``` +Get-AutomateComputerServices -ComputerID 1 +``` + +## PARAMETERS + +### -ComputerID +Can take either single ComputerID integer, IE 1, or an array of ComputerID integers, IE 1,5,9. +Limits results to include only specified IDs. + +```yaml +Type: Int32[] +Parameter Sets: (All) +Aliases: ID + +Required: False +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Computer Services Objects +## NOTES +Version: 1.0 +Author: Marcus Tedde +Creation Date: 2023-12-12 +Purpose/Change: Initial script development + +## RELATED LINKS