-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.ps1
71 lines (56 loc) · 2.35 KB
/
misc.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
################################################
##### Development
################################################
# Install Python 3.12
winget install -e --id Python.Python.3.12
# AI
$credential = Get-Credential -credential "$env:USERNAME"
$commands = @'
"& code --install-extension ms-dotnettools.csdevkit"
'@
Start-Process -FilePath Powershell -LoadUserProfile -Credential $credential -ArgumentList '-Command', $commands
# Install Ollama
winget install -e --source winget --id Ollama.Ollama
################################################
##### Update winget-cli
################################################
# Download latest stable winget-cli version
$url = 'https://github.com/microsoft/winget-cli/releases/latest'
$request = [System.Net.WebRequest]::Create($url)
$response = $request.GetResponse()
$realTagUrl = $response.ResponseUri.OriginalString
$response.Dispose()
$version = $realTagUrl.split('/')[-1].Trim('v')
$filename = "Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"
$downloadUrl = $realTagUrl.Replace('tag', 'download') + '/' + $filename
Invoke-WebRequest `
-Uri "$downloadUrl" `
-OutFile "$env:USERPROFILE\Downloads\$filename"
# Install winget-cli
Add-AppxPackage -Path "$env:USERPROFILE\Downloads\Microsoft.DesktopAppInstaller_*.msixbundle"
# Remove bundle file
Remove-Item "$env:USERPROFILE\Downloads\$filename"
################################################
##### steamcmd
################################################
# References:
# https://developer.valvesoftware.com/wiki/SteamCMD#Windows
# Create steamcmd directory
New-Item -Path $env:USERPROFILE\apps\steamcmd -ItemType directory
# Download steamcmd
Invoke-WebRequest `
-Uri "https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip" `
-OutFile "$env:USERPROFILE\apps\steamcmd\steamcmd.zip"
# Extract zip
Expand-Archive `
-LiteralPath "$env:USERPROFILE\apps\steamcmd\steamcmd.zip" `
-DestinationPath "$env:USERPROFILE\apps\steamcmd"
# Remove steamcmd zip
Remove-Item "$env:USERPROFILE\apps\steamcmd\steamcmd.zip"
# Add steamcmd to path
[Environment]::SetEnvironmentVariable(
"Path",
[Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";$env:USERPROFILE\apps\steamcmd",
[EnvironmentVariableTarget]::Machine)
# Update steamcmd
& "$env:USERPROFILE\apps\steamcmd\steamcmd.exe" "+@ShutdownOnFailedCommand 1" "+quit"