본문 바로가기
유용한 정보/· PowerShell

UserAccount - WMI sample in Powershell

by 넷둥이파파 2014. 9. 22.

 

 

원문링크 : http://www.activexperts.com/admin/scripts/wmiscripts/powershell/0683/

 

UserAccount - WMI sample in Powershell

 

The foundations for Manageability in Windows 2012/2008/2003/2000/8/7/Vista/XP are Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).

ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself.

On this site, you can find many WMI samples.

The UserAccount WMI class can be used in ActiveXperts Network Monitor to monitor your servers.


UserAccount

Description

ActiveXperts Network Monitor ships with a large collection of WMI based PowerShell scripts and VBScript scripts to monitor and manage a network.

Use ActiveXperts Netork Monitor to monitor your virtualization servers, domains, computers and devices. It runs on a single Windows server, without agents required on the monitored systems. It has many built-in checks and also allows administrators to create custom checks using PowerShell, VBScript, WMI and SSH.

 

 

 

 

Example(s)

  

$objWMi = get-wmiobject -computername localhost -Namespace root\CIMV2 -Query "Select * from Win32_UserAccount"

foreach ($obj in $objWmi)
{
write-host "AccountType:" $obj.AccountType
write-host "Caption:" $obj.Caption
write-host "Description:" $obj.Description
write-host "Disabled:" $obj.Disabled
write-host "Domain:" $obj.Domain
write-host "FullName:" $obj.FullName
write-host "InstallDate:" $obj.InstallDate
write-host "LocalAccount:" $obj.LocalAccount
write-host "Lockout:" $obj.Lockout
write-host "Name:" $obj.Name
write-host "PasswordChangeable:" $obj.PasswordChangeable
write-host "PasswordExpires:" $obj.PasswordExpires
write-host "PasswordRequired:" $obj.PasswordRequired
write-host "SID:" $obj.SID
write-host "SIDType:" $obj.SIDType
write-host "Status:" $obj.Status
write-host
write-host "########"
write-host
}

 

 

$strComputer = "192.168.0.1"

$objWMi = get-wmiobject -computername 192.168.0.1 -Namespace root\CIMV2 -Query "Select * from Win32_SystemUsers"

foreach ($obj in $objWmi)
{
 write-host "GroupComponent:" $obj.GroupComponent
 write-host "PartComponent:" $obj.PartComponent
 write-host
 write-host "########"
 write-host
}