Skip to content

babichonnba/windows-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Windows Development Environment Setup

A comprehensive, automated Windows setup toolkit that streamlines the installation and configuration of development tools, applications, and VS Code extensions for a new Windows machine.

🎯 Purpose

This project automates the tedious process of setting up a Windows development environment by:

  • Installing essential development tools via package managers (WinGet, Chocolatey)
  • Configuring fonts for better coding experience
  • Setting up VS Code with pre-selected extensions
  • Enabling WSL2 for Linux development workflows
  • Providing robust error handling to ensure reliable installations
  • Offering easy customization through JSON configuration

Perfect for developers who frequently set up new Windows machines, onboard team members, or want a consistent development environment across multiple systems.

πŸ“‹ Prerequisites

System Requirements

  • Windows 10 (version 1903 or higher) or Windows 11
  • PowerShell 5.1 or higher (comes with Windows)
  • Administrator privileges (scripts will prompt for elevation)
  • Internet connection for downloading packages

Optional Requirements

  • Windows Package Manager (WinGet) - Will be prompted for installation if not present
  • Visual Studio Code - Required only if running vs-code.ps1

πŸš€ Quick Start

1. Download the Repository

# Clone the repository
git clone https://github.com/your-username/windows-setup.git
cd windows-setup

# Or download and extract the ZIP file

2. Run the Main Setup Script

# Open PowerShell as Administrator
# Navigate to the project directory
.\apps.ps1

3. Install VS Code Extensions (Optional)

# After VS Code is installed
.\vs-code.ps1

4. Enable WSL2 (Optional)

# Enable Windows Subsystem for Linux
.\wsl.ps1

πŸ“ Project Structure

windows-setup/
β”œβ”€β”€ README.md           # This documentation
β”œβ”€β”€ config.json         # Package configuration file
β”œβ”€β”€ apps.ps1           # Main application installer
β”œβ”€β”€ vs-code.ps1        # VS Code extensions installer  
β”œβ”€β”€ wsl.ps1            # WSL2 setup script
└── productkey.vbs     # Windows product key utility

βš™οΈ Configuration

The heart of this setup is the config.json file, which defines what gets installed. This approach separates configuration from logic, making it easy to customize without modifying scripts.

Configuration File Structure

{
  "chocolatey": {
    "clis": ["nuget.commandline", "webpi"],
    "fonts": ["lato", "opensans", "sourcecodepro"],
    "apps": ["youtube-dl"]
  },
  "winget": [
    "Git.Git",
    "Python.Python.3.12",
    "Microsoft.VisualStudioCode",
    "Docker.DockerDesktop"
  ],
  "vscode_extensions": [
    "ms-python.python",
    "ms-vscode.powershell",
    "eamodio.gitlens"
  ]
}

Customizing Your Installation

Adding New Packages

For WinGet packages:

  1. Find the package ID using: winget search "package name"
  2. Add the exact ID to the winget array in config.json
"winget": [
  "Microsoft.PowerToys",
  "Notepad++.Notepad++",
  "Your.NewPackage.ID"
]

For Chocolatey packages:

  1. Find the package name at chocolatey.org
  2. Add to the appropriate section (clis, fonts, or apps)
"chocolatey": {
  "apps": ["vlc", "7zip", "your-new-package"]
}

For VS Code extensions:

  1. Find the extension ID in VS Code marketplace URL or using: code --list-extensions
  2. Add to the vscode_extensions array
"vscode_extensions": [
  "ms-python.python",
  "your.extension.id"
]

Removing Packages

Simply delete the package name/ID from the relevant array in config.json.

Package Manager Priority

The setup prioritizes WinGet over Chocolatey for better performance and native Windows integration. Use Chocolatey primarily for:

  • Specialized development tools not available in WinGet
  • Font installations
  • Legacy packages

Example Customizations

Minimal Developer Setup

{
  "chocolatey": {
    "clis": [],
    "fonts": ["sourcecodepro"],
    "apps": []
  },
  "winget": [
    "Git.Git",
    "Microsoft.VisualStudioCode",
    "Microsoft.WindowsTerminal"
  ],
  "vscode_extensions": [
    "ms-vscode.powershell",
    "eamodio.gitlens"
  ]
}

Full-Stack Web Developer Setup

{
  "winget": [
    "Git.Git",
    "OpenJS.NodeJS",
    "Microsoft.VisualStudioCode",
    "Docker.DockerDesktop",
    "Mozilla.Firefox",
    "Google.Chrome",
    "Postman.Postman"
  ],
  "vscode_extensions": [
    "ms-vscode.vscode-typescript-next",
    "bradlc.vscode-tailwindcss",
    "esbenp.prettier-vscode",
    "ms-vscode.vscode-json"
  ]
}

Data Science Setup

{
  "winget": [
    "Python.Python.3.12",
    "Git.Git",
    "Microsoft.VisualStudioCode",
    "JetBrains.PyCharm.Community"
  ],
  "vscode_extensions": [
    "ms-python.python",
    "ms-python.pylint",
    "ms-toolsai.jupyter"
  ]
}

πŸ“– Script Documentation

apps.ps1 - Main Application Installer

Purpose: Installs development tools, applications, and fonts using WinGet and Chocolatey.

Features:

  • Automatic elevation to Administrator
  • Package manager installation and verification
  • Robust error handling with detailed reporting
  • Configuration-driven installation
  • Installation summary with success rates

Usage:

.\apps.ps1

vs-code.ps1 - VS Code Extensions Installer

Purpose: Installs VS Code extensions from the configuration file.

Features:

  • VS Code availability verification
  • Individual extension error handling
  • Installation progress tracking
  • Detailed failure reporting

Usage:

.\vs-code.ps1

Note: VS Code must be installed and added to PATH before running this script.

wsl.ps1 - WSL2 Setup

Purpose: Enables Windows Subsystem for Linux and sets WSL2 as default.

Features:

  • Enables WSL feature
  • Enables Virtual Machine Platform
  • Sets WSL2 as default version

Usage:

.\wsl.ps1

Note: Requires system restart after execution.

productkey.vbs - Product Key Utility

Purpose: Displays Windows product key from registry.

Usage:

cscript productkey.vbs

πŸ”§ Troubleshooting

Common Issues

"Execution Policy" Error

# Solution: Set execution policy temporarily
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Run your scripts, then reset
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope CurrentUser

WinGet Not Found

  1. Install from Microsoft Store: "App Installer"
  2. Or download from GitHub releases
  3. Restart terminal after installation

Chocolatey Installation Failed

# Manual installation
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Package Installation Failures

  • Check internet connection
  • Verify package names/IDs in configuration
  • Run as Administrator
  • Check Windows version compatibility

VS Code Extensions Not Installing

  • Ensure VS Code is in PATH: code --version
  • Restart VS Code after installation
  • Check extension compatibility with VS Code version

Error Handling Features

The scripts include comprehensive error handling:

  • Continue on failure: Individual package failures don't stop the entire process
  • Detailed logging: Clear success/failure indicators with error messages
  • Summary reports: Complete overview of what succeeded, failed, or was skipped
  • Graceful degradation: Scripts adapt when package managers aren't available

Getting Help

  1. Check the summary report at the end of script execution
  2. Review failed packages and error messages
  3. Verify prerequisites are met
  4. Check package availability in respective package managers
  5. Run individual commands manually to isolate issues

πŸ’‘ Best Practices

Before Running Scripts

  1. Backup important data before major system changes
  2. Close unnecessary applications to avoid conflicts
  3. Ensure stable internet connection
  4. Review configuration to understand what will be installed

Customization Tips

  1. Start small: Begin with a minimal configuration and add packages gradually
  2. Test changes: Validate configuration JSON syntax before running scripts
  3. Keep backups: Save working configurations for different scenarios
  4. Version control: Track configuration changes in git

Maintenance

  1. Regular updates: Keep package lists current with latest versions
  2. Remove unused packages: Clean up configuration periodically
  3. Update scripts: Pull latest improvements from repository
  4. Document changes: Comment significant configuration modifications

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly on a clean Windows installation
  5. Submit a pull request with detailed description

Areas for Contribution

  • Additional package configurations for different development stacks
  • Improved error handling and user experience
  • Cross-platform compatibility (PowerShell Core)
  • Additional utility scripts
  • Documentation improvements

πŸ“„ License

This project is open source and available under the MIT License.

πŸ”„ Version History

  • v3.0 - Added robust error handling and comprehensive documentation
  • v2.0 - Externalized configuration to JSON, migrated to WinGet
  • v1.0 - Initial PowerShell automation scripts

Happy coding! πŸš€

If you find this project helpful, please consider giving it a star ⭐ on GitHub.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •