#获取当前登录用户用户名 $curuser = (Get-WmiObject Win32_ComputerSystem).UserName #根据当前登录用户用户名获取用户SID $ob = New-Object System.Security.Principal.NTAccount(“$curuser”) $sid = $ob.Translate([System.Security.Principal.SecurityIdentifier]) $sid.Value...
whoami /user:这个命令可以显示当前登录用户的SID、域、登录名等信息。 wmic useraccount get name,sid:这个WMIC(Windows Management Instrumentation Command-line)命令可以列出所有用户账户的名称和SID。 使用Windows API: Windows API提供了函数来查询用户信息,包括LookupAccountName,它可以根据用户名查找SID,或者LookupAccoun...
要获取本地计算机上所有用户的 SID,你可以使用以下 PowerShell 命令: powershellCopy Code $users=Get-WmiObjectWin32_UserAccountforeach($userin$users) {$objUser=New-ObjectSystem.Security.Principal.NTAccount($user.Name)$strSID=$objUser.Translate([System.Security.Principal.SecurityIdentifier]).ValueWrite-Ou...
#1.获取当前登录用户;$CurrentLogonUser=(Get-WMIObject-query"SELECT * FROM win32_Process WHERE Name ='explorer.exe'"|Foreach{$owner=$_.GetOwner();$_|Add-Member-MemberType"Noteproperty"-name"Owner"-value$owner.User-passthru}).Owner|select-object-first 1#2.获取当前用户的SID;$user=New-Object...
在Linux系统中,用户帐户和登录详细信息对于系统管理和安全非常重要。了解如何查找和管理用户帐户信息以及...
the name of the RID500 user account (ADSAdministrator) without resorting to something like: Get-WmiObject Win32_Account -Filter "Domain='$TargetDomain' and SID Like '%-500' " which searches all accounts in the domain. Or, to put it another way, how would y...
UserID <SID> 否 数据 <String[]> 否 <named-data> <String[]> 否<named-data> 键表示命名事件数据字段。 例如,Perflib 事件 1008 可以包含以下事件数据:XML 复制 <EventData> <Data Name="Service">BITS</Data> <Data Name="Library">C:\Windows\System32\bitsperf.dll</D...
UserID金鑰可以採用有效的安全性識別碼 (SID) 或可用來建構有效System.Security.Principal.NTAccount 物件的功能變數名稱。 [數據]值會採用未命名字段中的事件數據。 例如,傳統事件記錄檔中的事件。 <named-data>索引鍵代表具名事件數據欄位。 當無法解譯索引鍵/值組時Get-WinEvent,它會將索...
Get-WinEvent[[-LogName] <String[]>] [-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXPath <String>] [-Force] [-Oldest] [<CommonParameters>] PowerShell Get-WinEvent[-ListLog] <String[]> [-ComputerName <String>] [-Credential <PSCredential>] [-Force...
下面介绍用PowerShell查询指定OU中所有账号的创建时间\SID\上次修改密码时间\最后一次登录时间,CMDlet如下: Get-ADuser -searchbase 'OU=User,OU=Compay1,DC=Domain,DC=COM' -filter * -Properties * | Select-Object Name,SID, Created,PasswordLastSet,@{n="lastLogonDate";e={[datetime]::FromFileTime($...