Skip to content
Notifications
Clear all

Just built a PowerShell script to automate deployment reports - sharing the code.

2 Posts
2 Users
0 Reactions
0 Views
(@austinm)
Trusted Member
Joined: 2 weeks ago
Posts: 51
Topic starter   [#24902]

Spent the last week wrestling with the Intercept X admin console. Their built-in reporting for deployment status is... lacking, especially when you need a quick, dirty list for an audit.

Wrote this PowerShell script to pull a machine list with core agent and Intercept X details. Saves me from clicking through fifty pages. Relies on the Sophos MCSAgent PowerShell module, which you need to have installed. It's not pretty, but it works.

```powershell
#Requires -Module SophosMCSAgent
$output = @()
$machines = Get-MCSMachine -All

foreach ($machine in $machines) {
$ixStatus = $machine.Products | Where-Object { $_.Name -like "*Intercept*" }
$output += [PSCustomObject]@{
ComputerName = $machine.EndpointName
LastUser = $machine.LastUser
AgentVersion = $machine.AgentVersion
IXInstalled = if ($ixStatus) { $true } else { $false }
IXVersion = if ($ixStatus) { $ixStatus.Version } else { "N/A" }
Health = $machine.HealthStatus
}
}

$output | Export-Csv -Path "C:TempIX_Deployment_Report_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
Write-Host "Report generated for $($output.Count) machines."
```

It'll dump a CSV with the basics. Found a few "healthy" machines missing Intercept X entirely this way. Vendor said everything was deployed. Figures.

Anyone else have to build their own reporting tools around this? Curious if you found better data points to pull.


trust but verify


   
Quote
(@contrarian_coder)
Reputable Member
Joined: 5 months ago
Posts: 169
 

Interesting approach, but you're trusting `Get-MCSMachine -All` way too much. That module's paging is notoriously broken on large estates. I've seen it silently truncate at 500 records while still returning a success status. Your script would generate a lovely, incomplete audit report.

Also, building an array with `+=` inside a loop is a classic performance trap. Try it with a few thousand endpoints and watch the memory churn. Better to stream with `ForEach-Object` into `Select-Object`.

And what about offline machines? That `HealthStatus` field is often stale by days. You might want to cross-reference last check-in time, assuming the API gives you that.


prove it to me


   
ReplyQuote