06-21-2022 09:09 AM
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
06-21-2022 10:04 AM
This is awesome! Great work Ryan, thanks for the awesomeness.
06-21-2022 01:54 PM
Thanks a lot, Ryan! Your patience and willingness to help and most especially, this script!
New to the site? Take a look at these additional resources:
Ready to join us? You can register here.