-
Notifications
You must be signed in to change notification settings - Fork 154
Companion Code Advanced User Import
- The JumpCloud PowerShell Module
- The Active Directory Module for Windows PowerShell
PS > Get-ADUser -Filter {department -ne "$null"} -Properties * | Select-Object department -Unique | ForEach-Object {New-JCUserGroup -GroupName $_.Department}
Creates a new JumpCloud User Group for each unique department value populated within the user 'department' field for all users within the Active Directory domain.
PS > Get-ADUser -Filter * -Properties * `
-SearchBase "OU=DenverOffice,OU=Employees,DC=Azzipa01,DC=local" | `
Select-Object @{name = 'FirstName'; expression = {$_.givenname}}, `
@{name = 'LastName'; expression = { $_.surname}}, `
@{name = 'UserName'; expression = {$_.samaccountname}}, `
@{name = 'Email'; expression = { $_.mail }}, `
@{name = 'StartDate'; expression = {$_.created}}, `
@{name = 'Department'; expression = {$_.department}} | `
Export-Csv 'DenverUserExport.CSV'
In this example users live the DenverOffice OU and the domain is 'Azzipa01.local".
This is a single line command that is spread across multiple lines using the PowerShell escape character the backtick " ` " for increased readability.
All users within the searchbase ""OU=DenverOffice,OU=Employees,DC=Azzipa01,DC=local"" are exported to the CSV file "DenverUserExport.csv".
PS > Get-ADUser -Filter * -Properties * `
-SearchBase "OU=BoulderOffice,OU=Employees,DC=Azzipa01,DC=local" | `
Select-Object @{name = 'FirstName'; expression = {$_.givenname}}, `
@{name = 'LastName'; expression = { $_.surname}}, `
@{name = 'UserName'; expression = {$_.samaccountname}}, `
@{name = 'Email'; expression = { $_.mail }}, `
@{name = 'Department'; expression = {$_.department}}, `
@{name = 'StartDate'; expression = {$_.created}} | `
Export-Csv 'BoulderUserExport.CSV'
In this example users live the BoulderOffice OU and the domain is 'Azzipa01.local".
This is a single line command that is spread across multiple lines using the PowerShell escape character the backtick " ` " for increased readability.
All users within the searchbase ""OU=BoulderOffice,OU=Employees,DC=Azzipa01,DC=local"" are exported to the CSV file "BoulderUserExport.csv".
Both the '-Filter' and '-SearchBase' fields can be used to determine which users you wish to export to a CSV file.
If you wish to export all active users within Active Directory and do not wish to export users from a specific OU use this command:
PS > Get-ADUser -Filter 'enabled -eq $true' -Properties * | `
Select-Object @{name = 'FirstName'; expression = {$_.givenname}}, `
@{name = 'LastName'; expression = { $_.surname}}, `
@{name = 'UserName'; expression = {$_.samaccountname}}, `
@{name = 'Email'; expression = { $_.mail }}, `
@{name = 'Department'; expression = {$_.department}}, `
@{name = 'StartDate'; expression = {$_.created}} | `
Export-Csv 'AllEnabledUsers.CSV'
Please reference this link for additional documentation and examples for the Get-ADUser command.
Examples that show how to set the 'searchbase' for Get-ADUser can be found at the bottom of the linked page above.
After exporting your users to a CSV file it is always best practice to groom the data in this .CSV and clean up any stale or incorrect information before importing new users into JumpCloud.
- Wiki Home
- Installing the JumpCloud PowerShell module
- Using the JumpCloud PowerShell Module
- Using the JumpCloud PowerShell Module with AWS Lambda
- PowerShell Commands Example Library
- JumpCloud Commands Gallery
- JumpCloud PowerShell YouTube Channel
- The JumpCloud Dashboard PowerShell Module
Authentication
Import and Backup
- Get JCAssociation
- New JCImportTemplate
- Import JCUsersFromCSV
- Update JCUsersFromCSV
- Get JCBackup
- Send JCPasswordReset
- Backup JCOrganization
RADIUS Reply Attributes
- Add JCRadiusReplyAttribute
- Get JCRadiusReplyAttribute
- Update JCUsersFromCSV
- Set JCRadiusReplyAttribute
- Remove JCRadiusReplyAttribute
User Functions
Administrator Functions
System Functions
- Get JCSystem
- Get JCSystemApp
- Get JCSystemKB
- Set JCSystem
- Remove JCSystem
- Get JCSystemUser
- Set JCSystemUser
- Add JCSystemUser
- Remove JCSystemUser
Command Functions
- New JCCommand
- Get JCCommand
- Import JCCommand
- Remove JCCommand
- Set JCCommand
- Invoke JCCommand
- New JCDeploymentTemplate
- Invoke JCDeployment
- Get JCCommandResult
- Remove JCCommandResult
- Get JCCommandTarget
- Add JCCommandTarget
- Remove JCCommandTarget
Group Functions
- Get JCGroup
- New JCUserGroup
- Remove JCUserGroup
- Get JCUserGroupMember
- Add JCUserGroupMember
- Remove JCUserGroupMember
- New JCSystemGroup
- Remove JCSystemGroup
- Get JCSystemGroupMember
- Add JCSystemGroupMember
- Remove JCSystemGroupMember
- Set-JCUserGroupLDAP
Policy Functions
- Get JCPolicy
- Get JCPolicyResult
- Get JCPolicyTargetSystem
- Get JCPolicyTargetGroup
- New JCPolicy
- Set JCPolicy
Event Functions