cancel
Showing results for 
Search instead for 
Did you mean: 

So what if you have a large number of systems with different tags? (script included)

This python script looks for for a flat file HostTags.csv with the hostname,tag on each row. Then it prints this and tags the systems in ePO.

import csv, sys

import mcafee, getpass

epoadmin = raw_input('What is your ePO username?: ')

epopasswd = getpass.getpass(prompt='What is your ePO password?: ')

mc = mcafee.client('localhost','8443',epoadmin,epopasswd)

filename = 'HostTags.csv'

with open(filename, 'rb') as f:

    reader = csv.reader(f)

    try:

        for row in reader:

                         sysname = row[0]

                         epotag = row[1]

                         print 'Applying Tag',(epotag), 'to host',(sysname)

                         mc.system.applyTag(sysname,epotag)

    except csv.Error, e:

        sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))

Message was edited by: dschaff on 2/27/13 11:02:37 AM CST