Production-ready scripts to audit inactive users and manage group ownership in Google Workspace. Built for enterprise-scale organizations with 50,000+ users and 5,000+ groups.
Automatically audits users with specific licenses who haven't logged in for 180 days. Includes monthly trigger setup.
View Script →Manual execution version of the 180-day audit. Perfect for on-demand reporting and testing.
View Script →Annual audit for users inactive for a full year. Ideal for license reclamation and compliance.
View Script →Enterprise-scale batch processor for auditing groups without owners or managers. Handles 5,000+ groups efficiently.
View Script →These scripts use a hybrid approach combining the Admin Reports API and Directory API to accurately identify inactive users with specific Google Workspace licenses. Perfect for license optimization and compliance reporting.
Purpose: Automatically audits users with a specific license (e.g., Enterprise Plus) who have been inactive for 180 days.
Features:
// View full code in the download section below
⬇️ Download Full Script
Purpose: Same functionality as the auto version but designed for manual, on-demand execution.
Use Cases:
// View full code in the download section below
⬇️ Download Full
Script
Purpose: Audits users with a specific license who have been inactive for a full year (365 days).
Ideal For:
// View full code in the download section below
⬇️ Download Full Script
Enterprise-scale solution for auditing Google Workspace groups without proper ownership. Designed specifically for organizations with 5,000+ groups using intelligent batch processing.
Purpose: Identifies Google Workspace groups missing OWNERS and/or MANAGERS with automatic progress tracking.
Key Features:
Processing Options:
Run auditGroupsWithoutOwners() multiple times. Each run processes 500 groups
and saves progress automatically.
Run createAutoBatchTrigger() once. The script runs every 10 minutes until
complete, then stops automatically.
// View full code in the download section below
⬇️ Download Full Script
auditGroupsWithoutOwners() - processes first 500 groupscreateAutoBatchTrigger() oncedeleteAutoBatchTrigger()| Function | Purpose |
|---|---|
auditGroupsWithoutOwners() |
Start or continue the audit |
checkAuditProgress() |
View current progress without processing |
resetAudit() |
Clear all progress and start fresh |
createAutoBatchTrigger() |
Set up automatic processing every 10 minutes |
deleteAutoBatchTrigger() |
Stop automatic processing |
Manual: ~50 minutes (10 runs)
Automatic: ~1.75 hours hands-off
Manual: ~100 minutes (20 runs)
Automatic: ~3.5 hours hands-off
Update the CONFIG object in each script:
const CONFIG = {
TARGET_SKU_ID: '1010020020', // Your license SKU
EMAIL_RECIPIENTS: 'admin@example.com',
SEND_EMAIL: true,
INACTIVITY_DAYS: 180 // or 365
};
auditInactiveEnterpriseUsers)