# ===================================================================
# SCRIPT: System Setup and Update
# PURPOSE: Configures power settings, installs standard applications,
# updates Dell drivers, and installs Windows updates.
# NOTES: Run this script with Administrator privileges.
# ===================================================================
# --- . Configure Power Settings ---
Write-Host "Configuring power settings..." -ForegroundColor Yellow
powercfg /change standby-timeout-ac 60
powercfg /change monitor-timeout-ac 60
powercfg /change hibernate-timeout-ac 60
powercfg -h off
Write-Host "Power settings have been set to 60 minutes for AC power." -ForegroundColor Green
# --- . Configure Location & Network Services ---
Write-Host "Configuring location and network services..." -ForegroundColor Yellow
Set-Service -Name lfsvc -StartupType Automatic
Start-Service -Name lfsvc
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value "Allow"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" -Name "Value" -Value "Allow"
net localgroup "Network Configuration Operators" "localadmin" /add
Set-Service WlanSvc -StartupType Automatic
Start-Service WlanSvc
Restart-Service lfsvc
Restart-Service WlanSvc
Stop-Process -Name explorer -Force
Start-Process explorer.exe
start-sleep 5
(Get-Process explorer).MainWindowHandle | ForEach-Object { (New-Object -ComObject Shell.Application).Windows() | Where-Object { $_.FullName -like "*explorer.exe*" } | ForEach-Object { $_.Quit() } }
Write-Host "Location and network services configured." -ForegroundColor Green
# --- . Configure Wi-Fi Profile ---
Write-Host "Creating Wi-Fi profile 'Arrow'..." -ForegroundColor Yellow
# 1. --- SET YOUR WIFI DETAILS HERE ---
$ProfileName = "Arrow" # Put your Wi-Fi name (SSID) here
$Password = "W1r3l3ssacc35524kt13" # Put your Wi-Fi password here
# 2. --- This part creates the Wi-Fi profile (as an XML file) ---
# This string contains all the settings for the network.
$ProfileXml = @"
$ProfileName
$ProfileName
ESS
auto
WPA2PSK
AES
false
passPhrase
false
$Password
"@
# 3. --- This part saves and loads the new profile ---
# It saves the settings above into a temporary file.
$ProfileXml | Out-File -FilePath "$env:TEMP\wifi-profile.xml" -Encoding ascii
# This command adds the new profile to Windows.
netsh wlan add profile filename="$env:TEMP\wifi-profile.xml"
# This cleans up the temporary file.
Remove-Item -Path "$env:TEMP\wifi-profile.xml" -Force
Write-Host "Wi-Fi profile 'Arrow' added." -ForegroundColor Green
# 4. --- This part connects to the network ---
Write-Host "Connecting to $ProfileName..." -ForegroundColor Yellow
netsh wlan connect name="$ProfileName"
Write-Host "Wi-Fi connection attempt sent." -ForegroundColor Green
# --- . Updates hostname ---
Write-Host "Updating hostname based on serial number..." -ForegroundColor Yellow
$serial = (Get-WmiObject Win32_BIOS).SerialNumber.Trim()
$newName = "ARW-$serial"
Rename-Computer -NewName $newName -Force
Write-Host "Hostname updated to $newName. (Reboot needed to apply)" -ForegroundColor Green
# --- . Install Applications via Winget ---
Write-Host "Installing standard applications using Winget..." -ForegroundColor Yellow
# Create a list of application IDs to install
$wingetApps = @(
"Dell.CommandUpdate",
"Microsoft.Teams",
"Microsoft.Edge",
"Google.Chrome",
"Mozilla.Firefox",
"Adobe.Acrobat.Reader.64-bit",
"7zip.7zip",
"WatchGuard.MobileVPNWithSSLClient",
"VideoLAN.VLC",
"Microsoft.OneDrive"
)
foreach ($app in $wingetApps) {
Write-Host "Installing $app..."
# --silent makes it non-interactive
# --accept-package-agreements and --accept-source-agreements handle licenses
winget install --id $app --silent --accept-package-agreements --accept-source-agreements
}
winget upgrade --all
Write-Host "Winget applications install complete." -ForegroundColor Green
# --- . Office 365 Install --
# Microsoft Office Deployment Script (auto-config)
$officeUrl = "https://officecdn.microsoft.com/pr/wsus/setup.exe"
$tempDir = "$env:TEMP\OfficeInstall"
$installerPath = "$tempDir\setup.exe"
$configPath = "$tempDir\configuration.xml"
# Create temp directory
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
Write-Host "Downloading Microsoft Office installer..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $officeUrl -OutFile $installerPath -UseBasicParsing
# Create configuration.xml
@"
"@ | Out-File -Encoding UTF8 $configPath
Write-Host "Installing Microsoft Office..." -ForegroundColor Cyan
Start-Process -FilePath $installerPath -ArgumentList "/configure `"$configPath`"" -Wait
Write-Host "Office installation completed." -ForegroundColor Green
# --- . Run Dell Command Update ---
Write-Host "Checking for Dell driver and firmware updates (running twice)..." -ForegroundColor Yellow
Set-Location "C:\Program Files (x86)\Dell\CommandUpdate"
.\dcu-cli.exe /scan
.\dcu-cli.exe /applyupdates
#needs two runs
.\dcu-cli.exe /scan
.\dcu-cli.exe /applyupdates
Write-Host "Dell updates applied. Reboot required." -ForegroundColor Green
# --- . Install Windows Updates ---
Write-Host "Checking for and installing Windows Updates..." -ForegroundColor Yellow
# Install the PSWindowsUpdate module if it's not already there
if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) {
Write-Host "PSWindowsUpdate module not found. Installing..." -ForegroundColor Yellow
Install-Module -Name PSWindowsUpdate -Force -AcceptLicense -Confirm:$false
Write-Host "PSWindowsUpdate module installed." -ForegroundColor Green
}
# Check for, download, and install all available updates.
Install-WindowsUpdate -AcceptAll -AutoReboot
Write-Host "Script finished. Laptop rebooting in 60 seconds....." -ForegroundColor Green
start-sleep 60
Restart-Computer