Configure a laptop for a New Employee
Context
During my first work/study apprenticeship at a group of universities, I had to onboard about a hundred new employees.
I decided to create this script to simplify and automate the entire process.
By optimizing the preparation of equipment for new hires, I was able to reduce the required time and thus have more time for other tasks.
Step-by-step Script Breakdown
Execution Logging
Generates a log entry containing the user's name and the script execution date, stored on a network share (~2 seconds).
Request Employee Information
Prompts the user to enter the first and last name of the new employee. Then generates a PC name based on this information (~2 seconds).
Renaming the PC
Suggests a name based on the entered first and last name, limits it to 15 characters if necessary, requests confirmation, and then renames the machine (~10 seconds).
Antivirus Verification and Installation
Checks if an antivirus is already installed. If not, installs the latest version (~3 seconds).
Selecting an Admin Account
Displays a list of available admin accounts to join the domain. Prompts the user to select one (~2 seconds).
Connecting to the Domain "mydomain.fr"
Uses the selected admin account to join the PC to the domain (~10 seconds).
Generating the Employee Identifier
Creates a unique identifier based on the first and last name, in the format expected by the domain (~1 second).
Adding the User to the Local Administrators Group
Automatically adds the user to the "Administrators" group via a scheduled task that runs at the next startup (~3 seconds).
Alternative for Custom Username
If I prefer to manually enter the account to add to the administrators group, this option is provided (~4 seconds).
Updating the Excel Inventory
Updates an Excel file in a shared folder, containing the PC and user information (~3 seconds).
Generating and Printing the Loan Form
Creates a Word form with the employee and equipment information, then automatically prints it (~4 seconds).