Revert "Self-elevate OpenSSH overwrite script"
This reverts commit b13fdb492e.
This commit is contained in:
@@ -1,26 +1,3 @@
|
||||
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$currentPrincipal = [Security.Principal.WindowsPrincipal]::new($currentIdentity)
|
||||
$isElevated = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
|
||||
if (-not $isElevated)
|
||||
{
|
||||
$shellPath = Join-Path $PSHOME 'pwsh.exe'
|
||||
|
||||
if (-not (Test-Path $shellPath))
|
||||
{
|
||||
$shellPath = 'powershell.exe'
|
||||
}
|
||||
|
||||
Start-Process -FilePath $shellPath -Verb RunAs -ArgumentList @(
|
||||
'-ExecutionPolicy',
|
||||
'Bypass',
|
||||
'-File',
|
||||
$PSCommandPath
|
||||
)
|
||||
|
||||
exit
|
||||
}
|
||||
|
||||
$targetPath = 'C:\Windows\System32\OpenSSH\LICENSE.txt'
|
||||
|
||||
Set-Content -Path $targetPath -Value 'hello world'
|
||||
|
||||
Reference in New Issue
Block a user