Wednesday, November 2, 2011

Adding many instances of a class to SCOM group using excel

I was tasked with populating a rather large group today (> 256 instances) with instances of a specific class.  Fortunately I had a list of the objects in excel format and regular expressions are accepted within SCOM.

I used a handy little Excel macro to concantenate an entire column into one cell and add a pipe character (|) in between all the values.

So, should you ever need to accomplish this task here is the VB macro for Excel!


Function custom1(rng As Range, Optional delim As String = " ") 
    Dim myAdd As String 
    myAdd = rng.Address 
    vishal = Join(Evaluate("transpose(" & myAdd & ")"),delim) 
End Function 
You can then call it from the cell

=custom1(A1:A20,"|")

No comments:

Post a Comment