### Get Inactive Devices and Application Control Policies Source: https://github.com/dynamicit/threatlocker/blob/main/README.md Retrieves details of all computers, identifies inactive ones based on a cutoff date, and exports their associated Application Control policies and computer details to JSONL and CSV files respectively. Use this to identify devices for ThreatLocker support to orphan. ```powershell Connect-ThreatLocker -Instance g $allComputers = Get-ThreatLockerOrg | Get-ThreatLockerComputerDetail $allComputers | ForEach-Object { ConvertTo-Json -Depth 5 -Compress -InputObject $_ } | Set-Content "allComputers_$( Get-Date -Format FileDateTime ).jsonl" $cutoffDate = (Get-Date).AddDays(-45) if ($PSVersionTable.PSEdition -eq 'Desktop') { # we will use string comparison for dates in PowerShell 5.1 $cutoffDate = $cutoffDate.ToUniversalTime().ToString('yyyy-MM-ddTHH:MM:ssZ') } $inactiveComputers = $allComputers | ?{ $_.lastCheckin -lt $cutoffDate -and $_.dateAdded -lt $cutoffDate } $inactiveAcPolicies = $inactiveComputers | Get-ThreatLockerACPolicy $inactiveAcPolicies | ForEach-Object { ConvertTo-Json -Depth 5 -Compress -InputObject $_ } | Set-Content "inactivePolicy_$( Get-Date -Format FileDateTime ).jsonl" $inactivePath = "inactiveComputers_$( Get-Date -Format FileDateTime ).csv" $inactiveComputers | Select-Object computerName, computerId, organization, lastCheckin | Sort-Object lastCheckin | Export-Csv $inactivePath Write-Host "Please send $inactivePath to ThreatLocker support to process." ``` -------------------------------- ### Copy Application Control Application to Another Organization Source: https://github.com/dynamicit/threatlocker/blob/main/README.md Finds an existing Application Control application by name within a specified organization and copies it to a different target organization. This is useful for cloning application definitions. ```powershell Connect-ThreatLocker -UseBrowser $matchingApps = Get-ThreatLockerACApp -Org 'My Company' -Search 'Example Software' -IncludeUnused $matchingApps | ft -auto $sourceApp = $matchingApps[0] $sourceApp | Copy-ThreatLockerACApp -NewOrg 'Target Company' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.