mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-28 08:14:24 +02:00
Update script to account for PS7.3 native command argument parsing changes (#642)
* Update script to account for PS7.3 native command argument parsing changes * Update version
This commit is contained in:
parent
1bead19d5a
commit
043a20b808
@ -39,13 +39,19 @@ if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
|
|||||||
sc.exe delete ssh-agent 1>$null
|
sc.exe delete ssh-agent 1>$null
|
||||||
}
|
}
|
||||||
|
|
||||||
# unregister etw provider
|
# Unregister etw provider
|
||||||
wevtutil um `"$etwman`"
|
# PowerShell 7.3+ has new/different native command argument parsing
|
||||||
|
if ($PSVersiontable.PSVersion -le '7.2.9') {
|
||||||
|
wevtutil um `"$etwman`"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wevtutil um "$etwman"
|
||||||
|
}
|
||||||
|
|
||||||
# adjust provider resource path in instrumentation manifest
|
# adjust provider resource path in instrumentation manifest
|
||||||
[XML]$xml = Get-Content $etwman
|
[XML]$xml = Get-Content $etwman
|
||||||
$xml.instrumentationManifest.instrumentation.events.provider.resourceFileName = $sshagentpath.ToString()
|
$xml.instrumentationManifest.instrumentation.events.provider.resourceFileName = "$sshagentpath"
|
||||||
$xml.instrumentationManifest.instrumentation.events.provider.messageFileName = $sshagentpath.ToString()
|
$xml.instrumentationManifest.instrumentation.events.provider.messageFileName = "$sshagentpath"
|
||||||
|
|
||||||
$streamWriter = $null
|
$streamWriter = $null
|
||||||
$xmlWriter = $null
|
$xmlWriter = $null
|
||||||
@ -114,16 +120,21 @@ if (Test-Path $sshProgDataPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#register etw provider
|
# Register etw provider
|
||||||
wevtutil im `"$etwman`"
|
# PowerShell 7.3+ has new/different native command argument parsing
|
||||||
|
if ($PSVersiontable.PSVersion -le '7.2.9') {
|
||||||
|
wevtutil im `"$etwman`"
|
||||||
|
} else {
|
||||||
|
wevtutil im "$etwman"
|
||||||
|
}
|
||||||
|
|
||||||
$agentDesc = "Agent to hold private keys used for public key authentication."
|
$agentDesc = "Agent to hold private keys used for public key authentication."
|
||||||
New-Service -Name ssh-agent -DisplayName "OpenSSH Authentication Agent" -BinaryPathName `"$sshagentpath`" -Description $agentDesc -StartupType Manual | Out-Null
|
New-Service -Name ssh-agent -DisplayName "OpenSSH Authentication Agent" -BinaryPathName "$sshagentpath" -Description $agentDesc -StartupType Manual | Out-Null
|
||||||
sc.exe sdset ssh-agent "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)"
|
sc.exe sdset ssh-agent "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)(A;;RP;;;AU)"
|
||||||
sc.exe privs ssh-agent SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege
|
sc.exe privs ssh-agent SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege
|
||||||
|
|
||||||
$sshdDesc = "SSH protocol based service to provide secure encrypted communications between two untrusted hosts over an insecure network."
|
$sshdDesc = "SSH protocol based service to provide secure encrypted communications between two untrusted hosts over an insecure network."
|
||||||
New-Service -Name sshd -DisplayName "OpenSSH SSH Server" -BinaryPathName `"$sshdpath`" -Description $sshdDesc -StartupType Manual | Out-Null
|
New-Service -Name sshd -DisplayName "OpenSSH SSH Server" -BinaryPathName "$sshdpath" -Description $sshdDesc -StartupType Manual | Out-Null
|
||||||
sc.exe privs sshd SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege
|
sc.exe privs sshd SeAssignPrimaryTokenPrivilege/SeTcbPrivilege/SeBackupPrivilege/SeRestorePrivilege/SeImpersonatePrivilege
|
||||||
|
|
||||||
Write-Host -ForegroundColor Green "sshd and ssh-agent services successfully installed"
|
Write-Host -ForegroundColor Green "sshd and ssh-agent services successfully installed"
|
||||||
|
@ -17,8 +17,14 @@ else {
|
|||||||
Write-Host -ForegroundColor Yellow "sshd service is not installed"
|
Write-Host -ForegroundColor Yellow "sshd service is not installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# unregister etw provider
|
# Unregister etw provider
|
||||||
wevtutil um `"$etwman`"
|
# PowerShell 7.3+ has new/different native command argument parsing
|
||||||
|
if ($PSVersiontable.PSVersion -le '7.2.9') {
|
||||||
|
wevtutil um `"$etwman`"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wevtutil um "$etwman"
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
|
if (Get-Service ssh-agent -ErrorAction SilentlyContinue)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user