We recently had to setup some virtual machines for development use which involved running installers for the assigned users on first boot. This is a great task for something like Powershell but generating that script can be timeconsuming and error prone. The following prompt created a script that would install a specified set of developer tools, although this could be adjusted for any tooling.
Create a PowerShell script to install a list of CLI tools on a Windows machine. Each tool should be downloaded and installed only if it’s not already present on the system. After each tool installation, verify the installation by displaying the version of the tool. At the end, include a prompt to keep the PowerShell window open until the user confirms they’re ready to exit. Requirements: Use Invoke-WebRequest to download each installer to the %TEMP% directory. Include a conditional check for each tool to skip installation if the tool is already installed. Use the appropriate command to verify if the tool is installed (—version, version, or any specific command required by the tool). If a tool requires a different shell session for version recognition (like nvm), reload the environment variables after installation. Add a Read-Host -Prompt “Press Enter to exit” at the end of the script to keep the PowerShell session open for review. Here’s an example list of tools to include (replace as needed): Git CLI, AWS CLI, Node Version Manager (NVM), Node.js (LTS) If there are additional dependencies for any tools, include those in the script. Make sure the script runs quietly and waits for user confirmation before closing.
Try it yourself, really powerfull use of prompting to save many hours of script generation with far smaller degrees of error.
Quick Links
Legal Stuff