
Untitled
By: a guest on
Jun 1st, 2012 | syntax:
None | size: 1.32 KB | hits: 13 | expires: Never
Comparing Strings in IronPython
#----------------------------------------------------------------------
# Search for a matching patch group, and approve them.
#----------------------------------------------------------------------
def WSUSApprove(apprvGrpName):
clr.AddReference('Microsoft.UpdateServices.Administration')
import Microsoft.UpdateServices.Administration
wsus = Microsoft.UpdateServices.Administration.AdminProxy.GetUpdateServer('wsus01',False,8530)
parentGroupCollection = wsus.GetComputerTargetGroups()
for computerTarget in parentGroupCollection:
if computerTarget.Name.ToString() == 'Servers':
parent = computerTarget
childGroupCollection = parent.GetChildTargetGroups()
for computerTarget in childGroupCollection:
print type(computerTarget.Name.ToString())
print type(apprvGrpName)
if apprvGrpName == computerTarget.Name.ToString():
print 'success', computerTarget.Name.ToString()
else:
print 'a', computerTarget.Name.ToString()
print 'b', apprvGrpName
#--output that should be equal--#
<type 'str'>
<type 'str'>
a 3 Tuesday
b 3 Tuesday
print repr(computerTarget.Name.ToString())
print repr(apprvGrpName)