Skip to content

Helps set up a fresh Windows build.

License

Notifications You must be signed in to change notification settings

Nevember/FreshBuild

Repository files navigation

FreshBuild

Build up a fresh system with your normal build-out, or customize a build for specfic use-cases using WinGet, Chocolatey, Scoop or even download and execute installers from any location.

Getting Started

Install From PowerShell Gallery

Install into PowerShell (any version 2.0 or higher):

Install-Module -Name FreshBuild -Scope AllUsers
Import-Module -Name FreshBuild

After installing you will need to initialize FreshBuild by installing one or more Package Managers:

# Installs WinGet, Scoop, and Chocolatey
Initialize-FreshBuild -All

or any combination of

# Installs WinGet, Scoop, and Chocolatey
Initialize-FreshBuild -InstallWinGet -InstallScoop -InstallChocolatey

Once you have installed package managers, you are ready to build your system. There is a sample JSON file at this Gist. On the first execution of Start-FreshBuild this JSON file is downloaded to $env:USERPROFILE/.freshBuild/FreshInstall.json.

You can download and edit the json file in one step:

Start-FreshBuild -UpdateJson -NoScript; notepad.exe $env:USERPROFILE/.freshBuild/FreshInstall.json

The -NoScript flag tells FreshBuild to do everything except actually perform the steps defined in the JSON file.

The layout of the json file is as follows:

  • items: Array of object defined as:
    • name: Name of the item to install. This should be wrapped in quotes if it contains spaces ("\"Name With Space\"").
    • source: One of: choco, scoop, winget, direct
    • optional elevate: true if installation requires elevation, otherwise do not include.
    • optional url: Uri to an installer file to download.
    • optional filename: Local file of the installer relative to $env:USERPROFILE:/.freshbuild/downloads.
    • optional script: PowerShell script snippet to acquire and install software.
    • optional parameters: Array of strings to include as additional parameters.
  • sources: Not currently used.

WinGet Example

{
    "name": "\"Windows Terminal\"",
    "source": "winget",
    "parameters": [ "source", "msstore" ]
}

Scoop Example

{
    "name": "gitversion",
    "source": "scoop"
}

Chocolatey Example

{
    "name": "gsudo",
    "source": "choco",
    "elevate": "true"
}

Due to how Chocolatey works, you should always elevate tasks for it.

Download and Execute Installer

{
    "name": "LinqPad 5",
    "source": "direct",
    "url": "https://linqpad.azureedge.net/public/LINQPad5Setup.exe?cache=5.43.0",
    "filename": "LINQPad5Setup.exe",
    "parameters": [
        "/SILENT",
        "/NORESTART"
    ]
}

Execute a Script

{
    "name": "My Script",
    "source": "direct",
    "script": "Get-Content $env:USERPROFILE/.freshBuild/FreshInstall.json"
}

Execute a Command

{
    "name": "Tortoise Git",
    "source": "direct",
    "url": "https://download.tortoisegit.org/tgit/2.10.0.0/TortoiseGit-2.10.0.2-64bit.msi",
    "fileName": "TortoiseGit-2.10.0.2-64bit.msi",
    "command": "msiexec",
    "parameters": [
        "/quiet",
        "/passive",
        "/norestart"
    ]
}

Options

Initialize-FreshBuild has the following options:

  • -All: Installs WinGet, Scoop and Chocolatey as per below.
  • -InstallWinGet: Installs WinGet and adds the msstore source.
  • -InstallScoop: Installs Scoop and adds the extras bucket.
  • -InstallChocolatey: Performs a recommended installation of Chocolatey.

Start-FreshBuild has the following options:

  • -JsonConfig <file.json>: Use the specified json file instead od the default json file.
  • -UpdateJson: Get the current JSON from this Gist, overwriting the current json.
  • -NoScript: Don't execute any installations. Useful when using the other options.
  • -Step: Pause after each installation step.
  • -Include <Pattern>: Only execute installation steps whose name matches the Regex pattern.
  • -Exclude <Pattern>: Skip installation steps whose name matches the pattern.
  • -UninstallChocolatey: Uninstall Chocolatey.
  • -UninstallScoop: Uninstall Scoop. Will remove all scoop packages.
  • -UninstallWinGet: Uninstall WinGet.

About

Helps set up a fresh Windows build.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published