Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell Get WinEvent$\属性[]。值返回意外值_Powershell - Fatal编程技术网

Powershell Get WinEvent$\属性[]。值返回意外值

Powershell Get WinEvent$\属性[]。值返回意外值,powershell,Powershell,使用PS完成一些事件。查找失败的登录(4635),然后获取相关信息 我有点像: Get-WinEvent -FilterHashtable @{path=$path; id=$ID} | ? {$_.Properties[5].Value -match $user} | Select-Object -Property TimeCreated, @{Name="AccountName"; Expression={$_.Properties[5].Value}}, @{Name="IP ADDRES

使用PS完成一些事件。查找失败的登录(4635),然后获取相关信息

我有点像:

Get-WinEvent -FilterHashtable @{path=$path; id=$ID} | ? {$_.Properties[5].Value -match $user} |
Select-Object -Property TimeCreated, @{Name="AccountName"; Expression={$_.Properties[5].Value}}, @{Name="IP ADDRESS"; Expression={$_.Properties[19].Value}}, @{Name="LOGON"; Expression={$_.Properties[10].Value}}, @{Name="DOMAIN"; Expression={$_.Properties[6].Value}}, @{Name="STATUS"; Expression={$_.Properties[9].value}}  | 
Format-Table -Auto | Out-File temp.txt
除了
$\属性[9].value之外,一切正常。它应该返回一些十六进制值(例如
0xc000064
),但我得到一些负整数,例如
-1073741718

如何获取十六进制代码?谢谢

您可以使用

.ToString('X2')
在无符号整数上,将其输出为十六进制

您可以为此目的设置一个函数

function int2hex
{
    param([int]$value)
    return "0x$($value.ToString('X2'))"
}