Win32_NetworkLoginProfile

Win32 Network Login Profile
root/cimv2dynamickey : Name

The Win32_NetworkLoginProfile WMI class represents the network login information of a specific user on a computer system running Windows.

On this page

Main example

List instances

# All instances of Win32_NetworkLoginProfile, with the main properties
Get-CimInstance -ClassName Win32_NetworkLoginProfile |
    Select-Object -Property Name, Description, AccountExpires, AuthorizationFlags

Examples

Filter with WQL

# WQL filter evaluated by the provider: names starting with "a" (the WQL wildcard is %)
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Filter "Caption LIKE 'a%'" |
    Select-Object -Property Name, Description, AccountExpires, AuthorizationFlags

The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.

Decode numeric values

# AuthorizationFlags is a bit field: each set bit is decoded with -band
$authorizationFlagsFlag = @{
    1 = 'Printer'
    2 = 'Communication'
    4 = 'Server'
    8 = 'Accounts'
}
# Flags is a bit field: each set bit is decoded with -band
$flagsFlag = @{
    1 = 'Script A logon script executed'
    2 = 'Account Disabled The user''s account is disabled'
    8 = 'Home Directory Required A home directory is required'
    16 = 'Lockout The account is currently locked out'
    32 = 'Password Not Required No password is required'
    64 = 'Password Cannot Change The user cannot change the password'
    128 = 'Encrypted Test Password Allowed'
    256 = 'Temp Duplicate Account An account for users whose primary…'
    512 = 'Normal Account Default account type that represents a…'
    2048 = 'Interdomain Trust Account A permit to a trust account for a…'
    4096 = 'Workstation Trust Account A computer account for a Windows…'
    8192 = 'Server Trust Account A computer account for a backup domain…'
    65536 = 'Do Not Expire Password'
    131072 = 'MNS Logon Account Majority Node Set (MNS) logon account type…'
    262144 = 'Smartcard Required'
    524288 = 'Trusted for Delegation'
    1048576 = 'Not Delegated'
    2097152 = 'Use DES Key Only'
    4194304 = 'Do Not Require Preauthorization'
    8388608 = 'Password Expired Indicates that the password has expired'
}

Get-CimInstance -ClassName Win32_NetworkLoginProfile |
    Select-Object -Property @(
        'Name'
        'Description'
        'AccountExpires'
        @{
            Name       = 'AuthorizationFlags'
            Expression = {
                $value = $_.AuthorizationFlags
                $authorizationFlagsFlag.Keys |
                    Sort-Object |
                    Where-Object -FilterScript { $value -band $_ } |
                    ForEach-Object -Process { $authorizationFlagsFlag[$_] }
            }
        }
        @{
            Name       = 'Flags'
            Expression = {
                $value = $_.Flags
                $flagsFlag.Keys |
                    Sort-Object |
                    Where-Object -FilterScript { $value -band $_ } |
                    ForEach-Object -Process { $flagsFlag[$_] }
            }
        }
    )

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName Win32_NetworkLoginProfile |
        Select-Object -Property Name, Description, AccountExpires, AuthorizationFlags
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_NetworkLoginProfile
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

Properties

32 of 32 properties
NameTypeAccessDescription
AccountExpiresdatetimeread

Account will expire. This value is calculated from the number of seconds elapsed since 00:00:00, January 1, 1970, and is set in this format: yyyymmddhhmmss.mmmmmm sutc.

Example: 20521201000230.000000 000

Code
# Value of AccountExpires for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, AccountExpires |
    Select-Object -Property Name, AccountExpires
AuthorizationFlagsuint32read

Set of flags that specify the resources a user is authorized to use or modify.

Values (4) — bit field
ValueLabelDescription
1Printer
2Communication
4Server
8Accounts
Code
# Value of AuthorizationFlags for each instance
# AuthorizationFlags is a bit field: each set bit is decoded with -band
$authorizationFlagsFlag = @{
    1 = 'Printer'
    2 = 'Communication'
    4 = 'Server'
    8 = 'Accounts'
}
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, AuthorizationFlags |
    Select-Object -Property @(
        'Name'
        @{
            Name       = 'AuthorizationFlags'
            Expression = {
                $value = $_.AuthorizationFlags
                $authorizationFlagsFlag.Keys |
                    Sort-Object |
                    Where-Object -FilterScript { $value -band $_ } |
                    ForEach-Object -Process { $authorizationFlagsFlag[$_] }
            }
        }
    )
BadPasswordCountuint32read

Number of times the user enters a bad password when logging on to a computer system running Windows.

Example: 0

Code
# Value of BadPasswordCount for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, BadPasswordCount |
    Select-Object -Property Name, BadPasswordCount
Captionstringread

Short textual description of the current object.

Code
# Value of Caption for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Caption |
    Select-Object -Property Name, Caption
CodePageuint32read

Code page for the user's language of choice. A code page is the character set used.

Code
# Value of CodePage for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, CodePage |
    Select-Object -Property Name, CodePage
Commentstringread

Comment or description for this logon profile.

Code
# Value of Comment for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Comment |
    Select-Object -Property Name, Comment
CountryCodeuint32read

Country/region code for the user's language of choice.

Code
# Value of CountryCode for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, CountryCode |
    Select-Object -Property Name, CountryCode
Descriptionstringread

Textual description of the current object.

Code
# Value of Description for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Description |
    Select-Object -Property Name, Description
Flagsuint32read

The properties available to this network profile.

Properties that can be set include:

The following properties describe the account type. Only one value can be set:

  • UF_NORMAL_ACCOUNT
  • UF_TEMP_DUPLICATE_ACCOUNT
  • UF_WORKSTATION_TRUST_ACCOUNT
  • UF_SERVER_TRUST_ACCOUNT
  • UF_INTERDOMAIN_TRUST_ACCOUNT
Values (20) — bit field
ValueLabelDescription
1Script A logon script executed. This value must be set for LAN Manager 2.0.
2Account Disabled The user's account is disabled.
8Home Directory Required A home directory is required.
16Lockout The account is currently locked out. For NetUserSetInfo, this value can be cleared to unlock a previously locked account. This value cannot be used to lock a previously unlocked account.
32Password Not Required No password is required.
64Password Cannot Change The user cannot change the password.
128Encrypted Test Password Allowed
256Temp Duplicate Account An account for users whose primary account is in another domain. This account provides user access to this domain, but not to any domain that trusts this domain. The User Manager refers to this account type as a local user account.
512Normal Account Default account type that represents a typical user.
2048Interdomain Trust Account A permit to a trust account for a domain that trusts other domains.
4096Workstation Trust Account A computer account for a Windows workstation or server that is a member of this domain.
8192Server Trust Account A computer account for a backup domain controller that is a member of this domain.
65536Do Not Expire Password
131072MNS Logon Account Majority Node Set (MNS) logon account type that represents an MNS user.
262144Smartcard Required
524288Trusted for Delegation
1048576Not Delegated
2097152Use DES Key Only
4194304Do Not Require Preauthorization
8388608Password Expired Indicates that the password has expired.
Code
# Value of Flags for each instance
# Flags is a bit field: each set bit is decoded with -band
$flagsFlag = @{
    1 = 'Script A logon script executed'
    2 = 'Account Disabled The user''s account is disabled'
    8 = 'Home Directory Required A home directory is required'
    16 = 'Lockout The account is currently locked out'
    32 = 'Password Not Required No password is required'
    64 = 'Password Cannot Change The user cannot change the password'
    128 = 'Encrypted Test Password Allowed'
    256 = 'Temp Duplicate Account An account for users whose primary…'
    512 = 'Normal Account Default account type that represents a…'
    2048 = 'Interdomain Trust Account A permit to a trust account for a…'
    4096 = 'Workstation Trust Account A computer account for a Windows…'
    8192 = 'Server Trust Account A computer account for a backup domain…'
    65536 = 'Do Not Expire Password'
    131072 = 'MNS Logon Account Majority Node Set (MNS) logon account type…'
    262144 = 'Smartcard Required'
    524288 = 'Trusted for Delegation'
    1048576 = 'Not Delegated'
    2097152 = 'Use DES Key Only'
    4194304 = 'Do Not Require Preauthorization'
    8388608 = 'Password Expired Indicates that the password has expired'
}
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Flags |
    Select-Object -Property @(
        'Name'
        @{
            Name       = 'Flags'
            Expression = {
                $value = $_.Flags
                $flagsFlag.Keys |
                    Sort-Object |
                    Where-Object -FilterScript { $value -band $_ } |
                    ForEach-Object -Process { $flagsFlag[$_] }
            }
        }
    )
FullNamestringread

Full name of the user belonging to the network login profile. This string can be empty if the user chooses not to associate a full name with a user name.

Code
# Value of FullName for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, FullName |
    Select-Object -Property Name, FullName
HomeDirectorystringread

Path to the home directory of the user. This string may be empty if the user chooses not to specify a home directory.

Example:"\HOMEDIR"

Code
# Value of HomeDirectory for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, HomeDirectory |
    Select-Object -Property Name, HomeDirectory
HomeDirectoryDrivestringread

Drive letter assigned to the user's home directory for log on purposes.

Example: "C:"

Code
# Value of HomeDirectoryDrive for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, HomeDirectoryDrive |
    Select-Object -Property Name, HomeDirectoryDrive
LastLogoffdatetimeread

User last logged off the system. This value is calculated from the number of seconds elapsed since 00:00:00, January 1, 1970. A value of " .+*** " means that the last logoff time is unknown. The format of this value is yyyymmddhhmmss.mmmmmm sutc. For information about translating this property into your local time, see WMI Tasks: Dates and Times.

Example: 19521201000230.000000 000

Code
# Value of LastLogoff for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, LastLogoff |
    Select-Object -Property Name, LastLogoff
LastLogondatetimeread

User last logged on to the system. This value is calculated from the number of seconds elapsed since 00:00:00, January 1, 1970. The format of this value is yyyymmddhhmmss.mmmmmm sutc. For information about translating this property into your local time, see WMI Tasks: Dates and Times.

Example: 19521201000230.000000 000

Code
# Value of LastLogon for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, LastLogon |
    Select-Object -Property Name, LastLogon
LogonHoursstringread

Times during the week when the user can log on. Each bit represents a unit of time specified by the UnitsPerWeek property. For instance, if the unit of time is hourly, the first bit (bit 0, word 0) is Sunday, 0:00 to 0:59, the second bit (bit 1, word 0) is Sunday, 1:00 to 1:59, and so on. If this member is set to NULL, then there is no time restriction. The time is set to GMT and must be adjusted for other time zones (for example, GMT minus 8 hours for PST).

Code
# Value of LogonHours for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, LogonHours |
    Select-Object -Property Name, LogonHours
LogonServerstringread

Name of the server to which logon requests are sent. Server names should be preceded by two backslashes (\\). A server name with an asterisk (\\*) indicates that the logon request can be handled by any logon server. A null string indicates that requests are sent to the domain controller.

Example: "\\MyServer"

Code
# Value of LogonServer for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, LogonServer |
    Select-Object -Property Name, LogonServer
MaximumStorageuint64read

Maximum amount of disk space available to the user. If MaximumStorage is set to USER_MAXSTORAGE_UNLIMITED, the user is allowed to use all of the available disk space.

Example: 10000000

For more information about using uint64 values in scripts, see Scripting in WMI).

Unit: bytes

Code
# Value of MaximumStorage for each instance
# MaximumStorage is expressed in bytes: converted to GB
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, MaximumStorage |
    Select-Object -Property @(
        'Name'
        @{ Name = 'MaximumStorageGB'; Expression = { [math]::Round($_.MaximumStorage / 1GB, 2) } }
    )
Name keystringread

User account on a particular domain or computer. The number of characters in the name cannot exceed the value of UNLEN.

Example: "somedomain\johndoe"

Code
# Value of Name for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name |
    Select-Object -Property Name
NumberOfLogonsuint32read

Number of successful times the user tried to log on to this account. A value of 0xFFFFFFFF indicates that the value is unknown. This property is maintained separately on each backup domain controller (BDC) in the domain. To get an accurate value, only the largest value from all BDCs should be used.

Example: 4

Code
# Value of NumberOfLogons for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, NumberOfLogons |
    Select-Object -Property Name, NumberOfLogons
Parametersstringread

Space set aside for use by applications. This string can be null, or it can have any number of characters before the terminating null character. Microsoft products use this member to store user configuration information. Do not modify this information, because this value is specific to an application.

Code
# Value of Parameters for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Parameters |
    Select-Object -Property Name, Parameters
PasswordAgedatetimeread

Length of time a password has been in effect. This value is measured from the number of seconds elapsed since the password was last changed.

Example: 00001201000230.000000 000

Code
# Value of PasswordAge for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, PasswordAge |
    Select-Object -Property Name, PasswordAge
PasswordExpiresdatetimeread

Date and time the password expires. The value is set in this format: yyyymmddhhmmss.mmmmmm sutc

Example: 19521201000230.000000 000

Code
# Value of PasswordExpires for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, PasswordExpires |
    Select-Object -Property Name, PasswordExpires
PrimaryGroupIduint32read

Relative identifier (RID) of the Primary Global Group for this user. The identifier verifies the primary group to which the user's profile belongs.

Code
# Value of PrimaryGroupId for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, PrimaryGroupId |
    Select-Object -Property Name, PrimaryGroupId
Privilegesuint32read

Level of privilege assigned to the usri3_name property.

Values (3)
ValueLabelDescription
0Guest
1User
2Administrator
Code
# Value of Privileges for each instance
# Lookup table for Privileges (values documented by Microsoft)
$privilegesName = @{
    0 = 'Guest'
    1 = 'User'
    2 = 'Administrator'
}
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Privileges |
    Select-Object -Property @(
        'Name'
        @{ Name = 'Privileges'; Expression = { $privilegesName[[int]$_.Privileges] } }
    )
Profilestringread

Path to the user's profile. This value can be a null string, a local absolute path, or a UNC path. A user profile contains settings that are customizable for each user such as the desktop colors.

Example: "C:\Windows"

Code
# Value of Profile for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Profile |
    Select-Object -Property Name, Profile
ScriptPathstringread

Directory path to the user's logon script. A logon script automatically executes a set of commands each time a user logs on to a system.

Example: "C:\win\profiles\ThomasSteven"

Code
# Value of ScriptPath for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, ScriptPath |
    Select-Object -Property Name, ScriptPath
SettingIDstringread

Identifier by which the current object is known.

Code
# Value of SettingID for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, SettingID |
    Select-Object -Property Name, SettingID
UnitsPerWeekuint32read

Number of time units the week is divided into. It is used with the LogonHours property to limit user access to the computer.

Example: 168 (hours per week)

Code
# Value of UnitsPerWeek for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, UnitsPerWeek |
    Select-Object -Property Name, UnitsPerWeek
UserCommentstringread

User-defined comment or description for this profile.

Code
# Value of UserComment for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, UserComment |
    Select-Object -Property Name, UserComment
UserIduint32read

RID of the user. The identifier verifies that the user exists and is unique to this domain.

Code
# Value of UserId for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, UserId |
    Select-Object -Property Name, UserId
UserTypestringread

Type of account to which the user has privileges.

The values are:

  • "Normal Account"
  • "Duplicate Account"
  • "Workstation Trust Account"
  • "Server Trust Account"
  • "Interdomain Trust Account"
  • "Unknown"
Values (6)
ValueLabelDescription
Normal AccountNormal Account
Duplicate AccountDuplicate Account
Workstation Trust AccountWorkstation Trust Account
Server Trust AccountServer Trust Account
Interdomain Trust AccountInterdomain Trust Account
UnknownUnknown
Code
# Value of UserType for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, UserType |
    Select-Object -Property Name, UserType
Workstationsstringread

Names of workstations from which the user can log on. Up to eight workstations can be specified; the names must be separated by commas (,). A null string indicates no restrictions. To disable logons from all workstations to this account, set the UF_ACCOUNTDISABLE in the Flags property of this class.

Code
# Value of Workstations for each instance
Get-CimInstance -ClassName Win32_NetworkLoginProfile -Property Name, Workstations |
    Select-Object -Property Name, Workstations

Remarks

The Win32_NetworkLoginProfile class is derived from CIM_Setting.

The calling process that uses this class must have the SE_RESTORE_NAME privilege on the computer in which the registry resides. For more information, see Executing Privileged Operations.

Inheritance

Superclass chain

  1. CIM_Setting
  2. Win32_NetworkLoginProfile

Known subclasses

No known subclass.

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
Provider
CIMWin32
MOF file
CIMWin32.mof
DLL
CIMWin32.dll
Class qualifiers

Dynamic Provider("CIMWin32") Privileges("SeRestorePrivilege") UUID("{8502C4E7-5FBB-11D2-AAC1-006008C78BC7}") AMENDMENT

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.