< Back

Get-GlpiToolsItems

Mon Jan 13, 2020 10:04 pm

NAME Get-GlpiToolsItems



SYNOPSIS

Function is getting all the items of a specific type in GLPI (also feature SearchText).





SYNTAX

Get-GlpiToolsItems [-ItemType] <String> [[-SearchText] <Hashtable>] [[-Raw] <Boolean>] [[-SearchInTrash]

<Boolean>] [[-OnlyId] <Boolean>] [[-ExtraParameter] <String>] [<CommonParameters>]





DESCRIPTION

Function is getting all the items of a specific type in GLPI.

Can be filter with SearchText paramter

Like https://github.com/glpi-project/glpi/bl ... -all-items





PARAMETERS

-ItemType <String>

Type of item wanted.

Exemples : Computer, Monitor, User, Group_Ticket, Group_User, etc.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SearchText <Hashtable>

SearchText (default NULL): hashtable of filters to pass on the query (with key = field and value = the text to

search).

By default it act as a '-like "*value*"'. Use ^ and $ to force an exact match. Eg. SearchText =

@{"groups_id"="^10$" ; "type"="^2$"}

This parameter can take pipeline input.



Required? false

Position? 2

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Raw <Boolean>

Raw is always ON if the return contain more that one object.

If the return contain only one object and RAW is not use, parameters will be converted (expanded to show name

instead of ID).

Use the parameter RAW to force to show ID in ALL cases.



Required? false

Position? 3

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-SearchInTrash <Boolean>

(default: false): Return deleted element. Optional



Required? false

Position? 4

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-OnlyId <Boolean>

(default: false): keep only id keys in returned data. Optional.



Required? false

Position? 5

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-ExtraParameter <String>

String append to the query for extra option. Refer to apirest.php.

Ex. "&only_id=true" or "&with_infocoms", etc..



Required? false

Position? 6

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

SearchText hashtable.





OUTPUTS

Function returns PSCustomObject with property's of Object from GLPI





NOTES





SilentBob999 10/2019



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



PS C:\\>Get-GlpiToolsItems -ItemType "Group_Ticket"



Function gets all items from Group_Ticket









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



PS C:\\>@{"groups_id"="^10$" ; "type"="^2$"} | Get-GlpiToolsItems -ItemType "Group_Ticket"



Function gets SearchCriteria from Pipeline, and return GLPI object









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



PS C:\\>@{"groups_id"="^10$" ; "type"="^2$"} , @{"groups_id"="^15$" ; "type"="^2$"} | Get-GlpiToolsItems

-ItemType "Group_Ticket"



Function gets multiple SearchCriteria from Pipeline, and return GLPI object









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



PS C:\\>Get-GlpiToolsItems -ItemType "Group_Ticket" -SearchText @{"groups_id"="^10$" ; "type"="^2$"}



Function gets GLPI object filter by SearchText.









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



PS C:\\>Get-GlpiToolsItems -ItemType "Ticket" -SearchText @{"id"="^234$"} -Raw



Example will show Ticket with id 234, but without any parameter converted









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



PS C:\\>@{"id"="^234$"} | Get-GlpiToolsItems -ItemType "Ticket" -Raw



Example will show Ticket with id 234, but without any parameter converted









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



PS C:\\>Get-GlpiToolsItems -ItemType "Ticket" -SearchInTrash $true



Example will return glpi Ticket, but from trash











RELATED LINKS