How can I update user's Identify provider column using PowerShell?
Get-PWUsersByMatch doesn't automatically include that info unless you ask for it with -LoginInfo which may be related to allowing the command to be run by non-admins.
Bill
I want to update each user's identity property with their email address in order to enable Bentley IMS authentication. So I was looking for a powershell function to update each user's identity property with their email address
Take a look at the following two cmdlets:
I have tried it. Program is running fine, but it is not saving into the system. I am still getting users without identity even after executing the script.
$users = Get-PWUserByLastLogin -IdentityInfo -Verbose
foreach($user in $users){ if($user.Type -ne 'Logical' -and $user.Email -ne '') { if($user.Identity -ne $user.Email) { $user.Identity #$user.Email Set-PWUserIdentity -Users $user -Identity $user.Email -Verbose } }}
Have you verified this against the user accounts within PW Administrator? I don't think the cmdlet is returning the identity data.
A couple of pointers:
- You don't have to specify the identity parameter. If you don't Set-PWUserIdentity should set the identity to the user's email, if it exists. If not, the cmdlet does nothing. The cmdlet doesn't inform you that there is no email address, so you may want to output that the email doesn't exist in your script.
- If the cmdlet fails, you should receive a warning message telling you it failed.
Hope this helps,
Mark Weisman | Bentley Systems