235 lines
9.2 KiB
PowerShell
235 lines
9.2 KiB
PowerShell
#Requires -RunAsAdministrator
|
|
|
|
#Install WinGet
|
|
## WinGet should be on any windows 11 install by default
|
|
$hasPackageManager = Get-AppPackage -name 'Microsoft.DesktopAppInstaller'
|
|
if (!$hasPackageManager -or [version]$hasPackageManager.Version -lt [version]"1.10.0.0") {
|
|
"Installing winget Dependencies"
|
|
Add-AppxPackage -Path 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
|
|
$releases_url = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
$releases = Invoke-RestMethod -uri $releases_url
|
|
$latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith('msixbundle') } | Select-Object -First 1
|
|
"Installing winget from $($latestRelease.browser_download_url)"
|
|
Add-AppxPackage -Path $latestRelease.browser_download_url
|
|
}
|
|
else {
|
|
"winget already installed"
|
|
}
|
|
#Configure WinGet
|
|
Write-Output "Configuring winget"
|
|
#winget config path from: https://github.com/microsoft/winget-cli/blob/master/doc/Settings.md#file-location
|
|
$settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json";
|
|
$settingsJson = @{installBehavior = @{
|
|
preferences = @{
|
|
scope = 'machine'
|
|
}
|
|
}
|
|
}
|
|
$settingsJson | ConvertTo-Json | Out-File $settingsPath -Encoding utf8
|
|
Set-ExecutionPolicy bypass
|
|
winget search test --accept-source-agreements
|
|
|
|
function InstallTheApps() {
|
|
Foreach ($app in $apps) {
|
|
$listApp = winget list --exact -q $app.name
|
|
if (![String]::Join("", $listApp).Contains($app.name)) {
|
|
Write-host "Installing:" $app.name
|
|
if ($null -ne $app.source) {
|
|
winget install --exact $app.name --source $app.source --accept-package-agreements
|
|
# winget install --exact --silent $app.name --source $app.source
|
|
}
|
|
else {
|
|
winget install --exact $app.name --accept-package-agreements
|
|
# winget install --exact --silent $app.name
|
|
}
|
|
}
|
|
else {
|
|
Write-host "Skipping Install of " $app.name
|
|
}
|
|
}
|
|
}
|
|
|
|
function Get-Windot {
|
|
git clone --bare https://git.theflyingfool.com/theflyingfool/dotfiles.git $HOME/.dot
|
|
if (!(Test-Path -Path $PROFILE)) {
|
|
# Create the profile
|
|
New-Item -Type File -Path $PROFILE -Force
|
|
}
|
|
"`nfunction dot { & git --git-dir=`"$HOME/.dot/`" --work-tree=`"$HOME`" @args }" | Out-File -Append $PROFILE
|
|
. $PROFILE
|
|
dot checkout
|
|
dot config --local status.showUntrackedFiles no
|
|
"`n. `"$HOME/windows/Microsoft.PowerShell_profile.ps1`"" | Out-File -Append $PROFILE
|
|
|
|
}
|
|
function Update-Profile {
|
|
|
|
#Check For $PROFILE
|
|
if (-not (Test-Path $PROFILE)) { $null = New-Item -Force $PROFILE }
|
|
|
|
#Grab "Helper File"
|
|
$URL="https://git.theflyingfool.com/theflyingfool/Win_Setup/raw/branch/main/CopyFromFile.txt"
|
|
$PATH="$PWD\CopyFromFile.txt"
|
|
if (-not (Test-Path ./CopyFromFile.txt)) { (New-Object System.Net.WebClient).DownloadFile($URL, $PATH) }
|
|
|
|
$CheckString = Get-Content -Path .\CopyFromFile.txt
|
|
if (-not(Select-String -Quiet -Path $PROFILE -Pattern $CheckString)) {Get-Content -Path .\CopyFromFile.txt | Add-Content -Path $PROFILE}
|
|
|
|
#Delete "Helper File"
|
|
Remove-Item .\CopyFromFile.txt
|
|
|
|
|
|
}
|
|
|
|
do {
|
|
$answer = $null
|
|
do {
|
|
|
|
if ( $answer) {
|
|
Write-Host 'Invalid selection'
|
|
Start-Sleep 2
|
|
Write-Host ''
|
|
}
|
|
Write-Host '1 - Base Apps'
|
|
Write-Host '2 - Game Launchers'
|
|
Write-Host '3 - Desktop only'
|
|
Write-Host '4 - Lenovo Laptop only'
|
|
Write-Host '5 - Remove Crap'
|
|
Write-Host '6 - Create SSH Key'
|
|
Write-Host '7 - Grab WinDot'
|
|
Write-Host '8 - Testing Features here'
|
|
Write-Host '9 - Exit'
|
|
Write-Host ''
|
|
$answer = Read-Host 'Select number(s)'
|
|
|
|
$ok =$answer -in @(1..8; 9)
|
|
} until ($ok)
|
|
|
|
if ($answer -eq 9) { break }
|
|
|
|
|
|
|
|
|
|
switch ( $answer ) {
|
|
"1" {
|
|
$apps = @( # BASE APPS
|
|
@{name = '7zip.7zip'},
|
|
@{name = '9wzdncrf0083'}, #Facebook messenger
|
|
#@{name = 'ApacheFriends.Xampp.8.2'},
|
|
@{name = 'Bitwarden.Bitwarden'},
|
|
@{name = 'Docker.DockerDesktop'},
|
|
@{name = 'Git.Git'},
|
|
@{name = 'Google.Chrome'},
|
|
#@{name = 'Google.AndroidStudio'}. ## Not currently doing any android dev
|
|
@{name = 'Google.GoogleDrive'},
|
|
@{name = 'GuinpinSoft.MakeMKV'},
|
|
@{name = 'Hugo.Hugo.Extended'},
|
|
@{name = 'Malwarebytes.Malwarebytes'},
|
|
@{name = 'Microsoft.MouseWithoutBorders'},
|
|
@{name = 'Microsoft.Office'},
|
|
@{name = 'Microsoft.PowerShell'},
|
|
@{name = 'Microsoft.PowerToys'},
|
|
@{name = 'Microsoft.VisualStudioCode'},
|
|
@{name = 'Microsoft.WindowsTerminal'},
|
|
@{name = 'MoritzBunkus.MKVToolNix'},
|
|
#@{name = 'Node.js'}, ## Was Testing Something
|
|
@{name = 'NordSecurity.NordVPN'},
|
|
@{name = 'OpenMedia.4KVideoDownloaderPlus'},
|
|
@{name = 'Oracle.VirtualBox'},
|
|
@{name = 'Plex.Plex'},
|
|
@{name = 'PointPlanck.FileBot'},
|
|
@{name = 'qBittorrent.qBittorrent'},
|
|
@{name = 'Sinew.Enpass'}, # Temp until everything moved to bitwarden
|
|
@{name = 'SQLite.SQLite'},
|
|
@{name = 'sqlitestudio.pl.SQLiteStudio'},
|
|
@{name = 'TorProject.TorBrowser'},
|
|
@{name = 'VideoLAN.VLC'},
|
|
@{name = 'Vivaldi.Vivaldi'}
|
|
)
|
|
|
|
InstallTheApps $Apps
|
|
Invoke-WebRequest https://cdn.files.community/files/download/Files.Stable.exe -OutFile $HOME/Downloads/Files.Stable.exe
|
|
& "$HOME/Downloads/Files.Stable.exe"
|
|
## Didn't wait until finished to try and remove needs troubleshooting
|
|
# Remove-Item "$HOME/Downloads/Files.Stable.exe"
|
|
|
|
}
|
|
"2" {
|
|
$apps = @( # Game Launchers
|
|
@{name = 'ElectronicArts.EADesktop' },
|
|
@{name = 'Valve.Steam' },
|
|
@{name = 'EpicGames.EpicGamesLauncher' },
|
|
@{name = 'GOG.Galaxy '},
|
|
#@{name = 'EQAditu.AdvancedCombatTracker'},
|
|
@{name = 'Discord.Discord '}
|
|
|
|
)
|
|
InstallTheApps $Apps
|
|
}
|
|
"3" {
|
|
$apps = @( ## DESKTOP
|
|
@{name = 'SteelSeries.SteelSeriesEngine' },
|
|
@{name = 'Corsair.iCUE.5' },
|
|
@{name = 'Asus.ArmouryCrate'},
|
|
@{name = 'Nvidia.GeForceExperience '}
|
|
#@{name = 'Samsung.SamsungMagician'}# As of 6.13.2024 was a super old version
|
|
)
|
|
InstallTheApps $Apps
|
|
}
|
|
"4" {
|
|
$apps = @( ## LAPTOP
|
|
@{name = 'Intel.IntelDriverAndSupportAssistant' },
|
|
@{name = '9WZDNCRFJ4MV'; source = 'msstore' }, # Lenovo Vantage from MS Store
|
|
@{name = 'j5create.Driver-JUA365' } ## Not sure if this is correct yet!
|
|
)
|
|
InstallTheApps $Apps
|
|
}
|
|
|
|
|
|
'5' {
|
|
## REMOVE CRAP
|
|
Write-Output 'Removing Apps'
|
|
$apps = '*3DPrint*', 'Microsoft.MixedReality.Portal', 'Disney.*' , 'Microsoft.BingNews*' , '*BingWeather*', '*.MicrosoftOfficeHub*' , '*MicrosoftSolitaireCollection*'
|
|
Foreach ($app in $apps) {
|
|
Write-Host 'Uninstalling:' $app
|
|
Get-AppxPackage -allusers $app | Remove-AppxPackage
|
|
}
|
|
winget uninstall Microsoft.OneDrive Microsoft.OneDriveSync_8wekyb3d8bbwe
|
|
}
|
|
'6'{
|
|
|
|
Write-Host "Make sure SSH Client is installed"
|
|
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
|
|
Write-Host "Check for SSH Key Create if needed"
|
|
if (-not (Test-Path $env:USERPROFILE\.ssh\id_ed25519)){
|
|
ssh-keygen -t ed25519
|
|
}
|
|
Write-Host "Start SSH Agent"
|
|
Get-Service ssh-agent | Set-Service -StartupType Automatic
|
|
Start-Service ssh-agent
|
|
ssh-add $env:USERPROFILE\.ssh\id_ed25519
|
|
}
|
|
'7'{
|
|
Get-Windot
|
|
}
|
|
'8'{
|
|
|
|
Add-WindowsCapability -Online -Name "ServicesForNFS-ClientOnly"
|
|
Add-WindowsCapability -Online -Name "ClientForNFS-Infrastructure"
|
|
Add-WindowsCapability -Online -Name "NFS-Client"
|
|
Add-WindowsCapability -Online -Name "RSAT-NFS-Admin"
|
|
Add-WindowsCapability -Online -Name "Rsat.ServerManager.Tools~~~~0.0.1.0"
|
|
|
|
New-PSDrive -Name "X" -PSProvider "FileSystem" -Root "\\192.168.1.185\mnt\Local_4X\media" -Persist
|
|
New-PSDrive -Name "Y" -PSProvider "FileSystem" -Root "\\192.168.1.185\mnt\Movies\Movies" -Persist
|
|
New-PSDrive -Name "Z" -PSProvider "FileSystem" -Root "\\192.168.1.185\mnt\HBA\Media" -Persist
|
|
New-PSDrive -Name "Q" -PSProvider "FileSystem" -Root "\\192.168.1.185\mnt\Local_4X\qBit_DL" -Persist
|
|
New-PSDrive -Name "B" -PSProvider "FileSystem" -Root "\\192.168.1.185\mnt\Local_4X\VW_BUP" -Persist
|
|
|
|
|
|
|
|
}
|
|
}
|
|
} until ( $answer -eq '9' )
|