Read SharePoint lists to use with SCOM or SCORch

In most companies data is spread across different tools / software. SharePoint is one common software to store data. Without a central CMDB you perhaps also have data about servers, server owners, etc. stored in SharePoint. SCOM could use this data to update for example custom fields in alerts http://systemcentersolutions.wordpress.com/2010/06/01/updating-custom-fields-using-powershell/.
SCORch could process this data for example within an activity. The best way to do that is through PowerShell.

With SharePoint 2010 you have PowerShell cmdlets to grab this data easily. With SharePoint 2007 you can utilize the WebService. I want to focus on this solution.

Use the script from this blog: http://blogs.msdn.com/b/powershell/archive/2010/06/24/using-new-webserviceproxy-to-get-modify-and-add-items-to-a-list-in-sharepoint-2007.aspx.

If you only need some fields, then you can see the available fields by entering $list.data.row | get-member at the end of the script or if you already know which field you want to see, then you can use this format:
ows_fieldname.
If the fieldname contains spaces then replace them with _x0020_.

Example:

Fieldname: Management Pack
Powershell: ows_Management_x0020_Pack

So use it like this:

Foreach ($listitem in $list.data.row)
{
$line = $listitem.ows_title, $listitem.ows_Management_x0020_Pack
# this example writes a log file, but you can also use the data in another way
# => see the link to the blog to update custom fields.
out-file -FilePath c:\list.log -InputObject $line -Append
}

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: