Skip to content

Instantly share code, notes, and snippets.

@fuzzylogiq
Created July 25, 2017 23:41
Show Gist options
  • Select an option

  • Save fuzzylogiq/15818ac813fa9ac53b8b561d33d7636d to your computer and use it in GitHub Desktop.

Select an option

Save fuzzylogiq/15818ac813fa9ac53b8b561d33d7636d to your computer and use it in GitHub Desktop.
sites = j.Site()
computers = j.Computer()
computers2 = computers.retrieve_all(subset='general')
mobiledevices = j.MobileDevice()
mobiledevices2 = mobiledevices.retrieve_all(subset='general')
computer_sites = [ computer.find('general/site/id').text for computer in computers2 if computer.find('general/remote_management/managed').text == 'true' ]
mobile_sites = [ mobile.find('general/site/id').text for mobile in mobiledevices2 if mobile.find('general/managed').text == 'true' ]
for site in sites:
print "%s:\n Computers: %s\n Mobile Devices: %s" % (site.name, computer_sites.count(str(site.id)), mobile_sites.count(str(site.id)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment