update
This commit is contained in:
61
GLPI/Extraction.ps1
Normal file
61
GLPI/Extraction.ps1
Normal file
@ -0,0 +1,61 @@
|
||||
Import-Module GlpiTools
|
||||
|
||||
Set-GlpiToolsConfig -PathToGlpi "https://glpi.fr.dgs.group/apirest.php" -AppToken "A37784iAbavHXtNKOome2zhBv1bKW7ycDSkJTtk8" -UserToken "xoRND6NwIcQ8qlEz1MOJCGOhHsOlf7DDmMRQETWu"
|
||||
|
||||
$ListeTicket = Get-GlpiToolsTickets -TicketName "[OPCON]"
|
||||
|
||||
$Extraction = @()
|
||||
$percentComplete = $null
|
||||
$Counter = $null
|
||||
$listeTechniciens = $null
|
||||
|
||||
ForEach($Ticket in $ListeTicket) {
|
||||
|
||||
$percentComplete = $(($Counter / $ListeTicket.Count) * 100 )
|
||||
|
||||
$Progress = @{
|
||||
Activity = "Getting folder information for '$($Ticket.Titre)'."
|
||||
Status = "Processing $Counter of $($ListeTicket.Count)"
|
||||
PercentComplete = $([math]::Round($percentComplete, 2))
|
||||
}
|
||||
|
||||
Write-Progress @Progress -Id 1
|
||||
|
||||
If ($Ticket.Statut -ne "6") {
|
||||
If ($Ticket.Technicien) {
|
||||
$Technicien = Get-GlpiToolsUsers -UserId $Ticket.Technicien
|
||||
|
||||
If ($Technicien.Count -le "1") {
|
||||
$Extraction += [pscustomobject]@{
|
||||
ID = $Ticket.ID
|
||||
Titre = $Ticket.Titre
|
||||
Entité = $Ticket.Entité
|
||||
Demandeur = $Ticket.Demandeur
|
||||
Status = $Ticket.Statut
|
||||
Date_ouverture = $Ticket."Date d'ouverture"
|
||||
Groupe_techniciens = $Ticket."Groupe de techniciens"
|
||||
Technicien = $Technicien.realname+" "+$Technicien.firstname
|
||||
}
|
||||
}
|
||||
Else {
|
||||
Foreach ($tmp in $Technicien) {
|
||||
$listeTechniciens += $tmp.realname + " " + $tmp.firstname + "`n"
|
||||
}
|
||||
$Extraction += [pscustomobject]@{
|
||||
ID = $Ticket.ID
|
||||
Titre = $Ticket.Titre
|
||||
Entité = $Ticket.Entité
|
||||
Demandeur = $Ticket.Demandeur
|
||||
Status = $Ticket.Statut
|
||||
Date_ouverture = $Ticket."Date d'ouverture"
|
||||
Groupe_techniciens = $Ticket."Groupe de techniciens"
|
||||
Technicien = $listeTechniciens
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$Counter++
|
||||
$listeTechniciens = $null
|
||||
}
|
||||
|
||||
$Extraction | Export-CSV -Path "C:\Ntico\OPCON_BIRT\ReportEngine\rapports\FichierIn\ExtractionGlpi-V2.0.csv" -Force -Encoding UTF8 -NoTypeInformation
|
Reference in New Issue
Block a user