-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEnhanced_InstallNewSystem.ps1
122 lines (104 loc) · 3.23 KB
/
Enhanced_InstallNewSystem.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#InstallNewSystem
# Define the list of packages to install
$packages = @(
# windows
"Microsoft.PowerShell",
"Microsoft.PowerToys",
"Microsoft.Sysinternals",
"CodeSector.TeraCopy",
"HermannSchinagl.LinkShellExtension",
# dev
"Git.Git",
"Microsoft.VisualStudioCode",
"GitHub.GitHubDesktop",
"OpenJS.NodeJS",
"SoftDeluxe.FreeDownloadManager",
# google
"Google.PlatformTools",
"Google.AndroidStudio",
"Google.QuickShare",
# system util
"REALiX.HWiNFO",
"CPUID.HWMonitor",
"Sony.XperiaCompanion",
"Canonical.Ubuntu.2404",
"Genymobile.scrcpy",
"Frontesque.scrcpy+",
"GlavSoft.TightVNC 2.8.85",
# audio
"Audacity.Audacity",
"MusicBee.MusicBee",
"SonicVisualiser.SonicVisualiser",
"AsaphaHalifa.AudioRelay",
# the chats
"WhatsApp",
"Telegram.TelegramDesktop",
"OpenWhisperSystems.Signal",
# cloud storage
"Microsoft.OneDrive",
"Google.GoogleDrive",
# video
"OBSProject.OBSStudio",
"Gyan.FFmpeg",
"Videolan.vlc",
"GianlucaPernigotto.Videomass",
# browser mail
"Google.Chrome",
"Mozilla.Firefox",
"Mozilla.Thunderbird",
"Mailbird.Mailbird",
# util
"7zip.7zip",
"JAMSoftware.TreeSize.Free",
"Notepad++.Notepad++",
"IrfanSkiljan.IrfanView",
"IrfanSkiljan.IrfanView.PlugIns",
"CodeSector.TeraCopy",
"ScooterSoftware.BeyondCompare.5",
"TheDocumentFoundation.LibreOffice"
)
# Function to check if a package is already installed
function Is-PackageInstalled($packageName) {
return (winget list --name $packageName | Out-String).Trim() -ne ""
}
# Install packages with error handling and retry mechanism
foreach ($package in $packages) {
if (-not (Is-PackageInstalled $package)) {
$retryCount = 3
for ($i = 1; $i -le $retryCount; $i++) {
Write-Host "Installing $package (Attempt $i of $retryCount)..."
winget install --id $package --accept-source-agreements --silent
if (Is-PackageInstalled $package) {
Write-Host "$package installed successfully."
break
} elseif ($i -eq $retryCount) {
Write-Host "Failed to install $package after $retryCount attempts."
}
Start-Sleep -Seconds 5 # Brief wait before retry
}
} else {
Write-Host "$package is already installed, skipping..."
}
}
# Remove unnecessary packages
$remove = @("Xbox", "MicrosoftTeams")
foreach ($package in $remove) {
Write-Host "Attempting to remove $package..."
winget uninstall --id $package --silent
}
# Optional reboot function
function Prompt-Reboot {
$response = Read-Host "Some installations may require a reboot. Do you want to reboot now? (y/n)"
if ($response -eq "y") {
Restart-Computer -Force
} else {
Write-Host "Reboot skipped. Note: Some changes may not take effect until next reboot."
}
}
# Placeholder for configuration setup (customize as needed)
# Configure VS Code (import settings file if exists)
# Configure Git (global configs)
# Configure PowerShell (profile customizations)
Write-Host "Setup complete. Review above output for any errors."
# Prompt for reboot if needed
Prompt-Reboot