Disclaimer
JUMPCLOUD EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS, AND LIABILITIES OF ANY KIND ARISING FROM OR RELATED TO THIRD-PARTY SOFTWARE, SCRIPTS, REPOSITORIES, AND APIS. JUMPCLOUD IS NOT REQUIRED TO SUPPORT ANY SUCH THIRD-PARTY MATERIALS AND ALL RISKS RELATED TO THIRD-PARTY MATERIALS ARE YOUR RESPONSIBILITY. PLEASE ALSO REVIEW THE JUMPCLOUD TOS.
Report on Users and its Associated Groups and Systems
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ11-10-2022 02:16 PM
This script creates a CSV report of user associations (Group and Systems)
How to use:
1. Install the JumpCloud Powershell Module
2. Save the contents of the script example to a file on a system.
- EX: ~/Report-Users_Bound_To_Groups.ps1
3. In a PowerShell terminal window run:
- ~/Report-Users_Bound_To_Groups.ps1
- Follow prompts to enter your API Key & OrgID
Script
# Get everyone from a group
$users = Get-JcSdkUser
# Initialize an empty list
$list = @()
# For each user
foreach ($user in $users)
{
$userDetails = Get-jcsdkUser -Id $user.id
# Get System Associations
$systemAssociations = Get-JcSdkUserTraverseSystem -UserId $user.Id
# Get Group Associations
$groupAssociations = Get-JcSdkUserMember -UserId $user.Id
# Clear variables
$foundSystem = ""
$foundGroup = ""
# For each system association
foreach ($systemAssociation in $systemAssociations)
{
$foundSystem += $systemAssociation.Id + ';'
}
# For each group association
foreach ($groupAssociation in $groupAssociations)
{
$foundGroup += $groupAssociation.Id + ';'
}
# populate the rows
$list += [PSCustomObject]@{
userID = $user.Id;
username = $userDetails.Username;
userState = $userDetails.State
associatedSystems = $foundSystem
associatedGroups = $foundGroup
}
}
# Write out the report
$list | ConvertTo-Csv | Out-File Report-UserToGroupAssociation.csv
Labels:
- Labels:
-
API
-
PowerShell
0 REPLIES 0
![](/skins/images/C210B62239BAF37B0AB0FAEB086BB5F1/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/C210B62239BAF37B0AB0FAEB086BB5F1/responsive_peak/images/icon_anonymous_message.png)