Bulk Creation of Power Readers
When you need to create a number of Power Reader accounts in your ClickHelp portal, you can automate this process using the ClickHelp API. On the Windows platform, the easiest way to do this is to use PowerShell. In this topic, you will find a sample PowerShell script and additional instructions to implement this automation.
Here is the PowerShell script code to use, you will need to save it in a text file with the .ps1 file extension:
PowerShell script
Bash (Unix Shell) |
# Before running the script, you may need to execute this command from a PowerShell console started As Administrator: |
The script above accepts a CSV file with user data, here is an example of such file contents:
Code |
userName,email,firstName,middleName,lastName,userRole,isDontSendEmail |
Important | |
The content of a CSV file, including the keyword "true", is case-sensitive. |
Here are the steps to prepare your environment and run the PowerShell script to import your Power Readers:
-
Depending on your PowerShell security settings, before you can run a script file, you may need to allow running non-signed scripts on your computer. To do this, follow the steps below:
-
run a new PowerShell console in the As Administrator mode;
-
execute this command:
Set-ExecutionPolicy RemoteSigned
-
when the system asks for confirmation, type Y and press Enter.
-
run a new PowerShell console in the As Administrator mode;
-
Prepare a CSV file with user data, an example was given above. A few notes about the CSV file:
-
values of names and e-mails must contain only Latin characters, no Unicode symbols;
-
the latest value in each row is a boolean flag, leave it true if you don't want to send a confirmation e-mail to each Power Reader, or change it to false to allow auto-sending login credentials to each created user;
-
by default, the script will look for the "PowerReaderList.csv" file on the desktop of the current user, you can change this in the script code if you need to.
-
values of names and e-mails must contain only Latin characters, no Unicode symbols;
-
Prepare your PowerShell script.
- Open the script file in any text editor and specify your API key in line 17 inside double quotes. To learn how to generate your API Key, check this topic: Get API Key.
-
Specify your portal domain name in the Server variable declaration, and your user login name - in the uName variable declaration. The user login name and the API Key must match.
- To run the PowerShell script, right-click the PS1 file you created, and select the Run with PowerShell context menu command.
Once you start the script, it will post the status for each Power Reader it is trying to create - error or success. If something goes wrong and there are errors, don't close the PowerShell console - you can copy&paste the output to a text editor and search for "error" to see which Power Readers were affected.
It is recommended that you try using this script for a couple of Power Readers first, and check how it works for you. If everything works well, you can run it for the rest of the Power Reader users.