{"id":76678,"date":"2023-05-19T13:26:02","date_gmt":"2023-05-19T17:26:02","guid":{"rendered":"https:\/\/jumpcloud.com\/?post_type=support&p=76678"},"modified":"2024-09-19T17:13:09","modified_gmt":"2024-09-19T21:13:09","slug":"import-users-from-csv-with-powershell-module","status":"publish","type":"support","link":"https:\/\/jumpcloud.com\/support\/import-users-from-csv-with-powershell-module","title":{"rendered":"Import Users from CSV with the PowerShell Module"},"content":{"rendered":"\n
The JumpCloud PowerShell Module<\/a> contains two CSV import-specific commands designed to be used in tandem for importing users into JumpCloud from a CSV file. The first command creates the .CSV import template file on the local machine, which administrators then populate with their end user information and import with the second command.<\/p>\n\n\n\n <\/p><\/div> Need to install the module? The module can be installed on Mac, Windows, and Linux in a few quick steps<\/a>.<\/em><\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Using this import workflow, JumpCloud administrators can:<\/p>\n\n\n\n By adding JumpCloud users to JumpCloud user groups during import, administrators can:<\/p>\n\n\n\n Considerations<\/strong>:<\/p>\n\n\n\n <\/p><\/div> Active users created with a password aren\u2019t sent an activation email on CSV import. If you do NOT<\/strong> want JumpCloud to send emails to your users, you MUST<\/strong> set user passwords. Note that emails will never be trigger for users created as staged. <\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n The command To run the command, open a PowerShell terminal and enter the PowerShell command at the prompt:<\/p>\n\n\n\n New-JCImportTemplate<\/p>\n<\/div><\/div>\n\n\n\n After running the command, administrators will be asked a series of interactive questions in the terminal. The answers to these questions will define the column headers that are added to the CSV template file that is created by this command. The questions that are asked are shown below.<\/p>\n\n\n\n The CSV file will be created within the directory: This file is created within the current working directory of the PowerShell session by default.<\/p>\n\n\n\n Do you want to create an import CSV template for creating new users or for updating existing users? Do you want to add extended user information attributes available over JumpCloud LDAP to your users during import? Do you want to add extended user location attributes available over JumpCloud LDAP to your users during import? Do you want to add extended user telephony attributes available over JumpCloud LDAP to your users during import? Do you want to bind your new users to existing JumpCloud systems during import? JumpCloud users can be bound to JumpCloud devices during import. To leverage this feature, the JumpCloud agent must first be installed on the devices you want to manage. JumpCloud devices are identified by their SystemID.<\/p>\n\n\n\n By pressing Y<\/strong> at this prompt, you’ll be asked for your JumpCloud API key. This API key will be used to authenticate to the JumpCloud API to create a .CSV<\/strong> file in the home folder of the logged-in user that contains all JumpCloud devices, as well as the SystemID for these systems. This file is named JCSystems_CurrentDate.csv<\/strong>.<\/p>\n\n\n\n Do you want to add the new users to JumpCloud user groups during import? Enter Y for Yes or N for No:<\/p>\n<\/div><\/div>\n\n\n\n Users can be added to JumpCloud User groups during import. <\/p>\n\n\n\n <\/p><\/div> If you want to add users to groups, these groups must already be created within the JumpCloud Admin Portal. Enter Y<\/strong> at this prompt to add columns in the CSV import template for group additions.<\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Do you want to add the new users to JumpCloud user groups during import? Enter Y for Yes or N for No: y If Y<\/strong> is entered, enter a numeric value for the MAXIMUM number of groups to which you want to add a single user. For example, if I wanted to add my imported users to groups Denver, AllEmployee, Microsoft 365, and Admins, I would enter 4<\/strong> at this prompt. <\/p>\n\n\n\n <\/p><\/div> This doesn\u2019t mean that I have to add all imported users to four groups.<\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Do you want to add any custom attributes to your users during import? Enter Y for Yes or N for No:<\/p>\n<\/div><\/div>\n\n\n\n Custom attributes are only presented over the JumpCloud API. Custom attributes aren\u2019t presented over JumpCloud LDAP. Enter Y<\/strong> at this prompt if you want to add custom attributes to your users during import.<\/p>\n\n\n\n Do you want to add any custom attributes to your users during import? Enter Y for Yes or N for No: y If Y<\/strong> is entered, enter a numeric value for the MAXIMUM number of attributes to which you want to add a single user. For example, if I wanted to add attributes Favorite Food, Birthday, and Emergency Contact, I would enter 3<\/strong> at this prompt. <\/p>\n\n\n\n <\/p><\/div> This doesn\u2019t mean that I have to add three attributes to all users.<\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Creating file JCUserImport_03-14-2015.csv in the location \/Users\/buster After answering all questions, the import file will be located in the home directory of the logged in user. Enter Y<\/strong> at this prompt to open the file in the system’s default CSV editor.<\/p>\n\n\n\n After creating a CSV import template using the steps described above, JumpCloud administrators can populate this CSV import file with their end user information and fill in the related fields for custom attributes, JumpCloud system associations, or JumpCloud groups.<\/p>\n\n\n\n <\/p><\/div> Find below an example .CSV<\/strong> file filled out with information for three users:<\/p>\n\n\n\n FirstName,LastName,Username,Email,Password,Nate,Nickerson,nnickerson,nnickerson@sabre.com,P@ssword1! Holly,Flax,hflax,hflax@sabre.com,P@ssword1!@,Deangelo,Vickers,dvickers,dvickers@sabre.com,P@ssword1!<\/p>\n<\/div><\/div>\n\n\n\n Once the import CSV template has been filled out with end-user information and saved, it’s ready to be imported using the command Import-JCUsersFromCSV<\/a>.<\/p>\n\n\n\n To run the command, open a PowerShell terminal, enter the PowerShell command Connect-JCOnline<\/a> at the prompt, and pass in your JumpCloud API key to authenticate the PowerShell session to the JumpCloud API.<\/p>\n\n\n\n <\/p><\/div> Your JumpCloud API key can be found in the JumpCloud Admin Portal within API Settings<\/strong>, accessible from the icon in the top right corner of the JumpCloud Admin Portal.<\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Connect-JCOnline<\/p>\n<\/div><\/div>\n\n\n\n After successfully connecting to JumpCloud, navigate in the terminal to the location of the import .CSV file.<\/p>\n\n\n\n PS \/Users\/buster\/Desktop\/Import Files> dir The \n
\n
\n
\n
Creating the CSV Import File<\/h2>\n\n\n\n
New-JCImportTemplate<\/code> creates a blank CSV import file on a JumpCloud administrator’s local machine.<\/p>\n\n\n\n
Question 1<\/h3>\n\n\n\n
\/Users\/buster
Enter Y to confirm or N to change output location:<\/p>\n<\/div><\/div>\n\n\n\n\n
Question 2<\/h3>\n\n\n\n
Enter “N” for to create a template for new users
Enter “U” for creating a template for updating existing users
Enter N for ‘new users’ or U for ‘updating users’:<\/p>\n<\/div><\/div>\n\n\n\n\n
Question 3<\/h3>\n\n\n\n
Extended user information attributes include: MiddleName, preferredName, jobTitle, employeeIdentifier, department, costCenter, company, employeeType, description, and location
Enter Y for Yes or N for No:<\/p>\n<\/div><\/div>\n\n\n\n\n
\n
Question 4<\/h3>\n\n\n\n
Extended user location attributes include: home_streetAddress, home_poBox, home_city, home_state, home_postalCode, home_country, work_streetAddress, work_poBox, work_city, work_state, work_postalCode, work_country<\/p>\n<\/div><\/div>\n\n\n\n\n
\n
Question 5<\/h3>\n\n\n\n
Extended user telephony attributes include: mobile_number, home_number, work_number, work_mobile_number, work_fax_number<\/p>\n<\/div><\/div>\n\n\n\n\n
\n
Question 6<\/h3>\n\n\n\n
Enter Y for Yes or N for No:<\/p>\n<\/div><\/div>\n\n\n\nQuestion 7<\/h3>\n\n\n\n
What is the maximum number of groups you want to add a single user to during import? ENTER A NUMBER:<\/p>\n<\/div><\/div>\n\n\n\nQuestion 8<\/h3>\n\n\n\n
What is the maximum number of custom attributes you want to add to a single user during import? ENTER A NUMBER:<\/p>\n<\/div><\/div>\n\n\n\n
Do you want to open the file JCUserImport_03-14-2015.csv? Enter Y for Yes or N for No:<\/p>\n<\/div><\/div>\n\n\n\nPopulating the CSV Import File<\/h2>\n\n\n\n
\n
\n
Importing the CSV Import File<\/h2>\n\n\n\n
Directory: \/Users\/buster\/Desktop\/Import
Files Mode LastWriteTime Length Name
—- ————- —— —- ——
3\/14\/15 9:26 AM 535 JCUserImport_03-14-2015.csv<\/p>\n<\/div><\/div>\n\n\n\ndir<\/code> command, which is an alias for the command Get-ChildItem<\/a>, returns all the items in the current directory.<\/p>\n\n\n\n