Description:
This script fetches all users from a specific Organizational Unit (OU), resets their password to a randomly generated secure string, and logs the results (Email, New Password, Status) into a Google Sheet.
Important:
You must be a Google Workspace Super Admin or have User Management rights.
How it works):
Checks for a "Settings" tab. If missing, creates it.
Checks for a "Logs" tab. If missing, creates it.
In the setting sheet make sure you have set the specific OU containing the users cell A2 (E.g: /Users).
You run the script from the Admin Tools menu by selecting "Run password reset".
Now the script generates a random 12-char password for every user in the specified OU, resets the password and forces "Change on Next Login" and finally writes the credentials to the "Logs" tab.
Security warning:
This script saves passwords in PLAINTEXT in the 'Logs' sheet.
1. Ensure this Google Sheet is not shared with unauthorized users.
2. After distributing passwords to users, DELETE the content of the 'Logs' sheet or clear the password column to prevent data leaks.