Skip to content

UsrMgr_SetLocalUserProperties

Sets or changes the account properties of a local user. The function fails if the user doesn’t exist.

UsrMgr_SetLocalUserProperties(sUserName, bNoPasswordChange, bNoPasswordExpire, bChangePasswordAtNextLogin, sAccountExpireDate, sLoginScript) As Boolean

The name of the local user. The user must exist.

True sets User cannot change password. False clears it.

True sets Password never expires. False clears it.

True sets User must change password at next logon. False clears it.

The date the account expires. Specify a valid date in the future, or Never if the account should never expire.

The logon script the user runs. If you specify an empty string, the existing logon script isn’t changed.

'Sample 1:
If bStatus Then bStatus = UsrMgr_SetLocalUserProperties("Username", False, False, True, "Never", "Login.cis")
'Sample 2: Note - DateAdd adds 5 years to current date in this example
If bStatus Then bStatus = UsrMgr_SetLocalUserProperties("Username", True, True, False, DateAdd("yyyy", 5, Now), "")

Scripting Guidelines

UsrMgr_ChangePassword UsrMgr_DisableLocalUserAccount UsrMgr_CreateLocalGroup UsrMgr_AddUserToLocalGroup Constants Package Property Variables