Add Users to a User Group in Bulk using PowerShell
Purpose
This guide explains how to add multiple users to JumpCloud user groups using PowerShell and a CSV file. It helps automate user onboarding and group membership management efficiently across multiple environments.
Prerequisites
- JumpCloud admin access and a valid API key
- PowerShell installed on Windows or macOS
- CSV file with mapped usernames and group names
For general PowerShell setup and module installation, refer to Bulk Remove Users in JumpCloud using PowerShell
for a similar configuration process.
Step 1 – Install the JumpCloud PowerShell Module
For Windows
- Open PowerShell as Administrator.
- Run the following commands:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned Install-Module JumpCloud
- If you face any issues during installation, reach out to support@netnxt.com
- for assistance.
For macOS
- Download and install PowerShell suitable for your macOS version.
- Once installed, open PowerShell and run:
Install-Module JumpCloud
- For troubleshooting or references, contact our support experts.
- .
Step 2 – Connect PowerShell to JumpCloud
- Open PowerShell as Administrator.
- Connect using the command:
Connect-JCOnline
- Provide your API Key when prompted.
- Store the API key securely.
- Avoid generating multiple keys, as new keys deactivate the old ones.
If you’re unsure about API key management, check JumpCloud’s official documentation or contact NetNXT for guidance on Unified Device Management Services.
Step 3 – Prepare the CSV File
Create a CSV file named groupimport.csv with the following format:
GroupName, Username All Users, bruce.springsteen Office 365 Users, bruce.springsteen Admins, bruce.springsteen All Users, steven.vanzandt Office 365 Users, steven.vanzandt All Users, patti.scialfa All Users, max.weinberg
File location:
Save the CSV file at:
C:\Windows\System32\
Step 4 – Execute the Bulk Group Addition Script
Run the following PowerShell command to import your CSV file and add each user to their respective group:
Import-CSV ./groupimport.csv | Add-JCUserGroupMember
Once executed, PowerShell will process each line and update group memberships accordingly.
Expected Result / Validation
After running the script:
- Users listed in the CSV file will be automatically added to their defined user groups in JumpCloud.
- You can verify the addition by checking User Groups → Members in the JumpCloud Admin Console.
FAQs
1. Can I use this for multiple groups at once?
Yes. Each line in the CSV defines a mapping between a user and their target group, allowing multiple group associations.
2. Does the CSV require case-sensitive entries?
No, JumpCloud PowerShell handles both upper and lowercase. However, maintaining consistency is recommended.
3. What if a user or group doesn’t exist?
The command will skip that entry. Ensure both usernames and group names are pre-created in JumpCloud.
4. Can this script be used for user removal instead?
Yes. You can replace the command with:
Import-CSV ./groupimport.csv | Remove-JCUserGroupMember
