Python script to pull Software Installed on a Device.

From SysAdminWiki

Jump to: navigation, search

Grab all the software installed on a given system

#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase

dmd = ZenScriptBase(connect=True).dmd

server = dmd.Devices.findDevice('some_machine')
if server:
   saveHere = open('/home/zenoss/some_machine_software.txt','wb')
   theContents = ''
   for each in server.os.software.objectValues():
      theContents = theContents + \
         each.getManufacturer().id + '\t' + \
         each.id + '\t' + \
         each.getInstallDate() + '\n'
   saveHere.write(theContents)
Advertisement