While working through some errors in the EPM event logs, specifically errors similar to these ones https://community.ivanti.com/docs/DOC-29329, I needed an easy way to validate against all the devices that had failed to scan into the system without simply waiting for it to occur.
Sadly, no easy logging mechanism exists to export a list of devices that have had recent scan failures. That’s where powershell and another utility I wrote comes in.
I wanted PowerShell to parse through all the .scn files in the ErrorScan folder and return me a text file with the device names. This is the code I used:
$ErrorScanFolder = "C:\Program Files\LANDesk\ManagementSuite\ldscan\ErrorScan"
$OutFileLoc = "C:\Temp\DeviceNameList.txt"
Get-ChildItem $ErrorScanFolder -Filter *.scn |
ForEach-Object {
$istag = Get-Content $_.FullName | Where-Object {$_ -like "Device Name =*"}
$istag = $istag -replace "Device Name =", ""
if ($istag) {
Write-Host $istag
$istag | Out-File $OutFileLoc -Append -Encoding ascii
}
}
After a few minutes, I had my device list with all the assets I wanted to rescan. I wrote my own utility to take a list of devices from a text file and import them into a device group within EPM. I’ll try to post that to GitHub at some point, I know many others have looked for a built in solution that can do the trick, but for now, you’ll have to figure out how you want to do this yourself.
Once I had my device group, it was easy to reschedule an inventory scan so I could identify quickly which devices continued to fail and begin to troubleshoot whatever unique issue it was having.