Troubleshoot · 2 tools
Inactive Configuration Manager clients in a collection
Summary
Lists devices in a collection whose ConfigMgr client is inactive or missing, with the last activity time, so you can repair clients before a deployment or a co-management change.
Implementation
Choose your tool. Your choice is remembered on other samples.
# Run from a machine with the ConfigMgr console
Import-Module "$($env:SMS_ADMIN_UI_PATH)\..\ConfigurationManager.psd1"
$site = (Get-PSDrive -PSProvider CMSite).Name
Set-Location "$($site):"
Get-CMDevice -CollectionName "All Desktop and Server Clients" |
Where-Object { -not $_.IsClient -or -not $_.IsActive } |
Select-Object Name, IsClient, IsActive, ClientActiveStatus, LastActiveTime, LastPolicyRequest, DeviceOS |
Export-Csv "$env:USERPROFILE\inactive-clients.csv" -NoTypeInformation$site = "<SiteCode>"; $server = "<SiteServer>"
Get-CimInstance -ComputerName $server -Namespace "root\SMS\site_$site" -ClassName SMS_R_System |
Where-Object { $_.Client -ne 1 -or $_.Active -ne 1 } |
Select-Object Name, Client, Active, LastLogonTimestamp |
Export-Csv .\inactive-clients.csv -NoTypeInformationPrerequisites
- Configuration Manager console installed
- Read-only Analyst or higher
Output
CSV of inactive or client-less devices.
Related answers
Contributors
| Author | Role |
|---|---|
| Priyanshu Upadhyay | Solution Architect, Microsoft 365 and Azure |
InnovaticT