Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: None  |  size: 1.32 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Comparing Strings in IronPython
  2. #----------------------------------------------------------------------
  3.  # Search for a matching patch group, and approve them.
  4.  #----------------------------------------------------------------------
  5.  def WSUSApprove(apprvGrpName):
  6.      clr.AddReference('Microsoft.UpdateServices.Administration')
  7.      import Microsoft.UpdateServices.Administration
  8.  
  9.      wsus = Microsoft.UpdateServices.Administration.AdminProxy.GetUpdateServer('wsus01',False,8530)
  10.  
  11.      parentGroupCollection = wsus.GetComputerTargetGroups()
  12.      for computerTarget in parentGroupCollection:
  13.          if computerTarget.Name.ToString() == 'Servers':
  14.              parent = computerTarget
  15.              childGroupCollection = parent.GetChildTargetGroups()
  16.              for computerTarget in childGroupCollection:
  17.                  print type(computerTarget.Name.ToString())
  18.                  print type(apprvGrpName)
  19.                  if apprvGrpName == computerTarget.Name.ToString():
  20.                      print 'success', computerTarget.Name.ToString()
  21.                  else:
  22.                      print 'a', computerTarget.Name.ToString()
  23.                      print 'b', apprvGrpName
  24.  
  25. #--output that should be equal--#
  26.  
  27.  <type 'str'>
  28.  <type 'str'>
  29.  a 3 Tuesday
  30.  b 3 Tuesday
  31.        
  32. print repr(computerTarget.Name.ToString())
  33. print repr(apprvGrpName)