< Back
Get-ZabbixHostInventory
Post
NAME Get-ZabbixHostInventory
SYNOPSIS
Get host's inventory
SYNTAX
Get-ZabbixHostInventory [[-HostName] <Array>] [[-HostID] <Array>] [[-GroupID] <Array>] [[-InventoryMode] <Array>]
[[-SortBy] <String>] [[-status] <String>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL]
<String>] [<CommonParameters>]
DESCRIPTION
Get host's inventory
PARAMETERS
-HostName <Array>
To filter by HostName of the host (case sensitive)
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HostID <Array>
To filter by HostID of the host
Required? false
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-GroupID <Array>
Required? false
Position? 3
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-InventoryMode <Array>
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SortBy <String>
Required? false
Position? 5
Default value name
Accept pipeline input? false
Accept wildcard characters? false
-status <String>
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$true)][string]$hostids,
Required? false
Position? 6
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-jsonrpc <String>
Required? false
Position? 7
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-session <String>
Required? false
Position? 8
Default value ($global:zabSessionParams.session)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-id <String>
Required? false
Position? 9
Default value ($global:zabSessionParams.id)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-URL <String>
Required? false
Position? 10
Default value ($global:zabSessionParams.url)
Accept pipeline input? true (ByPropertyName)
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-ZabbixHostInventory -HostName HostName1,HostName2
Get full inventory for host (HostName is case sensitive)
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match host | ? inventory | Get-ZabbixHostInventory
Get hosts with inventory
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixHostInventory HostName1,HostName2 | ? os | select name,os,tag | ft -a
Get inventory for hosts (HostName is case sensitive)
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>(gc server-HostNames.txt) | %{Get-ZabbixHostInventory $_ | select name,os,tag } | ft -a
Get inventory for hosts (HostName is case sensitive))
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-ZabbixHostInventory -HostID (gc server-hostids.txt | Out-String -Stream) | select
hostid,name,location,os,os_* | ft -a
Get inventory
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-ZabbixHostInventory -GroupID 15 | select name,os,os_full,os_short,location
Get inventory for host in host group 15
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixHostInventory -GroupID 15 | ? inventory_mode -eq 0 | select
hostid,@{n='hostname';e={(Get-ZabbixHost -HostID $_.hostid).host}},inventory_mode,name | ft -a
Get Inventory for hosts in specific host group with GroupID 15
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? name -eq HostGroup) | Get-ZabbixHostInventory | select hostid,name,os
Get inventory for hosts in HostGroup
-------------------------- EXAMPLE 9 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? name -eq HostGroup) | Get-ZabbixHostInventory | Set-ZabbixHostInventory -OSName
OSName
Set hosts' OSName to all hosts in HostGroup
-------------------------- EXAMPLE 10 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? groupid -eq 16) | Get-ZabbixHostInventory | select hostid,name,os,os_full
(Get-ZabbixHostGroup | ? groupid -eq 16) | Get-ZabbixHostInventory | Set-ZabbixHostInventory -OSFullName
"OSFullName"
Set hosts' OSName to all hosts in HostGroup
-------------------------- EXAMPLE 11 --------------------------
PS C:\\>Get-ZabbixHostInventory | ? os -match linux | select hostid,name,os,tag | sort os | ft -a
Get only linux hosts
-------------------------- EXAMPLE 12 --------------------------
PS C:\\>Get-ZabbixHostInventory | ? os | group os -NoElement | sort count -desc
Get quantity of hosts for each OS
RELATED LINKS
SYNOPSIS
Get host's inventory
SYNTAX
Get-ZabbixHostInventory [[-HostName] <Array>] [[-HostID] <Array>] [[-GroupID] <Array>] [[-InventoryMode] <Array>]
[[-SortBy] <String>] [[-status] <String>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL]
<String>] [<CommonParameters>]
DESCRIPTION
Get host's inventory
PARAMETERS
-HostName <Array>
To filter by HostName of the host (case sensitive)
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-HostID <Array>
To filter by HostID of the host
Required? false
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-GroupID <Array>
Required? false
Position? 3
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-InventoryMode <Array>
Required? false
Position? 4
Default value
Accept pipeline input? false
Accept wildcard characters? false
-SortBy <String>
Required? false
Position? 5
Default value name
Accept pipeline input? false
Accept wildcard characters? false
-status <String>
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$true)][string]$hostids,
Required? false
Position? 6
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-jsonrpc <String>
Required? false
Position? 7
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-session <String>
Required? false
Position? 8
Default value ($global:zabSessionParams.session)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-id <String>
Required? false
Position? 9
Default value ($global:zabSessionParams.id)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-URL <String>
Required? false
Position? 10
Default value ($global:zabSessionParams.url)
Accept pipeline input? true (ByPropertyName)
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-ZabbixHostInventory -HostName HostName1,HostName2
Get full inventory for host (HostName is case sensitive)
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match host | ? inventory | Get-ZabbixHostInventory
Get hosts with inventory
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixHostInventory HostName1,HostName2 | ? os | select name,os,tag | ft -a
Get inventory for hosts (HostName is case sensitive)
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>(gc server-HostNames.txt) | %{Get-ZabbixHostInventory $_ | select name,os,tag } | ft -a
Get inventory for hosts (HostName is case sensitive))
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-ZabbixHostInventory -HostID (gc server-hostids.txt | Out-String -Stream) | select
hostid,name,location,os,os_* | ft -a
Get inventory
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-ZabbixHostInventory -GroupID 15 | select name,os,os_full,os_short,location
Get inventory for host in host group 15
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixHostInventory -GroupID 15 | ? inventory_mode -eq 0 | select
hostid,@{n='hostname';e={(Get-ZabbixHost -HostID $_.hostid).host}},inventory_mode,name | ft -a
Get Inventory for hosts in specific host group with GroupID 15
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? name -eq HostGroup) | Get-ZabbixHostInventory | select hostid,name,os
Get inventory for hosts in HostGroup
-------------------------- EXAMPLE 9 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? name -eq HostGroup) | Get-ZabbixHostInventory | Set-ZabbixHostInventory -OSName
OSName
Set hosts' OSName to all hosts in HostGroup
-------------------------- EXAMPLE 10 --------------------------
PS C:\\>(Get-ZabbixHostGroup | ? groupid -eq 16) | Get-ZabbixHostInventory | select hostid,name,os,os_full
(Get-ZabbixHostGroup | ? groupid -eq 16) | Get-ZabbixHostInventory | Set-ZabbixHostInventory -OSFullName
"OSFullName"
Set hosts' OSName to all hosts in HostGroup
-------------------------- EXAMPLE 11 --------------------------
PS C:\\>Get-ZabbixHostInventory | ? os -match linux | select hostid,name,os,tag | sort os | ft -a
Get only linux hosts
-------------------------- EXAMPLE 12 --------------------------
PS C:\\>Get-ZabbixHostInventory | ? os | group os -NoElement | sort count -desc
Get quantity of hosts for each OS
RELATED LINKS