ITGlue integration

Adding a request on behalf of a community member for ITGlue integration.
They would like to see Immy being able to create configurations in ITGlue from Immy.

Some example code that may assist for this:

$TestResults = [Ordered]@{}
$verbosepreference = 'continue'
$ITGlueAPIEndpoint = 'https://api.itglue.com'
$ITGlueAPIKey = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' # password access
#$ITGConfigID = 'XXXXXXXXX'

Import-ImmyITGlueModule
Add-ITGlueBaseURI -base_uri $ITGlueAPIEndpoint
Add-ITGlueAPIKey -Api_Key $ITGlueAPIKey

#Get-ITGlueUsers | %{$_.data}
$PrimaryITGlueOrg = Get-ITGlueOrganizations| %{$_.data} | ?{$_.Attributes.Primary} #| ?{$_.Attributes."organization-type-name" -eq 'Owner'}
#$PrimaryITGlueOrg.Attributes

Function Get_Existing_Config_ID
{  
    $computer = Get-ImmyComputer -InventoryKeys WindowsSystemInfo
    $SerialNumber = $Computer | %{$_.Inventory.WindowsSystemInfo.SerialNumber} 
    if(!$SerialNumber)
    {
        Write-Error "Unable to determine SerialNumber for computer" -ErrorAction Stop
    }
    Write-Verbose "SerialNumber: $($SerialNumber | fl * | Out-String)"
    $ComputerConfiguration = Get-ITGlueConfigurations -filter_serial_number $SerialNumber | Select-Object -Expand Data | Select-Object -Last 1
    Write-Verbose ($ComputerConfiguration | ConvertTo-Json -depth 5)
    Return ($ComputerConfiguration).ID    
}

Function Get-Config-Type-ID
{if($computer.OperatingSystemName -match "Windows.*Server") {

  # Set to server type
  $config_type_id = 11332 

}
else {
 
  # Set to workstation type
  $config_type_id = 11333

} 
return $config_type_id
}

Function Get-Org-ID
{
    $params = @{
    filter_name = $ImmyTenant
    }

    Get-ITGlueOrganizations @params | ForEach-Object { 
    $_.data.id
}
}

Function New_or_Update_Config
{
$ConfigData = @{} 

# Add required attributes
$ConfigData['type'] = 'configurations'
$ConfigData['attributes'] = @{}
$ConfigData['attributes']['name'] = (Get-ImmyComputer).Name 
$ConfigData['attributes']['configuration-type-id'] = Get-Config-Type-ID # Managed Workstation = 11333 and Manage Server = 11332

# Add additional attributes
#$ConfigData['attributes']['operating-system-id'] = 225 # Windows 11
#$ConfigData['attributes']['manufacturer-id'] = 12345 # Dell
#$ConfigData['attributes']['model-id'] = 67890 # OptiPlex 7090
$ConfigData['attributes']['serial-number'] = $SerialNumber
#$ConfigData['attributes']['location-id'] = 3485940 # Main
#$ConfigData['attributes']['contact-id'] = 8823386
$ConfigData['attributes']['organization-id'] = Get-Org-ID

if($NewConfig)
{New-ITGlueConfigurations -data $ConfigData}
else
{Set-ITGlueConfigurations -data $ConfigData}
}

$computer = Get-ImmyComputer -InventoryKeys WindowsSystemInfo
$ImmyTenant = ($Computer).TenantName

Adding device configurations would be sweet. I bet the reverse could be useful, too (ie. importing software licenses)

3 Likes

I could see this being helpful in a number of ways. Yes!

Was just thinking that, in addition to device configurations, if a task could further set BitLocker keys as embedded passwords on those configurations…

Chefs Kiss Meme - Music Used

@Dakota_Lewis we have a maintenance task that backs up Bitlocker keys to the matched Configuration in IT Glue. Glad to share.

That would honestly be amazing! Does it (or can it) also create the configuration if one doesn’t exist?

Currently it doesn’t but it would be pretty easy to adapt. We’re relying on Manage/Automate to create the Configurations since those ITG integrations don’t match on manually created ones and then we’d have duplicates.

Fair enough, we use N-Central for configurations, but it doesn’t always seem to work. Regardless, even having something like that for available configurations would be great!