*条件:保证 Powershell 版本为 5.0 以上
*第一步:打开 Windows PowerShell (管理员)
*第二步:(新建文件夹token)以下两个2选1
1.在系统 C 盘根目录新建名为“token”的文件夹
2.Powershell输入:New-Item -Path 'C:\token' -ItemType Directory
第三步:(Powershell输入命令)准备工作
1.Powershell输入:Save-Module -Name NtObjectManager -Path c:\token
回车(第一次安装会出现询问,输入“Y”并回车)
2.稍等片刻下载完成后,我们输入:Install-Module -Name NtObjectManager
回车,若出现不受信任的存储库,输入“A”并回车
3.稍等片刻,等待安装结束。结束后,我们要让系统允许使用脚本,输入:
Set-ExecutionPolicy Unrestricted
4.导入 NtObjectManager 模块,输入:Import-Module NtObjectManager
回车。准备工作结束
第四步:(Powershell输入命令)正式开始
先在PowerShell输入:sc.exe start TrustedInstaller
再在PowerShell输入:Set-NtTokenPrivilege SeDebugPrivilege
然后在PowerShell输入:$p = Get-NtProcess -Name TrustedInstaller.exe
最后在PowerShell输入:$proc = New-Win32Process cmd.exe -CreationFlags NewConsole -ParentProcess $p
来自于PowerShell的响应:第四步完成后,系统会打开一个命令提示符,该命令提示符就具有 Trustedinstaller 权限,可以直接修改系统文件。
我们可以在cmd输入:whoami /groups /fo list(可以看到已经获得 Trustedinstaller 权限了)
警告:不要使用 CMD 运行 explorer.exe,因为 explorer.exe 无法在当前用户下正常使用!