Em dashes (U+2014) and arrows (U+2192) break PowerShell 5.1 on Windows when the file has no UTF-8 BOM -- byte 0x94 gets read as a right double quote in Windows-1252, silently closing strings mid-parse. This caused run-enrollment.ps1 to fail on PXE-imaged machines with "string is missing the terminator" at line 113. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
707 B
PowerShell
16 lines
707 B
PowerShell
# 04-NetworkAndWinRM.ps1 -- Set network profiles to Private and enable WinRM (baseline)
|
|
|
|
# --- Transcript ---
|
|
$logDir = 'C:\Logs\SFLD'
|
|
if (-not (Test-Path $logDir)) { try { New-Item -ItemType Directory -Path $logDir -Force | Out-Null } catch {} }
|
|
try { Start-Transcript -Path (Join-Path $logDir '04-NetworkAndWinRM.log') -Append -Force | Out-Null } catch {}
|
|
|
|
# --- Set all network profiles to Private ---
|
|
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
|
|
Write-Host "All network profiles set to Private."
|
|
|
|
# --- Enable and configure WinRM ---
|
|
Enable-PSRemoting -Force -SkipNetworkProfileCheck
|
|
Write-Host "WinRM enabled."
|
|
try { Stop-Transcript | Out-Null } catch {}
|