Blog · 02

Un informe de cumplimiento de Intune que se puede enseñar a direcciónAn Intune compliance report you can hand to a manager

PowerShell saca los dispositivos de Microsoft Graph y Python los convierte en un informe y una lista de acciones.PowerShell pulls the devices from Microsoft Graph, Python turns them into a report and an action list.

El problema

El portal de Intune te dice que un equipo no cumple. No te da en una página la respuesta a "cómo vamos, por sistema operativo, y a qué equipos hay que perseguir esta semana".

Qué he hecho

  • scripts/Export-IntuneDevices.ps1 exporta los dispositivos gestionados por Microsoft Graph con un permiso de solo lectura.
  • Un informe en Python (solo librería estándar) que genera report.html: KPIs, cumplimiento por sistema operativo, dispositivos a revisar y versiones de SO.
  • action_list.csv, la lista de equipos que alguien tiene que ir a arreglar.

Cómo está hecho

Python sin paquetes de terceros y PowerShell, el reparto que uso para todo lo de Microsoft. generate_sample_data.py crea una flota ficticia para que el repo funcione sin tenant. Siete tests cubren la lógica.

Qué aprendí

Separar la exportación del análisis compensa: la parte de PowerShell solo necesita permisos de lectura y la de Python se prueba con datos falsos.

Siguientes pasos

  • Crear un registro de aplicación con permisos de solo lectura de Intune en Microsoft Graph.
  • Ejecutar Export-IntuneDevices.ps1 y generar el informe a partir de la exportación.
  • Programarlo cada semana y enviar la lista de acciones al equipo que persigue los equipos.

¿Quieres llevarlo a tu entorno o adaptarlo a tu caso? Escríbeme y lo vemos.

The problem

The Intune portal tells you a device is non-compliant. It doesn't give you a one-page answer to "how are we doing, by OS, and which machines do I chase this week?".

What I built

  • scripts/Export-IntuneDevices.ps1 exports managed devices through Microsoft Graph with a read-only permission.
  • A Python report (standard library only) that produces report.html: KPIs, compliance by operating system, devices to review and OS versions.
  • action_list.csv, the list of devices someone actually has to go and fix.

How it is built

Python with no third-party packages plus PowerShell, which is the split I use for anything Microsoft. generate_sample_data.py creates a fictional fleet so the repo runs without a tenant. Seven tests cover the logic.

What I learned

Keeping the export and the analysis apart pays off: the PowerShell side only needs read access, and the Python side can be tested with fake data.

Next steps

  • Create an app registration with read-only Intune permissions in Microsoft Graph.
  • Run Export-IntuneDevices.ps1 and point the report at the export.
  • Schedule it weekly and send the action list to the team that chases devices.

Want to bring it to your environment or adapt it to your case? Get in touch and we can look at it together.

Tech Career Lab · newsletter

¿Te ha servido? Cada dos semanas envío una idea práctica para perfiles IT: LinkedIn, proyectos, networking y procesos de selección.Found this useful? Every two weeks I send one practical idea for IT professionals: LinkedIn, projects, networking and hiring processes.

Apúntate y llévate las 33 ideasSign up and get the 33 ideas →