Skip to content

Instantly share code, notes, and snippets.

@AdamsGH
Created January 6, 2023 02:54
Show Gist options
  • Save AdamsGH/a15a12828d10d014b4589efcb1fa9c7d to your computer and use it in GitHub Desktop.
Save AdamsGH/a15a12828d10d014b4589efcb1fa9c7d to your computer and use it in GitHub Desktop.

Revisions

  1. AdamsGH created this gist Jan 6, 2023.
    46 changes: 46 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    ## Install Choco
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

    ## Install latest Powershell version
    winget install --id Microsoft.Powershell --source winget

    # Install all packages from src file, one line = one package
    $packages=(Get-Content .\packages.txt)
    foreach ($pkg in $packages)
    {
    choco install $pkg -y
    }

    # SSH Server
    Get-Service -Name sshd | Set-Service -StartupType Automatic
    Start-Service sshd

    echo "Don't forget to ssh-add!"

    # SSH Agent
    Get-Service ssh-agent | Set-Service -StartupType Manual
    Start-Service ssh-agent
    Get-Service ssh-agent

    # Enable WSL and switch to WSL2
    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
    if (-Not (Test-Path -Path .\staging)) { $dir = mkdir .\staging }
    curl.exe -L -o .\staging\wsl_update_x64.msi https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
    .\staging\wsl_update_x64.msi /quiet
    wsl --set-default-version 2
    Remove-Item .\staging\wsl_update_x64.msi

    # Install-Module -Scope CurrentUser Wsl -f
    # curl.exe -L -o .\staging\install_wsl_distro.ps1 https://raw.githubusercontent.com/diddledani/one-script-wsl2-systemd/main/install.ps1
    # Invoke-Command -ScriptBlock ([scriptblock]::Create(((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/diddledani/one-script-wsl2-systemd/main/install.ps1'))))

    # Install Scoop
    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    irm get.scoop.sh | iex

    # trzsz, ssh file transfer
    scoop bucket add extras
    scoop install trzsz
    # System info
    scoop install neofetch