73 lines
3.2 KiB
PowerShell
73 lines
3.2 KiB
PowerShell
# Windows 11 LTSC IoT VM Setup Script
|
|
# Run this INSIDE the Windows VM after installation
|
|
# Run as Administrator in PowerShell
|
|
|
|
#Requires -RunAsAdministrator
|
|
|
|
Write-Host "Starting Windows LTSC IoT VM Setup..." -ForegroundColor Cyan
|
|
|
|
# Enable SSH Server
|
|
Write-Host "Enabling OpenSSH Server..." -ForegroundColor Cyan
|
|
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
|
|
Start-Service sshd
|
|
Set-Service -Name sshd -StartupType 'Automatic'
|
|
New-NetFirewallRule -Name "OpenSSH-Server-In-TCP" -DisplayName "OpenSSH Server" -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
|
Write-Host "SSH Server enabled" -ForegroundColor Green
|
|
|
|
# Enable RDP
|
|
Write-Host "Enabling Remote Desktop..." -ForegroundColor Cyan
|
|
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -Name "fDenyTSConnections" -Value 0
|
|
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
|
|
Write-Host "RDP enabled" -ForegroundColor Green
|
|
|
|
# Create test user
|
|
Write-Host "Creating test user account..." -ForegroundColor Cyan
|
|
$TestUser = "testuser"
|
|
$TestPassword = ConvertTo-SecureString "DevMatrix2024!" -AsPlainText -Force
|
|
if (!(Get-LocalUser -Name $TestUser -ErrorAction SilentlyContinue)) {
|
|
New-LocalUser -Name $TestUser -Password $TestPassword -FullName "Test User" -Description "DevMatrix Test Account"
|
|
Add-LocalGroupMember -Group "Administrators" -Member $TestUser
|
|
Add-LocalGroupMember -Group "Remote Desktop Users" -Member $TestUser
|
|
Write-Host "Test user '$TestUser' created" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "Test user already exists" -ForegroundColor Yellow
|
|
}
|
|
|
|
# Install Chocolatey
|
|
Write-Host "Installing Chocolatey..." -ForegroundColor Cyan
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
|
Write-Host "Chocolatey installed" -ForegroundColor Green
|
|
|
|
# Install development tools
|
|
Write-Host "Installing development tools..." -ForegroundColor Cyan
|
|
choco install -y git python nodejs dotnet-sdk vscode firefox googlechrome 7zip
|
|
Write-Host "Development tools installed" -ForegroundColor Green
|
|
|
|
# Install Playwright
|
|
Write-Host "Installing Playwright..." -ForegroundColor Cyan
|
|
npm install -g @playwright/test
|
|
npx playwright install chromium
|
|
Write-Host "Playwright installed" -ForegroundColor Green
|
|
|
|
# Create test directories
|
|
Write-Host "Creating test directories..." -ForegroundColor Cyan
|
|
New-Item -ItemType Directory -Force -Path "C:\Apps" | Out-Null
|
|
New-Item -ItemType Directory -Force -Path "C:\Tests" | Out-Null
|
|
New-Item -ItemType Directory -Force -Path "C:\Results" | Out-Null
|
|
New-Item -ItemType Directory -Force -Path "C:\Scripts" | Out-Null
|
|
Write-Host "Directories created" -ForegroundColor Green
|
|
|
|
# Summary
|
|
Write-Host ""
|
|
Write-Host "Windows VM Setup Complete!" -ForegroundColor Green
|
|
Write-Host "===========================" -ForegroundColor Green
|
|
Write-Host "SSH: Enabled on port 22"
|
|
Write-Host "RDP: Enabled"
|
|
Write-Host "Test User: testuser / DevMatrix2024!"
|
|
Write-Host ""
|
|
Write-Host "Connect from Dev VM:"
|
|
Write-Host " ssh testuser@192.168.5.211"
|
|
Write-Host " scp -r ./app testuser@192.168.5.211:/C:/Apps/"
|