user must change password at next logon Powershell

user must change password at next logon Powershell

avatar

Hello all

Just to be sure, is there a way to set the "user must change password at next logon" to true with Powershell?
Because there is nothing in the RDM cmdlet documentation for New-RDMUser nor in the User attributes.
Attributes:
@{CreateSQLServerLogin=False
HasPrivateVault=False
IntegratedSecurity=False
Name=xxx
Password=
ServerUserType=0
UserInfo=xxx
UserType=User
CanAdd=True
CanDelete=True
CanEdit=True
CanMove=True
ConnectionOverrides=
CreationDate=01/01/0001 00:00:00
CustomSecurity=<?xml version="1.0"?>
<CustomSecurity>
<CustomRoles>
<string>1b850ba4-c515-4512-a0b6-f99d9747c839</string>
</CustomRoles>
</CustomSecurity>
DataSourceID=00000000-0000-0000-0000-000000000000
DenyAddInRoot=False
Description=xxx
Email=xx.x@email.com
FirstName=xxx
GroupInfos=System.String[]
HasAccessLauncher=True
HasAccessRDM=True
HasAccessWeb=True
HasAccessWebLogin=True
ID=c2bda4a4-246c-439f-b1ae-7239e4cd1b1c
IsAdministrator=False
IsEnabled=True
IsLockedOut=False
IsNew=False
IsOwner=False
IsTemplate=False
LastLockoutDate=
LastName=x
LoginEmail=}


Best Regards
Rolf

All Comments (3)

avatar

Hello,

There is actually a way to access this property, it's just not in the base object...
You will have to set the "UserInfo.UserAccount.UserMustChangePasswordAtNextLogon" to $True
ex:
$myUser = Get-RDMUser -Name "xxx";
$myUser.UserInfo.UserAccount.UserMustChangePasswordAtNextLogon = $True;
Set-RDMUser $myUser;

I hope this helps!

Best regards,

Alex Belisle

avatar

Hello

Thank you very much. This helps alot.

Best regards
Rolf

avatar

Hello,

Awesome, glad it works as expected!

Have a great one!

Best regards,

Alex Belisle