Get-WmiObject -Class Win32_UserAccount -Filter "N
ame='$
env:username' and Dom
ain='$env:userdomain'"
Get-WmiObject -Class Win32_UserAccount -Filter "Name='$env:username' and Domain='$env:userdomain'" | Select-Object *
status&nbs
p; : OK
Caption : hong-
Book\hong
PasswordE
xpires : False
__GENUS : 2
__CLASS : Win32_UserAccount
__SU
PERCLASS : Win32_Account
__DYNASTY : CIM_Managed
SystemElement
__RELPATH : Win32_UserAccount.Domain="hong-book",Name="hong"
__
PROPERTY_COUNT : 16
__DERIVATION : {Win32_Account, CIM_
LOGicalElement, CIM_ManagedSystemElement}
__SERVER : HONG-BOOK
__
namesPACE : root\cimv2
__PATH : \\HONG-BOOK\root\cimv2:Win32_UserAccount.Domain="hong-book",Name="hong"
AccountType :
512
Description :
Disabled : False
Domain : hong-book
FullName :
InstallDate :
LocalAccount : True
Lockout : False
Name : hong
PasswordChangeable : True
PasswordRequi
red : False
SID : S-1-5-21-181061805-855091228-1216038997-1000
SIDType : 1
Scope : System.Management.ManagementScope
Path : \\HONG-BOOK\root\cimv2:Win32_UserAccount.Domain="hong-book",Name="hong"
Options : System.Management.ObjectGetOptions
ClassPath : \\HONG-BOOK\root\cimv2:Win32_UserAccount
Properties : {AccountType, Caption, Description, Disabled
...}
SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers : {dyn
amic, Locale, provider, UUID}
S
ITe :
Container :
function
test-UserPasswordExpires
{
param(
$UserName = $env:username,
$Domain = $env:userdomain
)
(Get-WmiObject -Class Win32_UserAccount -Filter "Name='$UserName' and Domain='$Domain'").PasswordExpires
}
好了,关于用户信息差不多就这么多,小编祝大家使用愉快!