-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ps1
67 lines (51 loc) · 2.05 KB
/
run.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
# Define the directory for downloading and extracting the zip file
$downloadDirectory = "C:\install"
# Create the download directory if it doesn't exist
Write-Host "create download directory" -ForegroundColor Green
if (-not (Test-Path -Path $downloadDirectory)) {
New-Item -Path $downloadDirectory -ItemType Directory
}
# Function to download file from URL
function DownloadFile($url, $outputPath) {
Invoke-WebRequest -Uri $url -OutFile $outputPath
}
# GitHub repository details
$owner = "sabixx"
$repo = "demo_env_setup_files"
$apiUrl = "https://api.github.com/repos/$owner/$repo/contents/"
# Fetch repository contents
$response = Invoke-RestMethod -Uri $apiUrl -Method Get
# Base directory to save files
if (-not (Test-Path -Path $downloadDirectory)) {
New-Item -ItemType Directory -Path $downloadDirectory
}
# Loop through each item in the repository
Write-Host "Downloading files from github" -ForegroundColor Green
foreach ($item in $response) {
$filePath = Join-Path -Path $downloadDirectory -ChildPath $item.name
DownloadFile $item.download_url $filePath
}
# Execute the python.ps1 script -- not requierd ansible works without it
#Write-Host "Python..." -ForegroundColor Green
#$scriptPath = Join-Path -Path $downloadDirectory -ChildPath "python.ps1"
#& $scriptPath
# add runs as admin to context menu
Write-Host "RunAsAdmin Context Menu..." -ForegroundColor Green
$scriptPath = Join-Path -Path $downloadDirectory -ChildPath "run_as_contextmenu.ps1"
& $scriptPath
# enable winrm
Write-Host "Winrm..." -ForegroundColor Green
$scriptPath = Join-Path -Path $downloadDirectory -ChildPath "winrm.ps1"
& $scriptPath
# Execute the chrome.ps1 script
Write-Host "Chrome..." -ForegroundColor Green
$scriptPath = Join-Path -Path $downloadDirectory -ChildPath "chrome.ps1"
& $scriptPath
# Execute the bginfo.ps1 script
Write-Host "BGinfo..." -ForegroundColor Green
$scriptPath = Join-Path -Path $downloadDirectory -ChildPath "bginfo.ps1"
& $scriptPath
Write-Host "Press any key to exit..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
# Exit the script
exit