사용자 / 패스를 사용하여 자체 상승하도록 PowerShell 스크립트를 코딩하려고합니다. 문제는 Runas와 -Credential을 Start-Process에서 함께 사용할 수 없다는 것입니다. powershell에서 powershell을 실행하려고했지만 작동하지 않습니다. 아이디어는 사용자 / 패스로 UAC를 우회하는 것입니다. 누구에게 제안이 있습니까?
편집 : 불가능합니다!
$username = "test"
$password = "123456"
$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
# Self-elevate the script if required
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
Write-Host -ForegroundColor 'Red' "Bypassing UAC..."
Start-Sleep -s 2
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
$CommandLine = "Start-Process -FilePath PowerShell.exe -verb runas -ArgumentList " + $CommandLine
Start-Process powershell.exe -Credential $credentials -ArgumentList $CommandLine
Write-Host -ForegroundColor 'Red' "Bypassing UAC..." $CommandLine
Start-Sleep -s 30
Exit
}
}
Write-Host -ForegroundColor 'Green' "Admin mode..."
Write-Host -ForegroundColor 'Gray' "Shell will exit in 15 seconds..."
Start-Sleep -s 15
UAC는 관리자 권한으로 승격하려는 시도가있을 때마다 확인 프롬프트를 표시하도록 설계되었습니다. (프로세스가 이미 상승 실행하면 프롬프트가 표시되지 않습니다.) UAC가 활성화되어 (그리고이 경우 강력하게 당신이 활성화 두는 것이 권장), 프롬프트 고도는 항상 표시됩니다. UAC 프롬프트를 우회 할 수 없습니다 (또는 대체 용어를 선호하는 경우 "프로그래밍 방식으로 수락"). 이것은 의도적으로 설계된 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다