cancel
Showing results for 
Search instead for 
Did you mean: 

List Local & Managed User Accounts in Your Fleet

RyanBailey
Novitiate III

Hey folks!

Few threads have popped up recently in the JumpCloud Slack asking if there is any method to pull all user accounts from your fleet for compliance reasons. If you have System Insights, the code below should do the trick! This is a quick code snippet, no error handling etc... Always looking for feedback, let me know if you'd tackle this from a different angle!

 

$systems = Get-JCSystem
$usersBySystem = Get-JCSystem | ForEach-Object {Get-JcSdkSystemInsightUser -Filter "system_id:eq:$($_._id)"} | Select-Object -Property @{
    Name = "Hostname"; Expression = {
        $sysId = $_.SystemId
        $systems | Where-Object { $_._id -eq $sysId } | Select-Object -ExpandProperty hostname
    }}, AdManaged, Admin, Description, Directory, Gid, GidSigned, LastLogin, Managed, RealUser, Shell, Suspended, SystemId, Type, Uid, UidSigned, Username, Uuid
    
$usersBySystem | Export-Csv -Path .\SystemUsers.csv -Force -NoClobber

 

2 REPLIES 2

BenGarrison
JumpCloud Alumni
JumpCloud Alumni

This is awesome! Great work Ryan, thanks for the awesomeness.
BenGarrison_0-1655820262459.gif

tekrondo
Novitiate II

Thanks a lot, Ryan! Your patience and willingness to help and most especially, this script!

You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.