April 2008 - Posts

I did not do an extensive search to see if this had already been done, so I just slapped this together from what someone else did and added what I needed to it. Check out Jonathan Almquist's blog at http://blogs.technet.com/jonathanalmquist/default.aspx , the script I borrowed from him is documented in the script.

My modification gets the UTC date and time from one day ago,  and closes any alerts whose TimeLastModified is older than that date and time.

 '==========================================================================
' NAME: Scott Moss
' DATE  : 4/20/08
' http://myitforum.com/cs2/blogs/smoss/default.aspx
' I modified an existing script MOM 2005 - Close all alerts rasied before
' (date) Original code from the web page below,
' http://blogs.technet.com/jonathanalmquist/archive/2008/04/02/mom-2005-close-all-alerts-raised-before-date.aspx
' The modification I made is to get the UTC from the date and time one day ago,
' and close all open alerts whose TimeLastModified property is older than that
' time and date. Change Now-1 to Now-2 for two days ago etc.
'==========================================================================

Set dUTC = CreateObject("WbemScripting.SWbemDateTime")
dUTC.SetVarDate Now-1, True
dtUTC = Left(dUTC,14)


Set objWMI = GetObject("winmgmts://./root/MOM")
strQuery = "select * from MSFT_Alert where ResolutionState <> 255"
Set colAlerts = objWMI.ExecQuery(strQuery)
For Each objAlert In colAlerts
   If Len(Trim(objAlert.AlertHistoryComment)) = 0 Then objAlert.AlertHistoryComment = Null
   If Len(Trim(objAlert.CustomField1)) = 0 Then objAlert.CustomField1 = Null
   If Len(Trim(objAlert.CustomField2)) = 0 Then objAlert.CustomField2 = Null
   If Len(Trim(objAlert.CustomField3)) = 0 Then objAlert.CustomField3 = Null
   If Len(Trim(objAlert.CustomField4)) = 0 Then objAlert.CustomField4 = Null
   If Len(Trim(objAlert.CustomField5)) = 0 Then objAlert.CustomField5 = Null
   If Len(Trim(objAlert.Description)) = 0 Then objAlert.Description = Null
   If Len(Trim(objAlert.OwnerName)) = 0 Then objAlert.OwnerName = Null
   If Len(Trim(objAlert.ResolvedBy)) = 0 Then objAlert.ResolvedBy = Null
   If Len(Trim(objAlert.TimeResolved)) = 0 Then objAlert.TimeResolved = Null
   If ObjAlert.TimeLastModified <= dtUTC Then
      objAlert.ResolutionState = 255
      objAlert.Put_
   End If
Next

Posted by smoss | with no comments
Filed under: ,


http://www.microsoft.com/technet/prodtechnol/scp/opsmgr07.aspx

Posted by smoss | with no comments

For waiting list details see:

http://myitforum.com/cs2/blogs/rtrent/archive/2008/04/14/mms-2008-sold-out.aspx  

For more details on charity raffle see:

http://myitforum.com/cs2/blogs/myitforum/archive/2008/04/15/mms-2008-registration-is-closed-but-there-s-still-a-chance-to-attend-thanks-to-our-good-friends-at-securevantage.aspx

 

Posted by smoss | 1 comment(s)
Filed under:

Well someone finally asked for this so I'm sharing. Stick out tongue

Enjoy!

-- Scott Moss
-- 04-11-2008
-- mom 2005 query to enumerate managed windows server cluster computers
-- that belong to a specific computer group

select [Name] from Computer
WHERE  [type]= 67108864 and [ManagedType] = 3 and [DesiredManagedType]= 3

AND [Name] in (SELECT [ComputerName]
FROM [OnePoint].[dbo].[SDKComputerToComputerGroupView]
WHERE ComputerGroupName = 'Your Computer Group Name Here')
order by [Name]

Posted by smoss | 1 comment(s)
Filed under: ,