< Back

Set-ZabbixHostInventory

Sun Jan 19, 2020 6:14 pm

NAME Set-ZabbixHostInventory



SYNOPSIS

Set host's inventory





SYNTAX

Set-ZabbixHostInventory [[-HostID] <String>] [[-InventoryMode] <Int32>] [[-status] <String>] [-force] [[-Type]

<String>] [[-TypeDetails] <String>] [[-Name] <String>] [[-Alias] <String>] [[-OSName] <String>] [[-OSFullName]

<String>] [[-OSShortName] <String>] [[-SerialNumberA] <String>] [[-SerialNumberB] <String>] [[-Tag] <String>]

[[-AssetTag] <String>] [[-MACAddressA] <String>] [[-MACAddressB] <String>] [[-Hardware] <String>]

[[-DetailedHardware] <String>] [[-Software] <String>] [[-SoftwareDetails] <String>] [[-SoftwareApplicationA]

<String>] [[-SoftwareApplicationB] <String>] [[-SoftwareApplicationC] <String>] [[-SoftwareApplicationD] <String>]

[[-SoftwareApplicationE] <String>] [[-ContactPerson] <String>] [[-Location] <String>] [[-LocationLatitude]

<String>] [[-LocationLongitude] <String>] [[-Notes] <String>] [[-Chassis] <String>] [[-Model] <String>]

[[-HWArchitecture] <String>] [[-Vendor] <String>] [[-ContractNumber] <String>] [[-InstallerName] <String>]

[[-DeploymentStatus] <String>] [[-URLA] <String>] [[-URLB] <String>] [[-URLC] <String>] [[-HostNetworks] <String>]

[[-HostSubnetMask] <String>] [[-HostRouter] <String>] [[-OOBIPAddress] <String>] [[-OOBHostSubnetMask] <String>]

[[-OOBRouter] <String>] [[-HWPurchaseDate] <String>] [[-HWInstallationDate] <String>] [[-HWMaintenanceExpiryDate]

<String>] [[-HWDecommissioningDate] <String>] [[-SiteAddressA] <String>] [[-SiteAddressB] <String>]

[[-SiteAddressC] <String>] [[-SiteCity] <String>] [[-SiteState] <String>] [[-SiteCountry] <String>]

[[-SiteZIPCode] <String>] [[-SiteRackLocation] <String>] [[-SiteNotes] <String>] [[-PrimaryPOCName] <String>]

[[-PrimaryEmail] <String>] [[-PrimaryPOCPhoneA] <String>] [[-PrimaryPOCPhoneB] <String>]

[[-PrimaryPOCMobileNumber] <String>] [[-PrimaryPOCScreenName] <String>] [[-PrimaryPOCnNotes] <String>]

[[-SecondaryPOCName] <String>] [[-SecondaryPOCEmail] <String>] [[-SecondaryPOCPhoneA] <String>]

[[-SecondaryPOCPhoneB] <String>] [[-SecondaryPOCMobileNumber] <String>] [[-SecondaryPOCScreenName] <String>]

[[-SecondaryPOCNotes] <String>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL] <String>]

[<CommonParameters>]





DESCRIPTION

Set host's inventory





PARAMETERS

-HostID <String>

[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$False)][array]$HostName,



Required? false

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-InventoryMode <Int32>

[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$true)][string]$hostids,

Host inventory population mode: Possible values are: -1 - disabled; 0 - (default) manual; 1 - automatic.



Required? false

Position? 2

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-status <String>



Required? false

Position? 3

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-force [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Type <String>

[Alias("type")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Type,



Required? false

Position? 4

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TypeDetails <String>



Required? false

Position? 5

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Name <String>

[Alias("name")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Name,



Required? false

Position? 6

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Alias <String>

[Alias("alias")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Alias,



Required? false

Position? 7

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OSName <String>



Required? false

Position? 8

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OSFullName <String>

[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$OS,



Required? false

Position? 9

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OSShortName <String>



Required? false

Position? 10

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SerialNumberA <String>



Required? false

Position? 11

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SerialNumberB <String>



Required? false

Position? 12

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Tag <String>

[Alias("tag")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Tag,



Required? false

Position? 13

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-AssetTag <String>



Required? false

Position? 14

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-MACAddressA <String>



Required? false

Position? 15

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-MACAddressB <String>



Required? false

Position? 16

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Hardware <String>

[Alias("hardware")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Hardware,



Required? false

Position? 17

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-DetailedHardware <String>



Required? false

Position? 18

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Software <String>

[Alias("software")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Software,



Required? false

Position? 19

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareDetails <String>



Required? false

Position? 20

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareApplicationA <String>



Required? false

Position? 21

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareApplicationB <String>



Required? false

Position? 22

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareApplicationC <String>



Required? false

Position? 23

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareApplicationD <String>



Required? false

Position? 24

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SoftwareApplicationE <String>



Required? false

Position? 25

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-ContactPerson <String>



Required? false

Position? 26

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Location <String>

[Alias("location")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Location,



Required? false

Position? 27

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-LocationLatitude <String>



Required? false

Position? 28

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-LocationLongitude <String>



Required? false

Position? 29

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Notes <String>

[Alias("notes")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Notes,



Required? false

Position? 30

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Chassis <String>

[Alias("chassis")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Chassis,



Required? false

Position? 31

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Model <String>

[Alias("model")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Model,



Required? false

Position? 32

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HWArchitecture <String>



Required? false

Position? 33

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Vendor <String>

[Alias("vendor")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][string]$Vendor,



Required? false

Position? 34

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-ContractNumber <String>



Required? false

Position? 35

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-InstallerName <String>



Required? false

Position? 36

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-DeploymentStatus <String>



Required? false

Position? 37

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URLA <String>



Required? false

Position? 38

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URLB <String>



Required? false

Position? 39

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URLC <String>



Required? false

Position? 40

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostNetworks <String>



Required? false

Position? 41

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostSubnetMask <String>



Required? false

Position? 42

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostRouter <String>



Required? false

Position? 43

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OOBIPAddress <String>



Required? false

Position? 44

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OOBHostSubnetMask <String>



Required? false

Position? 45

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-OOBRouter <String>



Required? false

Position? 46

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HWPurchaseDate <String>



Required? false

Position? 47

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HWInstallationDate <String>



Required? false

Position? 48

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HWMaintenanceExpiryDate <String>



Required? false

Position? 49

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HWDecommissioningDate <String>



Required? false

Position? 50

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteAddressA <String>



Required? false

Position? 51

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteAddressB <String>



Required? false

Position? 52

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteAddressC <String>



Required? false

Position? 53

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteCity <String>



Required? false

Position? 54

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteState <String>



Required? false

Position? 55

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteCountry <String>



Required? false

Position? 56

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteZIPCode <String>



Required? false

Position? 57

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteRackLocation <String>



Required? false

Position? 58

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SiteNotes <String>



Required? false

Position? 59

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCName <String>



Required? false

Position? 60

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryEmail <String>



Required? false

Position? 61

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCPhoneA <String>



Required? false

Position? 62

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCPhoneB <String>



Required? false

Position? 63

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCMobileNumber <String>



Required? false

Position? 64

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCScreenName <String>



Required? false

Position? 65

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-PrimaryPOCnNotes <String>



Required? false

Position? 66

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCName <String>



Required? false

Position? 67

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCEmail <String>



Required? false

Position? 68

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCPhoneA <String>



Required? false

Position? 69

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCPhoneB <String>



Required? false

Position? 70

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCMobileNumber <String>



Required? false

Position? 71

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCScreenName <String>



Required? false

Position? 72

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SecondaryPOCNotes <String>



Required? false

Position? 73

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 74

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? 75

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? 76

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? 77

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-ZabbixHost | ? name -eq host | Set-ZabbixHost -InventoryMode 0



Enable manual inventory mode on host









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



PS C:\\>Get-ZabbixHostInventory | ? inventory_mode -eq 0 | select hostid,@{n='hostname';e={(Get-ZabbixHost -HostID

$_.hostid).host}},inventory_mode,name | ft -a



Get inventory enabled hosts









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



PS C:\\>Get-ZabbixHostInventory -HostName Hostname1,Hostname2 | Set-ZabbixHostInventory HostName1,HostName2

-OSFullName "OSFullName"



Set inventory









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



PS C:\\>Get-ZabbixHost | ? name -match "host-0[5-9]" | Set-ZabbixHostInventory -OSFullName "OSFullName"



Set inventory









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



PS C:\\>Get-ZabbixHostInventory | ? name -eq NameInInventory | Set-ZabbixHostInventory -OSFullName "OSFullName"



Set inventory for host, which inventory entry name is NameInInventory









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



PS C:\\>Get-ZabbixHostInventory | select @{n='hostname';e={(Get-ZabbixHost -HostID $_.hostid).host}},* | ? hostname

-match "host" | Set-ZabbixHostInventory -OSFullName "-OSFullName"



Set inventory entry for multiple hosts









-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-ZabbixHostInventory | ? name -match host | Set-ZabbixHostInventory -OSName " "



Delete inventory entry









-------------------------- EXAMPLE 8 --------------------------



PS C:\\>Get-ZabbixHostInventory -GroupID 15 | Set-ZabbixHostInventory -Location Location



Set inventory location to all, inventory enabled hosts, in host group 15









-------------------------- EXAMPLE 9 --------------------------



PS C:\\>Get-ZabbixHostInventory -GroupID 15 | select @{n='hostname';e={(Get-ZabbixHost -HostID $_.hostid).host}},*

| %{Set-ZabbixHostInventory -Name $_.hostname -HostID $_.hostid}



Copy hostname to inventory's name field









-------------------------- EXAMPLE 10 --------------------------



PS C:\\>Get-ZabbixHostInventory -GroupID 15 | ? location | Set-ZabbixHostInventory -Location Location



Set inventory location to hosts









-------------------------- EXAMPLE 11 --------------------------



PS C:\\>Import-csv C:\\input-inventory-mass-data.csv |

%{$splatParams=@{}}{$splatParams=(("$_").trim('@{}').replace("; ","`r`n") | ConvertFrom-StringData);

Set-ZabbixHostInventory @splatParams}



Mass inventory data population

(Get-ZabbixHostInventory -hostid (Import-csv C:\\Inventory-input.csv).hostid) -verbose | select hostid,os*

Data validation









-------------------------- EXAMPLE 12 --------------------------



PS C:\\>HostID,Type,TypeDetails,Name,Alias,OSName,OSFullName,OSShortName,SerialNumberA,SerialNumberB,Tag,AssetTag,MA

CAddressA,MACAddressB,Hardware,DetailedHardware,Software,SoftwareDetails,SoftwareApplicationA,SoftwareApplicationB,

SoftwareApplicationC,SoftwareApplicationD,SoftwareApplicationE,ContactPerson,Location,LocationLatitude,LocationLong

itude,Notes,Chassis,Model,HWArchitecture,Vendor,ContractNumber,InstallerName,DeploymentStatus,URLA,URLB,URLC,HostNe

tworks,HostSubnetMask,HostRouter,OOBIPAddress,OOBHostSubnetMask,OOBRouter,HWPurchaseDate,HWInstallationDate,HWMaint

enanceExpiryDate,HWDecommissioningDate,SiteAddressA,SiteAddressB,SiteAddressC,SiteCity,SiteState,SiteCountry,SiteZI

PCode,SiteRackLocation,SiteNotes,PrimaryPOCName,PrimaryEmail,PrimaryPOCPhoneA,PrimaryPOCPhoneB,PrimaryPOCMobileNumb

er,PrimaryPOCScreenName,PrimaryPOCnNotes,SecondaryPOCName,SecondaryPOCEmail,SecondaryPOCPhoneA,SecondaryPOCPhoneB,S

econdaryPOCMobileNumber,SecondaryPOCScreenName,SecondaryPOCNotes



10000,Type,TypeDetails,Name,Alias,OSName,DetailedOSName,ShortOSName,SerialNumberA,SerialNumberBB,Tag,AssetTag,MACAd

dressA,MACAddressB,Hardware,DetailedHardware,Software,SoftwareDetails,SoftwareApplicationA,SoftwareApplicationB,Sof

twareApplicationC,SoftwareApplicationD,SoftwareApplicationE,ContactPerson,Location,LocLat,LocLong,Notes,Chassis,Mod

el,HWArchitecture,Vendor,ContractNumber,InstallerName,DeploymentStatus,URLA,URLB,URLC,HostNetworks,HostSubnetMask,H

ostRouter,OOBIPAddress,OOBHostSubnetMask,OOBRouter,HWPurchaseDate,HWInstallationDate,HWMaintenanceExpiryDate,HWDeco

mmissioningDate,SiteAddressA,SiteAddressB,SiteAddressC,SiteCity,SiteState,SiteCountry,SiteZIPCode,SiteRackLocation,

SiteNotes,PrimaryPOCName,PrimaryEmail,PrimaryPOCPhoneA,PrimaryPOCPhoneB,PrimaryPOCMobileNumber,PrimaryPOCScreenName

,PrimaryPOCnNotes,SecondaryPOCName,SecondaryPOCEmail,SecondaryPOCPhoneA,SecondaryPOCPhoneB,SecondaryPOCMobileNumber

,SecondaryPOCScreenName,SecondaryPOCNotes

CSV file used in previous example











RELATED LINKS