< Back

Set-ZabbixHostGroupRemoveHosts

Sun Jan 19, 2020 6:14 pm

NAME Set-ZabbixHostGroupRemoveHosts



SYNOPSIS

Set host group: remove hosts from multiple groups





SYNTAX

Set-ZabbixHostGroupRemoveHosts [[-GroupName] <String>] [[-GroupID] <Array>] [[-HostID] <Array>] [[-TemplateID]

<Array>] [[-HostName] <Array>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL] <String>]

[-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Set host group: remove hosts from multiple groups





PARAMETERS

-GroupName <String>

To filter by name of the group



Required? false

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-GroupID <Array>

To filter by id of the group



Required? false

Position? 2

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostID <Array>



Required? false

Position? 3

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TemplateID <Array>



Required? false

Position? 4

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostName <Array>



Required? false

Position? 5

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 6

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? false

Accept wildcard characters? false



-session <String>



Required? false

Position? 7

Default value ($global:zabSessionParams.session)

Accept pipeline input? false

Accept wildcard characters? false



-id <String>



Required? false

Position? 8

Default value ($global:zabSessionParams.id)

Accept pipeline input? false

Accept wildcard characters? false



-URL <String>



Required? false

Position? 9

Default value ($global:zabSessionParams.url)

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-ZabbixHostGroup | ? name -eq hostGroup | select groupid -ExpandProperty hosts | ? host -match

hostsToRemove | Set-ZabbixHostGroupRemoveHosts



Remove hosts from the host group









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-ZabbixHostGroup | ? name -eq hostGroup | Set-ZabbixHostGroupRemoveHosts -HostID (Get-ZabbixHost | ?

name -match hostsToRemove).hostid



Remove hosts from the host group









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-ZabbixHostGroupRemoveHosts -GroupID ( Get-ZabbixHostGroup | ? name -match "hostGroup-0[1-6]").groupid

-HostID (Get-ZabbixHost | ? name -match "hostname-10[1-9]").hostid -hostName (Get-ZabbixHost | ? name -match

"hostname-10[1-9]").name -verbose



Remove hosts from the host groups with extra verbosity and validation









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-ZabbixHost | ? name -match hostsToRemove | Set-ZabbixHostGroupRemoveHosts -GroupID (Get-ZabbixHostGroup

| ? name -match hostGroup).groupid



Get-ZabbixHostGroup -GroupID 25 | select -ExpandProperty hosts

Get-ZabbixHostGroup | select groupid,name,hosts

1.Remove hosts from the host group 2.Validate the change 3.Validate the change









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Set-ZabbixHostGroupRemoveHosts -GroupID 25 -TemplateID (Get-ZabbixTemplate | ? name -match

"template1|template2").templateid



Remove templates from host group









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Set-ZabbixHostGroupRemoveHosts -GroupID 25 -TemplateID (Get-ZabbixTemplate | ? name -match

"template1|template2").templateid -HostID (Get-ZabbixHost | ? name -match "host").hostid



Get-ZabbixHostGroup -GroupID 25

1.Remove hosts and templates from the host group 2.Validate the change











RELATED LINKS