-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall-NoAdmin.ps1
More file actions
148 lines (122 loc) · 4.65 KB
/
Install-NoAdmin.ps1
File metadata and controls
148 lines (122 loc) · 4.65 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<#
.SYNOPSIS
Installs development tools without admin privileges.
.DESCRIPTION
This script installs:
- Git
- Chocolatey (portable)
- Python 3.11.9
- FFmpeg (via Chocolatey)
- openai-whisper (via PIP)
.NOTES
File Name : Install-DevTools.ps1
Prerequisite : PowerShell 5.1+
No admin rights required
#>
# Set Error Action Preference
$ErrorActionPreference = "Stop"
# Function to add to PATH if not already present
function Add-ToPath {
param (
[string]$PathToAdd
)
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$PathToAdd*") {
$newPath = $currentPath + [IO.Path]::PathSeparator + $PathToAdd
[Environment]::SetEnvironmentVariable("PATH", $newPath, "User")
$env:PATH += [IO.Path]::PathSeparator + $PathToAdd
}
}
# 1. Install Git (standalone portable version)
Write-Host "Downloading and installing Git..." -ForegroundColor Cyan
$gitUrl = "https://github.com/git-for-windows/git/releases/download/v2.45.1.windows.1/PortableGit-2.45.1-64-bit.7z.exe"
$gitInstaller = "$env:TEMP\PortableGit.7z.exe"
$gitInstallDir = "$env:USERPROFILE\git"
try {
# Download Git portable
(New-Object System.Net.WebClient).DownloadFile($gitUrl, $gitInstaller)
# Extract to user directory
if (-not (Test-Path $gitInstallDir)) {
New-Item -ItemType Directory -Path $gitInstallDir | Out-Null
}
# Using 7z to extract (built into Windows 10+)
Start-Process -Wait -FilePath $gitInstaller -ArgumentList "-o$gitInstallDir -y"
# Add to PATH
Add-ToPath -PathToAdd "$gitInstallDir\bin"
Write-Host "Git installed successfully" -ForegroundColor Green
}
catch {
Write-Host "Failed to install Git: $_" -ForegroundColor Red
exit 1
}
# 2. Install Chocolatey (portable)
Write-Host "Installing Chocolatey (portable)..." -ForegroundColor Cyan
$chocoInstallDir = "$env:USERPROFILE\chocoportable"
$env:ChocolateyInstall = $chocoInstallDir
try {
# Create installation directory if it doesn't exist
if (-not (Test-Path $chocoInstallDir)) {
New-Item -ItemType Directory -Path $chocoInstallDir | Out-Null
}
# Set execution policy for this process
Set-ExecutionPolicy Bypass -Scope Process -Force
# Install Chocolatey
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Add Chocolatey to PATH
Add-ToPath -PathToAdd "$chocoInstallDir\bin"
Write-Host "Chocolatey installed successfully" -ForegroundColor Green
}
catch {
Write-Host "Failed to install Chocolatey: $_" -ForegroundColor Red
exit 1
}
# 3. Install Python 3.11.9 (user installation)
Write-Host "Installing Python 3.11.9..." -ForegroundColor Cyan
$pythonUrl = "https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe"
$pythonInstaller = "$env:TEMP\python-3.11.9.exe"
try {
# Download Python installer
(New-Object System.Net.WebClient).DownloadFile($pythonUrl, $pythonInstaller)
# Install Python for current user
$pythonInstallArgs = @(
"/quiet",
"InstallAllUsers=0",
"PrependPath=1",
"Include_test=0",
"Include_launcher=0",
"SimpleInstall=1"
)
Start-Process -Wait -FilePath $pythonInstaller -ArgumentList $pythonInstallArgs
Write-Host "Python 3.11.9 installed successfully" -ForegroundColor Green
# Refresh PATH to ensure Python is available
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
}
catch {
Write-Host "Failed to install Python: $_" -ForegroundColor Red
exit 1
}
# 4. Install FFmpeg using Chocolatey
Write-Host "Installing FFmpeg via Chocolatey..." -ForegroundColor Cyan
try {
& "$chocoInstallDir\bin\choco.exe" install ffmpeg -y --no-progress
Write-Host "FFmpeg installed successfully" -ForegroundColor Green
}
catch {
Write-Host "Failed to install FFmpeg: $_" -ForegroundColor Red
exit 1
}
# 5. Install openai-whisper using pip
Write-Host "Installing openai-whisper via pip..." -ForegroundColor Cyan
try {
# Ensure pip is up to date
python -m pip install --upgrade pip
# Install whisper
python -m pip install git+https://github.com/openai/whisper.git
Write-Host "openai-whisper installed successfully" -ForegroundColor Green
}
catch {
Write-Host "Failed to install openai-whisper: $_" -ForegroundColor Red
exit 1
}
Write-Host "All components installed successfully!" -ForegroundColor Green