Replace em-dashes in PowerShell scripts with ASCII hyphens
PowerShell 5.1 reads .ps1 files as the local ANSI codepage by default, so non-ASCII characters get garbled. An em-dash inside a string literal broke install-service.ps1 with a parser error. Sticking to ASCII in script source avoids the entire class of issue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -4,7 +4,7 @@
|
|||||||
running under LocalSystem.
|
running under LocalSystem.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Idempotent — safe to re-run after code changes. Stops the service first so binaries
|
Idempotent - safe to re-run after code changes. Stops the service first so binaries
|
||||||
aren't locked, copies the latest published output to InstallRoot, then re-creates or
|
aren't locked, copies the latest published output to InstallRoot, then re-creates or
|
||||||
re-configures the service and starts it.
|
re-configures the service and starts it.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
.PARAMETER ServiceAccount
|
.PARAMETER ServiceAccount
|
||||||
Service identity. Defaults to LocalSystem. For AD-aware hooks pass a domain user
|
Service identity. Defaults to LocalSystem. For AD-aware hooks pass a domain user
|
||||||
or gMSA — see the Service account section in README.md.
|
or gMSA - see the Service account section in README.md.
|
||||||
|
|
||||||
.PARAMETER SkipBuild
|
.PARAMETER SkipBuild
|
||||||
Skip the dotnet publish step (use the existing publish\ output as-is).
|
Skip the dotnet publish step (use the existing publish\ output as-is).
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
pointing at an isolated data root so production %ProgramData% is not touched.
|
pointing at an isolated data root so production %ProgramData% is not touched.
|
||||||
|
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
MUST be run from an elevated PowerShell — the admin pipe is ACL'd to SYSTEM
|
MUST be run from an elevated PowerShell - the admin pipe is ACL'd to SYSTEM
|
||||||
and the Administrators group, and a non-elevated process cannot connect.
|
and the Administrators group, and a non-elevated process cannot connect.
|
||||||
#>
|
#>
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
.PARAMETER ServiceAccount
|
.PARAMETER ServiceAccount
|
||||||
Account to run the service under. Defaults to LocalSystem.
|
Account to run the service under. Defaults to LocalSystem.
|
||||||
For Active-Directory-aware hooks pass a domain user (DOMAIN\user) or a gMSA
|
For Active-Directory-aware hooks pass a domain user (DOMAIN\user) or a gMSA
|
||||||
(DOMAIN\svc-name$ — note the trailing $). Domain users require -Password.
|
(DOMAIN\svc-name$ - note the trailing $). Domain users require -Password.
|
||||||
Never pass LocalService — it has no network identity and cannot reach a DC.
|
Never pass LocalService - it has no network identity and cannot reach a DC.
|
||||||
|
|
||||||
.PARAMETER Password
|
.PARAMETER Password
|
||||||
Password for a domain-user account. Not required for LocalSystem, NetworkService,
|
Password for a domain-user account. Not required for LocalSystem, NetworkService,
|
||||||
@@ -48,7 +48,7 @@ if (-not (Test-Path -LiteralPath $BinaryPath)) {
|
|||||||
throw "Binary not found: $BinaryPath"
|
throw "Binary not found: $BinaryPath"
|
||||||
}
|
}
|
||||||
|
|
||||||
# sc.exe argv format: "key= value" — space AFTER equals, none before.
|
# sc.exe argv format: "key= value" - space AFTER equals, none before.
|
||||||
$obj = $ServiceAccount
|
$obj = $ServiceAccount
|
||||||
# Get-Service returns $null when the service doesn't exist; sc.exe query is unreliable
|
# Get-Service returns $null when the service doesn't exist; sc.exe query is unreliable
|
||||||
# because it writes a FAILED line to stdout that makes truthy checks pass.
|
# because it writes a FAILED line to stdout that makes truthy checks pass.
|
||||||
@@ -84,7 +84,7 @@ if ($LASTEXITCODE -ne 0) { Write-Warning "sc.exe failure returned $LASTEXITCODE
|
|||||||
|
|
||||||
Write-Host "Starting service '$ServiceName'..."
|
Write-Host "Starting service '$ServiceName'..."
|
||||||
sc.exe start $ServiceName
|
sc.exe start $ServiceName
|
||||||
if ($LASTEXITCODE -ne 0) { throw "sc.exe start failed with exit code $LASTEXITCODE — check Event Viewer (Windows Logs > Application) for details" }
|
if ($LASTEXITCODE -ne 0) { throw "sc.exe start failed with exit code $LASTEXITCODE - check Event Viewer (Windows Logs > Application) for details" }
|
||||||
|
|
||||||
Start-Sleep -Seconds 1
|
Start-Sleep -Seconds 1
|
||||||
sc.exe query $ServiceName
|
sc.exe query $ServiceName
|
||||||
|
|||||||
Reference in New Issue
Block a user