在CreateProcessAsUser命令提示符下提升时,无法识别WBAdmin命令 [英] WBAdmin command not recognized when elevated in CreateProcessAsUser Command prompt

查看:78
本文介绍了在CreateProcessAsUser命令提示符下提升时,无法识别WBAdmin命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是什么导致命令提示符无法识别WBAdmin程序?

What is causing the command prompt to not be able to recognize the WBAdmin program?

在非提升命令提示符下,我能够使用WBAdmin.当我启动提升权限的命令提示符时,它也起作用.

In non elevated command prompt, I was able to use the WBAdmin. It also works when I started the elevated command prompt.

在我的程序中,我通过使用LogonUser函数获得了用户令牌,并从其中获取了链接令牌,并具有较高的访问权限.我尝试使用CreateProcessAsUser生成状态为高的命令提示符.在该命令提示符下,我无法启动WBAdmin程序.它说该命令未被识别.

In my program I got a usertoken by using LogonUser function and took the linkedtoken from it, with elevated access. With CreateProcessAsUser I tried to spawn a command prompt with Elevated status. In that command prompt I wasn't able to start WBAdmin program. It said the command wasn't recognized.

C:\ Windows \ system32> wbadmin获取状态

C:\Windows\system32>wbadmin get status

'wbadmin'不被识别为内部或外部命令,可操作的程序或批处理文件.

'wbadmin' is not recognized as an internal or external command, operable program or batch file.

我将程序作为服务启动,它在当前桌面中启动了一个cmd窗口.我还注意到,环境设置与我当前登录帐户上的设置不同.

I started my program as a service and it launches a cmd window in my current desktop. I also have noticed that in the environment settings are different than on my currently logged in account.

区别是:

在CreateProcessAsUser命令提示符下

In CreateProcessAsUser Command prompt

APPDATA = C:\ Windows \ system32 \ config \ systemprofile \ AppData \ Roaming

APPDATA=C:\Windows\system32\config\systemprofile\AppData\Roaming

LOCALAPPDATA = C:\ Windows \ system32 \ config \ systemprofile \ AppData \ Local

LOCALAPPDATA=C:\Windows\system32\config\systemprofile\AppData\Local

TEMP = C:\ Windows \ TEMP

TEMP=C:\Windows\TEMP

TMP = C:\ Windows \ TEMP

TMP=C:\Windows\TEMP

USERPROFILE = C:\ Users \ Default

USERPROFILE=C:\Users\Default

在使用Windows登录屏幕登录的普通用户中

In normal user logged in with windows login screen

APPDATA = C:\ Users \\ AppData \ Roaming

APPDATA=C:\Users\\AppData\Roaming

LOCALAPPDATA = C:\ Users \ pta \ AppData \ Local

LOCALAPPDATA=C:\Users\pta\AppData\Local

TEMP = C:\ Users \\ AppData \ Local \ Temp

TEMP=C:\Users\\AppData\Local\Temp

TMP = C:\ Users \\ AppData \ Local \ Temp

TMP=C:\Users\\AppData\Local\Temp

USERPROFILE = C:\ Users \

USERPROFILE=C:\Users\

CreateProcessAsUser命令提示符缺少以下变量

The CreateProcessAsUser command prompt is missing following variables

HOMEDRIVE-HOMEPATH-登录服务器-PATHTEXT-USERDOMAIN

HOMEDRIVE - HOMEPATH - LOGONSERVER - PATHTEXT - USERDOMAIN

这是否意味着用户配置文件未正确加载?我使用以下行作为用户登录:

Does it mean the user profile is not loaded properly? I have used the following line to login as user:

LogonUser('username', 'domain', 'password', LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, hUserToken);

推荐答案

之所以不起作用,是因为该程序启动了32位CMD.exe.程序本身是32位的,因此默认情况下它将启动32位进程.这就是Windows将我重定向到存在32位CMD.exe的Syswow64文件夹的原因.

The reason why it did not work is, because the program started the 32-bit CMD.exe. Program itself is 32-bit and so it will start 32-bit processes by default. That is why Windows redirected me to Syswow64 folder where 32-bit CMD.exe exists.

要禁用此重定向,我使用了此功能. http://msdn.microsoft.com/en-us/library/aa365743%28VS.85%29.aspx

To disable this redirection I used this function. http://msdn.microsoft.com/en-us/library/aa365743%28VS.85%29.aspx

这篇关于在CreateProcessAsUser命令提示符下提升时,无法识别WBAdmin命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆