Purpose
Quickpass by CyberQP leverages the Mobile Active Directory attribute from an End User account to populate the Quickpass account's mobile number field at time of import. To assist in completing a bulk update of the Mobile attribute for your domain End Users before the Quickpass automatic import is done, the following Powershell scripts have been developed.
Application
Script #1 - Start Here
Attached at the bottom of this article or here - exportUsersFromOU.ps1
This script will get User accounts from the desired OU and any SubOU and export that information to a CSV locally. The CSV will contain for each User account the UPN, Display Name, Mobile, and Organizational Unit.
NOTE: As this is a custom built script, you may have to enable the permission to run the script by using the command:
Set-ExecutionPolicy Bypass
When running the script from command line you will be prompted to enter the fully formatted Distinguished name of the target OU, allowing you to be as granular or broad as you need for your User export.
#e.g., OU=subOU,OU=rootOU,DC=domain,DC=com
OR
#e.g., DC=domain,DC=com
The CSV file will create and export to the following location unless changed in the script - C:\User Object Export\ouExport.csv
- NOTE: If the export location is changed in the script, you will also need to change the variable $csvPath in Script #2 accordingly.
Once the file is exported, open the CSV and populate the Mobile column for the User account(s) as desired.
Once completed, proceed to Script #2.
- NOTE: If you want to manually populate the CSV and use that as the target file for Script #2 - updateMobileFromCSV.ps1, a template CSV, ouExport.csv, has been attached to the bottom of this article.
Script #2
Attached at the bottom of this article or here - updateMobileFromCSV.ps1
This script will scan through the CSV and update the mobile number as populated in the CSV for each User account referenced.
By default, only User accounts that have the Mobile attribute empty will be updated. If you desire to update all User accounts referenced in the CSV regardless of the current value in the User(s) Mobile attribute, append the '-ForceUpdate' parameter when running the script from command line.
NOTE: As this is a custom built script, you may have to enable the permission to run the script by using the command:
Set-ExecutionPolicy Bypass
Example executions of the script:
PS cd C:\>.\updateMobileFromCSV.ps1
PS C:\>.\updateMobileFromCSV.ps1 -ForceUpdate
For a User account that was successful updated, the following message will display:
Updated mobile phone number for user $displayName in Domain: $domain
Otherwise, if '-ForceUpdate' was not enabled, the following message will display for all User accounts that did not meet the criteria for update:
Mobile field for $displayName is already populated. No update was made.
Comments
0 comments
Please sign in to leave a comment.