[英]Get Process Handle in PowerShell
I am trying to get a process handle without success, I have read a lot about that but don't know why I cannot achieve it. 我试图获得一个没有成功的流程,我已经读了很多关于它的内容,但是不知道为什么我不能实现它。
This is what I am doing: 这就是我在做什么:
$handle = $Kernel32::OpenProcess(PROCESS_ALL_ACCESS, FALSE, 4548)
I am doing it with admin rights, it seems like it doesn't like the PROCESS_ALL_ACCESS
parameter. 我正在使用管理员权限进行操作,似乎不喜欢
PROCESS_ALL_ACCESS
参数。 Any idea? 任何想法?
PowerShell doesn't recognize the symbolic constants you're trying to use there. PowerShell无法识别您要在那里使用的符号常量。 Use the numeric values instead.
请改用数字值。 For
PROCESS_ALL_ACCESS
that should be 1056763 or 0x00101ffb (and you also need $false
instead of FALSE
). 对于
PROCESS_ALL_ACCESS
,应为1056763或0x00101ffb(并且您还需要$false
而不是FALSE
)。 However, you probably shouldn't be using PROCESS_ALL_ACCESS
in the first place. 但是,您可能首先不应该使用
PROCESS_ALL_ACCESS
。
Try with PROCESS_QUERY_LIMITED_INFORMATION
(numeric value 4096 or 0x1000): 尝试使用
PROCESS_QUERY_LIMITED_INFORMATION
(数值4096或0x1000):
$handle = $Kernel32::OpenProcess(0x1000, $false, 4548)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.