<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Maartendamen&#039;s blog &#187; microsoft</title>
	<atom:link href="http://www.maartendamen.com/tag/microsoft/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maartendamen.com</link>
	<description>Blogging on various IT subjects</description>
	<lastBuildDate>Tue, 22 Nov 2011 21:27:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Exchange Custom Attribute editor with GUI, written in Powershell</title>
		<link>http://www.maartendamen.com/2011/03/exchange-custom-attribute-editor-gui-written-in-powershell/</link>
		<comments>http://www.maartendamen.com/2011/03/exchange-custom-attribute-editor-gui-written-in-powershell/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 13:13:24 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[custom attributes]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=624</guid>
		<description><![CDATA[Microsoft Exchange extends the default Active Directory schema with some additional attributes, also known as custom attributes. These extra free fields are very handy, we use them for example for third party applications,employee identification numbers etc. Recently we migrated to Exchange 2010, nice but the Exchange Management console 2010 is not supported on 32bit versions [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Exchange extends the default Active Directory schema with some additional attributes, also known as custom attributes.<br />
These extra free fields are very handy, we use them for example for third party applications,employee identification numbers etc.<br />
Recently we migrated to Exchange 2010, nice but the Exchange Management console 2010 is not supported on 32bit versions of Windows (we still use Windows XP 32bit). The only way to edit the custom attributes is through the Microsoft Exchange Management Console.<br />
So I had two options, either give support personnel access to the one of the Exchange servers or create some script to do it. I chose the latter.<br />
This Powershell script (with a nice GUI) allows you to edit custom attributes from any workstation (either Windows XP, Windows Vista or Windows 7 32bit or whatever runs Powershell :-) )<br />
Here&#8217;s an impression of the script&#8217;s GUI:</p>
<p><span id="more-624"></span></p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2011/03/exchange_custom.png"><img src="http://www.maartendamen.com/wp-content/uploads/2011/03/exchange_custom.png" alt="" title="exchange_custom" width="613" height="495" class="alignnone size-full wp-image-652" /></a></p>
<p>And here is the (very long) Powershell code:</p>
<pre class="brush: powershell; title: ; notranslate">
######################################################################
# Exchange Custom attribute editor 1.0
# Author: Maarten Damen
######################################################################

# Script configuration
$ldapstring = &quot;ou=Users, dc=TEST, dc=NL&quot; # LDAP string, pointing to the OU with users in it.
$username   = &quot;accountmanagement&quot; # Username with sufficient rights to edit custom attributes of users.
$password   = &quot;123456&quot; # Password of that particular user.

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {

	#----------------------------------------------
	#region Import Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load(&quot;System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	[void][reflection.assembly]::Load(&quot;System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot;)
	[void][reflection.assembly]::Load(&quot;mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	[void][reflection.assembly]::Load(&quot;System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot;)
	#endregion

	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object System.Windows.Forms.Form
	$btnSave = New-Object System.Windows.Forms.Button
	$label16 = New-Object System.Windows.Forms.Label
	$label15 = New-Object System.Windows.Forms.Label
	$label14 = New-Object System.Windows.Forms.Label
	$label13 = New-Object System.Windows.Forms.Label
	$label12 = New-Object System.Windows.Forms.Label
	$label11 = New-Object System.Windows.Forms.Label
	$label10 = New-Object System.Windows.Forms.Label
	$label9 = New-Object System.Windows.Forms.Label
	$label8 = New-Object System.Windows.Forms.Label
	$label7 = New-Object System.Windows.Forms.Label
	$label6 = New-Object System.Windows.Forms.Label
	$label5 = New-Object System.Windows.Forms.Label
	$label4 = New-Object System.Windows.Forms.Label
	$label3 = New-Object System.Windows.Forms.Label
	$custom15 = New-Object System.Windows.Forms.TextBox
	$custom14 = New-Object System.Windows.Forms.TextBox
	$custom13 = New-Object System.Windows.Forms.TextBox
	$custom12 = New-Object System.Windows.Forms.TextBox
	$custom11 = New-Object System.Windows.Forms.TextBox
	$custom10 = New-Object System.Windows.Forms.TextBox
	$custom9 = New-Object System.Windows.Forms.TextBox
	$custom8 = New-Object System.Windows.Forms.TextBox
	$custom7 = New-Object System.Windows.Forms.TextBox
	$custom6 = New-Object System.Windows.Forms.TextBox
	$custom5 = New-Object System.Windows.Forms.TextBox
	$custom4 = New-Object System.Windows.Forms.TextBox
	$custom3 = New-Object System.Windows.Forms.TextBox
	$custom2 = New-Object System.Windows.Forms.TextBox
	$custom1 = New-Object System.Windows.Forms.TextBox
	$label2 = New-Object System.Windows.Forms.Label
	$listbox1 = New-Object System.Windows.Forms.ListBox
	$label1 = New-Object System.Windows.Forms.Label
	$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState

	$FormEvent_Load={
			$root = New-Object System.DirectoryServices.DirectoryEntry &quot;LDAP://$ldapstring&quot;, $username, $password
			$searcher = New-Object DirectoryServices.DirectorySearcher
			$searcher.SearchRoot = $root
			$searcher.Filter = &quot;(objectClass=user)&quot;
			$results=$searcher.FindAll()

			foreach ($result in $results) {
				$listbox1.Items.Add($result.GetDirectoryEntry().cn.Value)
			}
	}

	$handler_listbox1_SelectedIndexChanged={
		# get current custom attributes for user
		$entry = New-Object System.DirectoryServices.DirectoryEntry (&quot;LDAP://CN={0}, $ldapstring&quot; -f $listbox1.Text), $username, $password

		for ($i = 1; $i -lt 16; $i++) {
			$textbox = Get-Variable &quot;custom$i&quot;
			$propertyvalue = &quot;extensionAttribute$i&quot;
			$textbox.Value.Text = $entry.$propertyvalue.Value
		}
	}

	$handler_btnSave_Click={
		# Save changes in AD
		$entry = New-Object System.DirectoryServices.DirectoryEntry (&quot;LDAP://CN={0}, $ldapstring&quot; -f $listbox1.Text), $username, $password

		for ($i = 1; $i -lt 16; $i++) {
			$textbox = Get-Variable &quot;custom$i&quot;
			if ($textbox.Value.Text -ne &quot;&quot;) {
				$entry.Put(&quot;extensionAttribute$i&quot;, &quot;{0}&quot; -f $textbox.Value.Text)
			} else {
				$entry.PutEx(1, &quot;extensionAttribute$i&quot;, $null)
			}
		}

		$entry.SetInfo()
	}

	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# form1
	#
	$form1.Controls.Add($btnSave)
	$form1.Controls.Add($label16)
	$form1.Controls.Add($label15)
	$form1.Controls.Add($label14)
	$form1.Controls.Add($label13)
	$form1.Controls.Add($label12)
	$form1.Controls.Add($label11)
	$form1.Controls.Add($label10)
	$form1.Controls.Add($label9)
	$form1.Controls.Add($label8)
	$form1.Controls.Add($label7)
	$form1.Controls.Add($label6)
	$form1.Controls.Add($label5)
	$form1.Controls.Add($label4)
	$form1.Controls.Add($label3)
	$form1.Controls.Add($custom15)
	$form1.Controls.Add($custom14)
	$form1.Controls.Add($custom13)
	$form1.Controls.Add($custom12)
	$form1.Controls.Add($custom11)
	$form1.Controls.Add($custom10)
	$form1.Controls.Add($custom9)
	$form1.Controls.Add($custom8)
	$form1.Controls.Add($custom7)
	$form1.Controls.Add($custom6)
	$form1.Controls.Add($custom5)
	$form1.Controls.Add($custom4)
	$form1.Controls.Add($custom3)
	$form1.Controls.Add($custom2)
	$form1.Controls.Add($custom1)
	$form1.Controls.Add($label2)
	$form1.Controls.Add($listbox1)
	$form1.Controls.Add($label1)
	$form1.Text = &quot;Exchange custom attribute editor v1.0 © Maarten Damen&quot;
	$form1.Name = &quot;form1&quot;
	$form1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$form1.ClientSize = New-Object System.Drawing.Size(606,461)
	$form1.add_Load($FormEvent_Load)
	#
	# btnSave
	#
	$btnSave.TabIndex = 32
	$btnSave.Name = &quot;btnSave&quot;
	$btnSave.Size = New-Object System.Drawing.Size(120,23)
	$btnSave.UseVisualStyleBackColor = $True
	$btnSave.Text = &quot;Save changes&quot;
	$btnSave.Location = New-Object System.Drawing.Point(474,426)
	$btnSave.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$btnSave.add_Click($handler_btnSave_Click)
	#
	# label16
	#
	$label16.TabIndex = 31
	$label16.Size = New-Object System.Drawing.Size(115,19)
	$label16.Text = &quot;Custom Attribute 15&quot;
	$label16.Location = New-Object System.Drawing.Point(173,396)
	$label16.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label16.Name = &quot;label16&quot;
	#
	# label15
	#
	$label15.TabIndex = 30
	$label15.Size = New-Object System.Drawing.Size(115,19)
	$label15.Text = &quot;Custom Attribute 14&quot;
	$label15.Location = New-Object System.Drawing.Point(173,370)
	$label15.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label15.Name = &quot;label15&quot;
	#
	# label14
	#
	$label14.TabIndex = 29
	$label14.Size = New-Object System.Drawing.Size(115,19)
	$label14.Text = &quot;Custom Attribute 13&quot;
	$label14.Location = New-Object System.Drawing.Point(173,344)
	$label14.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label14.Name = &quot;label14&quot;
	#
	# label13
	#
	$label13.TabIndex = 28
	$label13.Size = New-Object System.Drawing.Size(115,19)
	$label13.Text = &quot;Custom Attribute 12&quot;
	$label13.Location = New-Object System.Drawing.Point(173,318)
	$label13.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label13.Name = &quot;label13&quot;
	#
	# label12
	#
	$label12.TabIndex = 27
	$label12.Size = New-Object System.Drawing.Size(115,19)
	$label12.Text = &quot;Custom Attribute 11&quot;
	$label12.Location = New-Object System.Drawing.Point(173,292)
	$label12.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label12.Name = &quot;label12&quot;
	#
	# label11
	#
	$label11.TabIndex = 26
	$label11.Size = New-Object System.Drawing.Size(115,19)
	$label11.Text = &quot;Custom Attribute 10&quot;
	$label11.Location = New-Object System.Drawing.Point(173,266)
	$label11.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label11.Name = &quot;label11&quot;
	#
	# label10
	#
	$label10.TabIndex = 25
	$label10.Size = New-Object System.Drawing.Size(115,19)
	$label10.Text = &quot;Custom Attribute 9&quot;
	$label10.Location = New-Object System.Drawing.Point(173,240)
	$label10.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label10.Name = &quot;label10&quot;
	#
	# label9
	#
	$label9.TabIndex = 24
	$label9.Size = New-Object System.Drawing.Size(115,19)
	$label9.Text = &quot;Custom Attribute 8&quot;
	$label9.Location = New-Object System.Drawing.Point(173,214)
	$label9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label9.Name = &quot;label9&quot;
	#
	# label8
	#
	$label8.TabIndex = 23
	$label8.Size = New-Object System.Drawing.Size(115,19)
	$label8.Text = &quot;Custom Attribute 7&quot;
	$label8.Location = New-Object System.Drawing.Point(173,188)
	$label8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label8.Name = &quot;label8&quot;
	#
	# label7
	#
	$label7.TabIndex = 22
	$label7.Size = New-Object System.Drawing.Size(115,19)
	$label7.Text = &quot;Custom Attribute 6&quot;
	$label7.Location = New-Object System.Drawing.Point(173,162)
	$label7.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label7.Name = &quot;label7&quot;
	#
	# label6
	#
	$label6.TabIndex = 21
	$label6.Size = New-Object System.Drawing.Size(115,19)
	$label6.Text = &quot;Custom Attribute 5&quot;
	$label6.Location = New-Object System.Drawing.Point(173,136)
	$label6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label6.Name = &quot;label6&quot;
	#
	# label5
	#
	$label5.TabIndex = 20
	$label5.Size = New-Object System.Drawing.Size(115,19)
	$label5.Text = &quot;Custom Attribute 4&quot;
	$label5.Location = New-Object System.Drawing.Point(173,110)
	$label5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label5.Name = &quot;label5&quot;
	#
	# label4
	#
	$label4.TabIndex = 19
	$label4.Size = New-Object System.Drawing.Size(115,19)
	$label4.Text = &quot;Custom Attribute 3&quot;
	$label4.Location = New-Object System.Drawing.Point(173,84)
	$label4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label4.Name = &quot;label4&quot;
	#
	# label3
	#
	$label3.TabIndex = 18
	$label3.Size = New-Object System.Drawing.Size(115,19)
	$label3.Text = &quot;Custom Attribute 2&quot;
	$label3.Location = New-Object System.Drawing.Point(173,58)
	$label3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label3.Name = &quot;label3&quot;
	#
	# custom15
	#
	$custom15.Size = New-Object System.Drawing.Size(300,20)
	$custom15.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom15.Name = &quot;custom15&quot;
	$custom15.Location = New-Object System.Drawing.Point(294,393)
	$custom15.TabIndex = 17
	#
	# custom14
	#
	$custom14.Size = New-Object System.Drawing.Size(300,20)
	$custom14.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom14.Name = &quot;custom14&quot;
	$custom14.Location = New-Object System.Drawing.Point(294,367)
	$custom14.TabIndex = 16
	#
	# custom13
	#
	$custom13.Size = New-Object System.Drawing.Size(300,20)
	$custom13.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom13.Name = &quot;custom13&quot;
	$custom13.Location = New-Object System.Drawing.Point(294,341)
	$custom13.TabIndex = 15
	#
	# custom12
	#
	$custom12.Size = New-Object System.Drawing.Size(300,20)
	$custom12.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom12.Name = &quot;custom12&quot;
	$custom12.Location = New-Object System.Drawing.Point(294,315)
	$custom12.TabIndex = 14
	#
	# custom11
	#
	$custom11.Size = New-Object System.Drawing.Size(300,20)
	$custom11.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom11.Name = &quot;custom11&quot;
	$custom11.Location = New-Object System.Drawing.Point(294,289)
	$custom11.TabIndex = 13
	#
	# custom10
	#
	$custom10.Size = New-Object System.Drawing.Size(300,20)
	$custom10.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom10.Name = &quot;custom10&quot;
	$custom10.Location = New-Object System.Drawing.Point(294,263)
	$custom10.TabIndex = 12
	#
	# custom9
	#
	$custom9.Size = New-Object System.Drawing.Size(300,20)
	$custom9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom9.Name = &quot;custom9&quot;
	$custom9.Location = New-Object System.Drawing.Point(294,237)
	$custom9.TabIndex = 11
	#
	# custom8
	#
	$custom8.Size = New-Object System.Drawing.Size(300,20)
	$custom8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom8.Name = &quot;custom8&quot;
	$custom8.Location = New-Object System.Drawing.Point(294,211)
	$custom8.TabIndex = 10
	#
	# custom7
	#
	$custom7.Size = New-Object System.Drawing.Size(300,20)
	$custom7.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom7.Name = &quot;custom7&quot;
	$custom7.Location = New-Object System.Drawing.Point(294,185)
	$custom7.TabIndex = 9
	#
	# custom6
	#
	$custom6.Size = New-Object System.Drawing.Size(300,20)
	$custom6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom6.Name = &quot;custom6&quot;
	$custom6.Location = New-Object System.Drawing.Point(294,159)
	$custom6.TabIndex = 8
	#
	# custom5
	#
	$custom5.Size = New-Object System.Drawing.Size(300,20)
	$custom5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom5.Name = &quot;custom5&quot;
	$custom5.Location = New-Object System.Drawing.Point(294,133)
	$custom5.TabIndex = 7
	#
	# custom4
	#
	$custom4.Size = New-Object System.Drawing.Size(300,20)
	$custom4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom4.Name = &quot;custom4&quot;
	$custom4.Location = New-Object System.Drawing.Point(294,107)
	$custom4.TabIndex = 6
	#
	# custom3
	#
	$custom3.Size = New-Object System.Drawing.Size(300,20)
	$custom3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom3.Name = &quot;custom3&quot;
	$custom3.Location = New-Object System.Drawing.Point(294,81)
	$custom3.TabIndex = 5
	#
	# custom2
	#
	$custom2.Size = New-Object System.Drawing.Size(300,20)
	$custom2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom2.Name = &quot;custom2&quot;
	$custom2.Location = New-Object System.Drawing.Point(294,55)
	$custom2.TabIndex = 4
	#
	# custom1
	#
	$custom1.Size = New-Object System.Drawing.Size(300,20)
	$custom1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$custom1.Name = &quot;custom1&quot;
	$custom1.Location = New-Object System.Drawing.Point(294,29)
	$custom1.TabIndex = 3
	#
	# label2
	#
	$label2.TabIndex = 2
	$label2.Size = New-Object System.Drawing.Size(100,19)
	$label2.Text = &quot;Custom Attribute 1&quot;
	$label2.Location = New-Object System.Drawing.Point(173,32)
	$label2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label2.Name = &quot;label2&quot;
	#
	# listbox1
	#
	$listbox1.FormattingEnabled = $True
	$listbox1.Size = New-Object System.Drawing.Size(155,420)
	$listbox1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$listbox1.Name = &quot;listbox1&quot;
	$listbox1.Location = New-Object System.Drawing.Point(12,29)
	$listbox1.Sorted = $True
	$listbox1.TabIndex = 0
	$listbox1.add_SelectedIndexChanged($handler_listbox1_SelectedIndexChanged)
	#
	# label1
	#
	$label1.TabIndex = 1
	$label1.Size = New-Object System.Drawing.Size(174,23)
	$label1.Text = &quot;Please select a user:&quot;
	$label1.Location = New-Object System.Drawing.Point(12,9)
	$label1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label1.Name = &quot;label1&quot;
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Show the Form
	return $form1.ShowDialog()

} #End Function

#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
	#Create the form
	GenerateForm | Out-Null
	#Perform cleanup
	OnApplicationExit
}
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2011/03/exchange-custom-attribute-editor-gui-written-in-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Monitor an Oracle database with a SCOM OleDB watcher</title>
		<link>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/</link>
		<comments>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 20:37:13 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCOM]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=364</guid>
		<description><![CDATA[In this blog post I will explain how to use an System Center Operations Manager OleDB watcher to monitor an Oracle database. This can be useful to monitor a mission critical application on database availability. It&#8217;s also a cheap solution to just monitor the connection state of an Oracle database, rather then installing an (expensive) [...]]]></description>
			<content:encoded><![CDATA[<p>In this blog post I will explain how to use an System Center Operations Manager OleDB watcher to monitor an Oracle database.<br />
This can be useful to monitor a mission critical application on database availability. It&#8217;s also a cheap solution to just monitor the connection state of an Oracle database, rather then installing an (expensive) third party Oracle management pack. Off course these packs have a lot more monitors then the connection state, but that might not always be an requirement.<br />
To get this done, the following steps must be taken:<br />
<span id="more-364"></span></p>
<ul>
<li>Install Oracle client OleDB provider on the watcher node</li>
<li>Test the Oracle client OleDB provider, and connection to the database</li>
<li>Add OleDB monitoring in SCOM</li>
<li>Add associated runas user profiles</li>
</ul>
<p><strong>Installing the Oracle client OleDB provider on the watcher node</strong></p>
<p>The watcher node can be any machine containing the SCOM agent.<br />
It&#8217;s important to have the right Oracle client version (I used version 11), for 32bit versions use the 32bit Oracle client. For 64bit use the 64bit Oracle client version. Both are available on the Oracle website. If you don&#8217;t use the correct version (e.g. 32bit on 64bit) you might get &#8220;Class unknown&#8221; errors within SCOM.<br />
Start the Oracle installation, on the first step in the installation wizard choose &#8220;Custom&#8221; and click &#8220;Next&#8221;</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb1-300x225.png" alt="" title="oracle_oledb1" width="300" height="225" class="alignnone size-medium wp-image-365" /></a></p>
<p>On the next page select your favorite language(s), then pick a location for the Oracle client (beware it&#8217;s huge, even for one component)<br />
In the &#8220;Available Product Components&#8221; step select the following component (Oracle Provider for OLEDB: </p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb2-300x225.png" alt="" title="oracle_oledb2" width="300" height="225" class="alignnone size-medium wp-image-366" /></a></p>
<p>Finish the installation.</p>
<p><em>Note:you also need to setup Oracle&#8217;s tnsnames file, this is beyond the scope of this article. Consult your Oracle DBA.</em></p>
<p><strong>Test the Oracle client OleDB provider, and connection to the database</strong></p>
<p>To test a OleDB connection, you can use a UDL file. This is a connection file, which launches a wizard once you click it.<br />
Use the following steps to create an UDL file:</p>
<p>1. Make sure in Windows Explorer, Tools->Folder Options, View Tab, that “Hide file extensions for known file types” is not checked.<br />
2. Right click on Windows desktop, and select New->Text File.<br />
3. Name the file “Test.udl”. The icon for the file should now be the special “UDL” icon.<br />
4. Double click the file to open the Data Links dialog.<br />
5. Click on the “Provider” tab. Select “Oracle Provider for OLE DB”.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb3.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb3.png" alt="" title="oracle_oledb3" width="368" height="461" class="alignnone size-full wp-image-367" /></a></p>
<p>6. Click on the “Connection” tab. In the first dialog box (server name) type the oracle service ID (the name defined in the tnsnames file)<br />
7. Specify the credentials (username and password) in the same dialog box.<br />
8. Click &#8220;Test Connection&#8221;, you should now see this embracing message :-)</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb4.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb4.png" alt="" title="oracle_oledb4" width="232" height="144" class="alignnone size-full wp-image-369" /></a></p>
<p><strong>Add OleDB monitoring in SCOM</strong></p>
<p>The next step is to add monitoring to SCOM. Start the SCOM operations manager console and click on &#8220;Authoring&#8221;.<br />
Within this view, click on &#8220;Add Monitoring Wizard&#8221; on the left hand side.<br />
To add an OleDB watcher, use the following steps:</p>
<p>1. In the &#8220;Select Monitoring Type&#8221; step select &#8220;OLE DB Data Source&#8221;, click &#8220;Next&#8221;<br />
2. Within the general properties step specify a name for the monitor and choose a Management Pack for your custom monitoring (Microsoft recommends not to use the default management pack here, so create a new one!)<br />
3. In the Connection String dialog click on the &#8220;Build&#8230;&#8221; button. Choose any random Provider (we will change the connection string later on) enter a random computer name and database as well. Make sure you check: &#8220;Use Simple Authentication RunAs Profile created for this OLE DB data source transaction&#8221;, this is important.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb5.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb5-300x157.png" alt="" title="oracle_oledb5" width="300" height="157" class="alignnone size-medium wp-image-383" /></a></p>
<p>4. Enter Query performance thresholds, if this is required.<br />
5. Within the &#8220;Watcher Nodes&#8221; step, select the machine on which we installed the Oracle client.<br />
6. Finish the wizard.</p>
<p>You should now end up with an OleDB Data Source within SCOM.<br />
Open the data source and navigate to the &#8220;Connection String&#8221; tab.<br />
Change the connection string in to the following format:</p>
<p><code>Provider=OraOLEDB.Oracle;Data Source=TEST;User Id=$RunAs[Name="OleDbCheck_b7035c5b5d6149b684df79089e99dc07.SimpleAuthenticationAccount"]/UserName$;Password=$RunAs[Name="OleDbCheck_b7035c5b5d6149b684df79089e99dc07.SimpleAuthenticationAccount"]/Password$</code></p>
<p>Replace the RunAs variables with the ones generated by the wizard. The data source is the Oracle SID, the same you used to test before. The provider name is the short (internal) name for the Oracle Provider for OLEDB.<br />
Save the OLEDB Data Source.</p>
<p><strong>Add associated runas user profiles</strong></p>
<p>If you checked the &#8220;Use Simple Authentication RunAs Profile created for this OLE DB data source transaction&#8221; during the wizard you should end up with a preset RunAs profile for this monitor. You can find it under Administration->Run As Configuration->Profiles in the operations manager console. </p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb6.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb6.png" alt="" title="oracle_oledb6" width="307" height="149" class="alignnone size-full wp-image-390" /></a></p>
<p>Double click this &#8220;simple authentication&#8221; RunAs profile.</p>
<p>To add a &#8220;Run As Account&#8221; follow the following steps:</p>
<p>1. In the &#8220;Run As Profile Wizard&#8221; click the &#8220;Run As Accounts&#8221; tab.<br />
2. Click on the &#8220;Add&#8230;&#8221; button to add an account.<br />
3. Click on &#8220;New&#8230;&#8221;, the &#8220;Create Run As Account Wizard&#8221; should now start. Skip the introduction.<br />
4. On the general properties page, select the run as account type. Set this to Simple Authentication and specify a display name.</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb7.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/09/oracle_oledb7.png" alt="" title="oracle_oledb7" width="679" height="605" class="alignnone size-full wp-image-391" /></a></p>
<p>5. On the credentials tab specify the account name and password.<br />
6. Select a distribution security option, based on your preference. I used the More Secure option (you need to reopen the account under the accounts pane to distribute it to your watcher node)<br />
7. Finish the &#8220;Create Run As Account Wizard&#8221;<br />
8. Click &#8220;OK&#8221; and finish the &#8220;Run As Profile Wizard&#8221;</p>
<p>You have now configured the Run As profile.<br />
To see the result of all this work, open the &#8220;OLE DB Data Source State&#8221; view within the monitoring pane. This is located underneath the &#8220;Synthetic Transaction&#8221; folder.<br />
This could take a while! (It took about 15 minutes in my environment)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/09/monitor-an-oracle-database-with-a-scom-oledb-watcher/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mass creation of HP WSEM WiFi guest accounts using SSH and PowerShell</title>
		<link>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/</link>
		<comments>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 13:58:51 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[hp]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[wsem]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=348</guid>
		<description><![CDATA[I was asked to create 365 (1 year) of WiFi (daily) guest access accounts, and export them to CSV. Of course I didn&#8217;t want to create them by hand.. this is where PowerShell came in. I used the following PowerShell script to create random WiFi guest accounts: Special thanks to Joel Bennett&#8217;s SharpSSH wrapper for [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked to create 365 (1 year) of WiFi (daily) guest access accounts, and export them to CSV.<br />
Of course I didn&#8217;t want to create them by hand.. this is where PowerShell came in. I used the following PowerShell script to create random WiFi guest accounts:</p>
<p><span id="more-348"></span></p>
<pre class="brush: powershell; title: ; notranslate">
# Number of days to generate, default = 365
$NumDays 		= 365
$AccessGroup 	= &quot;Gasten&quot;
$ExpiryTime 	= &quot;20:00&quot;
$StartTime 		= &quot;07:00&quot;
$OutputCSV		= &quot;C:\TEMP\wireless.csv&quot;

$SshHost 		= &quot;127.0.0.1&quot;
$SshUser		= &quot;someuser&quot;

$access_codes = @()

# Start SSH session
New-SshSession $SshUser $SshHost
Invoke-Ssh &quot;z&quot;
Invoke-Ssh &quot;conf t&quot;
Invoke-Ssh &quot;wireless F&quot;
Invoke-Ssh &quot;conf t&quot;
Invoke-Ssh &quot;radius-server local&quot;

$i = 0;
do {
	# WSEM format: mm/dd/yyyy hh:mm
	$date = (Get-Date).AddDays($i)
	$date2 = Get-Date $date -Format &quot;dd-MM-yyyy&quot;
	$date = Get-Date $date -format &quot;MM:dd:yyyy&quot;
	$pass = RandomPassword 4
	$user = RandomPassword 4
	$output = &quot;rad-user $user password 0 $pass group $AccessGroup guest expiry-time $ExpiryTime expiry-date $date start-time $StartTime start-date $date&quot;

	# add user through SSH
	Invoke-ssh $output

	$Response = New-Object PSObject
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Datum&quot; -Value $date2
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Gebruikersnaam&quot; -Value $user
	Add-Member -InputObject $Response -MemberType NoteProperty -Name &quot;Wachtwoord&quot; -Value $pass
	$access_codes += $Response

	$i++;
} while ( $i -le $NumDays )

# Save and disconnect SSH
Invoke-ssh &quot;write mem&quot;
Remove-SshSession

# Export to CSV
$access_codes | Export-Csv $OutputCSV

# Helper functions
function RandomPassword ([int]$intPasswordLength)
{
   $strNumbers = &quot;1234567890&quot;
   $strCapitalLetters = &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;
   $strLowerLetters = &quot;abcdefghijklmnopqrstuvwxyz&quot;
   $rand = new-object random

   for ($a=1; $a -le $intPasswordLength; $a++)
      {
         if ($a -gt 3)
           {
      	      $b = $rand.next(0,3) + $a
      	      $b = $b % 3 + 1
      	   } else { $b = $a }
      	 switch ($b)
      	   {
      	      &quot;1&quot; {$b = &quot;$strNumbers&quot;}
      	      &quot;2&quot; {$b = &quot;$strCapitalLetters&quot;}
      	      &quot;3&quot; {$b = &quot;$strLowerLetters&quot;}
      	   }
         $charset = $($b)
         $number = $rand.next(0,$charset.Length)
         $RandomPassword += $charset[$number]
      }
   return $RandomPassword
}
</pre>
<p>Special thanks to Joel Bennett&#8217;s SharpSSH wrapper for PowerShell (located here: <a href="http://huddledmasses.org/scriptable-ssh-from-powershell/">http://huddledmasses.org/scriptable-ssh-from-powershell/</a>) which I used to automate the command line commands for the HP WSEM.<br />
This shows the great power of PowerShell for automating virtually anything! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/07/mass-creation-of-hp-wsem-wifi-guest-accounts-using-ssh-and-powershell/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The case of the black Windows startup screen</title>
		<link>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/</link>
		<comments>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 14:40:02 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[2003]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=313</guid>
		<description><![CDATA[Today I had a nice issue. One of the servers at work suddenly had a &#8220;black&#8221; Windows startup screen. It looked like this: This happened after the server (suddenly) ran out of free disk space. It turned out that all color settings where reset to &#8220;0&#8243; (black), the registry showed the following color values: The [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had a nice issue. One of the servers at work suddenly had a &#8220;black&#8221; Windows startup screen.<br />
It looked like this:<br />
<a href="http://www.maartendamen.com/wp-content/uploads/2010/06/black1.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/black1-300x180.png" alt="" title="black1" width="300" height="180" class="alignnone size-medium wp-image-314" /></a><br />
<span id="more-313"></span></p>
<p>This happened after the server (suddenly) ran out of free disk space. It turned out that all color settings where reset to &#8220;0&#8243; (black), the registry showed the following color values:</p>
<p><a href="http://www.maartendamen.com/wp-content/uploads/2010/06/black2.png"><img src="http://www.maartendamen.com/wp-content/uploads/2010/06/black2.png" alt="" title="black2" width="407" height="577" class="alignnone size-full wp-image-315" /></a></p>
<p>The fix for this was easy, I took the color schema settings from a working 2003 server and inserted them remotely from my workstation. The color schema settings are located under the following registry key: HKEY_USERS\.DEFAULT\Control Panel\Colors</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/06/the-case-of-the-black-windows-startup-screen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a SCSM (System Center Service Manager) lab environment, based on the RTM version.</title>
		<link>http://www.maartendamen.com/2010/04/setting-up-a-scsm-system-center-service-manager-lab-environment-based-on-the-rtm-version/</link>
		<comments>http://www.maartendamen.com/2010/04/setting-up-a-scsm-system-center-service-manager-lab-environment-based-on-the-rtm-version/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 21:38:43 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCSM]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=250</guid>
		<description><![CDATA[Microsoft has released a RTM version SCSM (System Center Service Manager) on MMS (Microsoft Management Summit). A product i&#8217;ve been waiting for, for quite a while. I just finished setting up a lab environment, and I&#8217;m sharing my experience in this blog post. If you want to know more about service manager, check out this [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft has released a RTM version SCSM (System Center Service Manager) on MMS (Microsoft Management Summit). A product i&#8217;ve been waiting for, for quite a while.<br />
I just finished setting up a lab environment, and I&#8217;m sharing my experience in this blog post. If you want to know more about service manager, check out this site: <a href="http://www.microsoft.com/systemcenter/en/us/service-manager.aspx">http://www.microsoft.com/systemcenter/en/us/service-manager.aspx</a></p>
<p>Now, about my lab environment:</p>
<p><span id="more-250"></span>I have setup several virtual machines in my lab environment, this blog post will focus on the machines used for SCSM.<br />
Please note that you can also install service manager on one machine but this rules out the ability to use reporting! The deployment scenario used in this blog post is described here: <a href="http://technet.microsoft.com/en-us/library/ff460945.aspx">http://technet.microsoft.com/en-us/library/ff460945.aspx</a></p>
<p><em>Machine 1:</em></p>
<p>This is the domain controller for my test lab, nothing fancy.. but required for SCSM.</p>
<p><em>Machine 2:</em></p>
<p>This machine is the datawarehouse for SCSM. This machine also includes a SQL Server 2008 installation.</p>
<p><em>Machine 3: </em></p>
<p>This machine is the service manager management server.</p>
<p><strong>SCSM Machine 1: datawarehouse machine.</strong></p>
<ul>
<li>Start by installing Windows 2008/2008 R2 (doh)</li>
<li>Make you install recent updates and service packs.</li>
<li>You must install the Authorization Manager Hotfix, which is available for request here:<a href="http://support.microsoft.com/Default.aspx?kbid=975332"> http://support.microsoft.com/Default.aspx?kbid=975332</a> For Windows 2008 I had to download the Vista version of the patch (!)</li>
<li>Install SQL Server 2008, select the following components during setup:- Database engine services, including full text search (this is a requirement)<br />
- Reporting services<br />
- Management Tools, not required but might come handy</li>
<li>After installing install service pack 1 for SQL Server 2008, this is a requirement.</li>
<li>You can now install service manager&#8217;s data warehouse.</li>
</ul>
<p><strong>SCSM Machine 2: service manager management server.</strong></p>
<ul>
<li>Start by installing Windows 2008/2008 R2 (doh)</li>
<li>Make you install recent updates and service packs.</li>
<li>You must install the Authorization Manager Hotfix, which is available for request here:<a href="http://support.microsoft.com/Default.aspx?kbid=975332"> http://support.microsoft.com/Default.aspx?kbid=975332</a> For Windows 2008 I had to download the Vista version of the patch (!)</li>
<li>Install Microsoft report viewer, which is available in the prerequisites folder on the CD/DVD/ISO.</li>
<li>You can now install service manager&#8217;s management server.</li>
<li>During the install you can use machine 2 as database server.</li>
</ul>
<p>I hope this helps you to get a quick start with SCSM&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/04/setting-up-a-scsm-system-center-service-manager-lab-environment-based-on-the-rtm-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to trace SCCM&#8217;s management pack alerts to concrete SCCM errors</title>
		<link>http://www.maartendamen.com/2010/03/how-to-trace-sccms-management-pack-alerts-to-concrete-sccm-errors/</link>
		<comments>http://www.maartendamen.com/2010/03/how-to-trace-sccms-management-pack-alerts-to-concrete-sccm-errors/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 18:11:44 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCCM]]></category>
		<category><![CDATA[SCOM]]></category>
		<category><![CDATA[alerts]]></category>
		<category><![CDATA[microsoft]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=234</guid>
		<description><![CDATA[Sometimes it&#8217;s a bit tricky to relate events generated by the SCCM management pack for SCOM to real SCCM errors. This article helps you to trace down the real SCCM error by using a real world example.. Let&#8217;s start by looking at the alert generated by the management pack in the SCOM console: Notice the [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s a bit tricky to relate events generated by the SCCM management pack for SCOM to real SCCM errors.<br />
This article helps you to trace down the real SCCM error by using a real world example..</p>
<p><span id="more-234"></span></p>
<p>Let&#8217;s start by looking at the alert generated by the management pack in the SCOM console:</p>
<p><img class="alignnone size-full wp-image-236" title="sccm_error" src="http://www.maartendamen.com/wp-content/uploads/2010/03/sccm_error1.png" alt="sccm_error" width="650" height="458" /></p>
<p>Notice the two items marked:</p>
<ul>
<li>Component</li>
<li>Message ID</li>
</ul>
<p>In this example the component affected is SMS_DISTRIBUTION_MANAGER and the message ID is 2302.<br />
Now let&#8217;s start the SCCM management console, drill down to Site Database -&gt; System Status -&gt; Site Status -&gt; Your site name -&gt; Component Status.</p>
<p><img class="alignnone size-full wp-image-237" title="sccm_error4" src="http://www.maartendamen.com/wp-content/uploads/2010/03/sccm_error4.png" alt="sccm_error4" width="389" height="224" /></p>
<p>The right pane should now give you a list of all the SCCM components,  note the SMS_DISTRIBUTION_MANAGER and the error count:</p>
<p><img class="alignnone size-full wp-image-239" title="sccm_error3" src="http://www.maartendamen.com/wp-content/uploads/2010/03/sccm_error3.png" alt="sccm_error3" width="650" height="198" /></p>
<p>Now right click the component with errors and select &#8220;Show Messages -&gt; All&#8221;<br />
A message status viewer will now popup showing some detailed information about the error:</p>
<p><img class="alignnone size-full wp-image-240" title="sccm_error2" src="http://www.maartendamen.com/wp-content/uploads/2010/03/sccm_error2.png" alt="sccm_error2" width="592" height="181" /></p>
<p>Note that the message ID of the error reported by the management pack is listed here. This should give you some in-depth information about the error.<br />
I hope this article helps you to trace alerts generated by SCOM down to the real SCCM errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/03/how-to-trace-sccms-management-pack-alerts-to-concrete-sccm-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extending Windows 2003 os disk using diskpart and VMware</title>
		<link>http://www.maartendamen.com/2010/03/extending-windows-2003-os-disk-using-diskpart-and-vmware/</link>
		<comments>http://www.maartendamen.com/2010/03/extending-windows-2003-os-disk-using-diskpart-and-vmware/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 20:07:58 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[VMware vSphere]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[disk]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vsphere]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=216</guid>
		<description><![CDATA[I use this trick quite often for Windows 2003 machines (this is not needed on Windows 2008 machines, you can use diskpart directly here!) After time the OS disk grows out it&#8217;s free space, usually this happens due to Windows updates or logfiles. So, here&#8217;s how to extend an OS disk of a Windows 2003 [...]]]></description>
			<content:encoded><![CDATA[<p>I use this trick quite often for Windows 2003 machines (this is not needed on Windows 2008 machines, you can use diskpart directly here!)<br />
After time the OS disk grows out it&#8217;s free space, usually this happens due to Windows updates or logfiles.<br />
So, here&#8217;s how to extend an OS disk of a Windows 2003 machine using diskpart and VMware (ESX 2.0, vSphere, ESX3.5 anything will do):</p>
<p><span id="more-216"></span></p>
<ol>
<li>Shut down the virtual machine in question.</li>
<li>Connect the virtual machine OS disk to another virtual machine, this can be a running virtual machine (please note that you do need to reboot this machine after you are done):- Click edit settings on the running virtual machine.- Click on &#8220;Add&#8230;&#8221; to add hardware to the machine.<br />
- Select &#8220;Hard disk&#8221;<br />
- Select &#8220;Use an existing virtual disk&#8221;<br />
- Browse to the virtual disk.<br />
- Click &#8220;Next&#8221; and &#8220;Finish&#8221;</p>
<p>Your running virtual machine should now look like this:</p>
<p><img class="alignnone size-full wp-image-220" title="10-3-2010 20-44-19" src="http://www.maartendamen.com/wp-content/uploads/2010/03/10-3-2010-20-44-19.png" alt="10-3-2010 20-44-19" width="373" height="321" /></p>
<p>Click &#8220;OK&#8221; to apply the settings.</li>
<li>Now go to edit settings again, and change the size of the virtual disk.
<p><img class="alignnone size-full wp-image-221" title="10-3-2010 20-55-36" src="http://www.maartendamen.com/wp-content/uploads/2010/03/10-3-2010-20-55-36.png" alt="10-3-2010 20-55-36" width="317" height="99" />Click &#8220;OK&#8221; once again.</li>
<li>Now open the console of the running machine. And start a command prompt.</li>
<li>Type &#8220;diskpart&#8221;.Within diskpart, type &#8220;list disk&#8221; to display available disks, you should notice the disk with the free space:
<p><img class="alignnone size-full wp-image-222" title="10-3-2010 20-58-31" src="http://www.maartendamen.com/wp-content/uploads/2010/03/10-3-2010-20-58-31.png" alt="10-3-2010 20-58-31" width="439" height="95" /></p>
<p>Now select that disk, using &#8220;select disk 2&#8243; (2 being the disk number offcourse..)<br />
After that, select the appropriate partition, using &#8220;select part 1&#8243; (1 being the partition number)<br />
<img class="alignnone size-full wp-image-223" title="10-3-2010 21-01-03" src="http://www.maartendamen.com/wp-content/uploads/2010/03/10-3-2010-21-01-03.png" alt="10-3-2010 21-01-03" width="439" height="138" /></p>
<p>Now extend the partition using the &#8220;extend&#8221; command.</p>
<p><img class="alignnone size-full wp-image-224" title="10-3-2010 21-02-46" src="http://www.maartendamen.com/wp-content/uploads/2010/03/10-3-2010-21-02-46.png" alt="10-3-2010 21-02-46" width="351" height="73" /></p>
<p>Hooray! :-)</li>
<li>Now shut down the virtual machine, and remove the added disk. After that you can power on the initial virtual machine.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/03/extending-windows-2003-os-disk-using-diskpart-and-vmware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trend Micro IMSS management pack for SCOM</title>
		<link>http://www.maartendamen.com/2010/02/trend-micro-imss-management-pack-for-scom/</link>
		<comments>http://www.maartendamen.com/2010/02/trend-micro-imss-management-pack-for-scom/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 18:43:29 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCOM]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[trendmicro]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=213</guid>
		<description><![CDATA[I just released my first management pack for System Center Operations Manager (SCOM). It&#8217;s a management pack for Trend Micro&#8217;s IMSS. You can download the management pack here: http://www.maartendamen.com/?page_id=190]]></description>
			<content:encoded><![CDATA[<p>I just released my first management pack for System Center Operations Manager (SCOM).<br />
It&#8217;s a management pack for Trend Micro&#8217;s IMSS.</p>
<p>You can download the management pack here:<br />
<a href="http://www.maartendamen.com/?page_id=190">http://www.maartendamen.com/?page_id=190</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/02/trend-micro-imss-management-pack-for-scom/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Change pagefile settings on multiple servers using Powershell</title>
		<link>http://www.maartendamen.com/2010/02/powershell-script-for-changing-pagefile-settings-on-multiple-servers/</link>
		<comments>http://www.maartendamen.com/2010/02/powershell-script-for-changing-pagefile-settings-on-multiple-servers/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 19:27:32 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[pagefile]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=157</guid>
		<description><![CDATA[Today I wanted to change the page file settings on some of our servers (about 80), doing that by hand would take ages. That&#8217;s why I came up with the following Powershell script, the script does the following: Loop through a list of Windows 2003 servers in our active directory, only Windows 2003 machines were [...]]]></description>
			<content:encoded><![CDATA[<p>Today I wanted to change the page file settings on some of our servers (about 80), doing that by hand would take ages.<br />
That&#8217;s why I came up with the following Powershell script, the script does the following:</p>
<ul>
<li>Loop through a list of Windows 2003 servers in our active directory, only Windows 2003 machines were needed. You can easily modify the search filter though.</li>
<li>Set pagefile size on those servers, minimum size and maximum size set to &#8220;0&#8243; means the pagefile settings will be set on &#8220;system managed&#8221;</li>
</ul>
<p>So, here&#8217;s the full source of the script:<br />
<span id="more-157"></span></p>
<pre class="brush: powershell; title: ; notranslate">
# Ask for credentials to do remote WMI.
$cred    	= Get-Credential DOMAIN\Administrator

# Filter used for active directory query. Only Windows 2003 is needed, Windows 2008 defaults to system managed pagefile size.
$strFilter 	= &quot;(&amp;(objectClass=computer)(operatingSystem=Windows Server 2003))&quot;

$objDomain 	= New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = &quot;Subtree&quot;

$colResults = $objSearcher.FindAll()

# Loop through list of servers.
foreach ($objResult in $colresults)
{
	$objItem = $objResult.Properties

	$name = $objItem.name[0]

	Write-Host &quot;Setting pagefile on server: $name&quot;

	try
	{
		$PageFile = Get-WmiObject Win32_PageFileSetting -Credential $cred -ComputerName $objItem.name
		$PageFile.InitialSize = 0
		$PageFile.MaximumSize = 0
		$PageFile.Put()
	}
	catch
	{
		Write-Host &quot;Failed to set pagefile on: $name, no permission or server down?&quot;
		break
	}
	finally
	{
		Write-Host &quot;Pagefile set on: $name&quot;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2010/02/powershell-script-for-changing-pagefile-settings-on-multiple-servers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SCOM alert notification subscription delay sending for x minutes and don&#8217;t sent if alert is auto-resolved within that time</title>
		<link>http://www.maartendamen.com/2009/12/scom-alert-notification-subscription-delay-sending-for-x-minutes-and-dont-sent-if-alert-is-auto-resolved-within-that-time/</link>
		<comments>http://www.maartendamen.com/2009/12/scom-alert-notification-subscription-delay-sending-for-x-minutes-and-dont-sent-if-alert-is-auto-resolved-within-that-time/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 10:52:24 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
				<category><![CDATA[SCOM]]></category>
		<category><![CDATA[alerts]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.maartendamen.com/?p=40</guid>
		<description><![CDATA[In my company we are using SCOM for monitoring our server environment. Off hours we also get notified about critical alerts using a SMS/GSM modem. Using default SCOM functionality we delay the sending of notifications by 5 minutes. This works fine for alerts with a &#8220;new&#8221; state. However if an alert is closed within the [...]]]></description>
			<content:encoded><![CDATA[<p>In my company we are using SCOM for monitoring our server environment.<br />
Off hours we also get notified about critical alerts using a SMS/GSM modem.<br />
Using default SCOM functionality we delay the sending of notifications by 5 minutes. This works fine for alerts with a &#8220;new&#8221; state.<br />
However if an alert is closed within the 5 minute period a &#8220;closed&#8221; notification is sent out.<br />
We do not want to see the closed alerts if an alert auto-resolved within the 5 minute time period.  But if a new alert that has aged 5 minutes and sent to our GSM, we definately want to see that closed alert if it auto/manual resolves into the closed state (to make sure someone actually did something about the alert)</p>
<p>Using default SCOM functionality, this is not possible. This is why we came up with the following idea (special thanks to my colleague Frank):</p>
<ul>
<li>Using two seperate subscriptions, one for &#8220;new&#8221; alerts and one for &#8220;closed&#8221; alerts.</li>
<li> On the new alert subscription set a channel with a powershell script to update custom field 1 when a SMS has been sent (this subscription has the 5 minute delay)</li>
<li>On the closed alert subscription set a condition to check custom field 1 to see wheter a SMS has been sent or not.</li>
</ul>
<p>This blog post describes how this can be done within SCOM.</p>
<p><span id="more-40"></span></p>
<p><strong>1. The Command Notification Channel<br />
</strong></p>
<p>First we have to create a &#8220;Command Notification Channel&#8221;. Go to the &#8220;Administration&#8221; section of the SCOM management console. Click on Notifications-&gt;Channels.<br />
Right click and select &#8220;New-&gt;Command&#8230;&#8221;.<br />
The following wizard appears:</p>
<p><img class="size-full wp-image-45 alignnone" style="margin: 10px 0px;" title="Command Notification Channel Wizard #1" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_cmdnot1.png" alt="Command Notification Channel Wizard #1" width="680" height="244" /></p>
<p>Give the channel a name, and click &#8220;Next &gt;&#8221;</p>
<p>Enter the following settings for the channel:</p>
<p><strong>Full path of the command file:</strong><br />
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe<br />
<strong>Command line parameters:<br />
</strong><em> </em>-Command &#8220;&amp; D:\Scripts\UpdateAlertCustomField.ps1 -alertid:&#8221;$Data/Context/DataItem/AlertId$&#8221;"<br />
<strong>Startup folder for the command line:</strong><br />
D:\Scripts</p>
<p>Change D:\Scripts to reflect your PowerShell script location. It should now look like this:</p>
<p><img class="size-full wp-image-46 alignnone" title="Command Notification Channel Wizard #2" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_cmdnot2.png" alt="Command Notification Channel Wizard #2" width="468" height="167" /></p>
<p>Save the changes by clicking &#8220;Finish&#8221;</p>
<p><strong>2. The used PowerShell script</strong></p>
<p>To modify alert &#8220;custom field 1&#8243;, I use a small PowerShell script. The text written into the field is &#8220;Notification sent out&#8221;<br />
The used script is displayed here, save this script as &#8220;UpdateAlertCustomField.ps1&#8243; in the directory specified in the command notification channel above.</p>
<pre class="brush: powershell; title: ; notranslate">
# Get alertid parameter
Param($alertid)
$alertid = $alertid.toString()

# Load SCOM snap-inn
add-pssnapin &quot;Microsoft.EnterpriseManagement.OperationsManager.Client&quot;;
$server = &quot;localhost&quot;

# Connect to SCOM
new-managementGroupConnection -ConnectionString:$server;
set-location &quot;OperationsManagerMonitoring::&quot;;

# Update alert custom field
$alert = Get-Alert -id $alertid
$alert.CustomField1 = &quot;Notification sent out&quot;
$alert.Update(&quot;Custom field 1 updated by UpdateAlertCustomField script&quot;)
</pre>
<p><strong>3. A subscriber for the command</strong></p>
<p>The next step is to create a subscriber which has the command notification channel created above assigned as channel.<br />
Go to the &#8220;Administration&#8221; section of the SCOM management console. Click on Notifications-&gt;Subscribers.<br />
Right click and click &#8220;New&#8230;&#8221;</p>
<p>In the &#8220;Notification Subscriber Wizard&#8221; give the new subscriber a name. In the next step of the wizard, specify your schedule as desired.<br />
On the &#8220;Addresses&#8221; step, click &#8220;Add&#8230;&#8221; to add a new address.</p>
<p><img class="alignnone size-full wp-image-72" title="scom_notsub_add" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_notsub_add.png" alt="scom_notsub_add" width="680" height="311" /></p>
<p>In the &#8220;Subscriber Address&#8221; wizard, specify a name for the new subscriber. This can be virtually anything as no e-mails/pages/SMS messages are sent anyway.<br />
Next, specify the &#8220;Command&#8221; channel type and select the Command channel we created earlier (Update custom field 1).</p>
<p><img class="alignnone size-full wp-image-73" title="scom_subaddr" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_subaddr.png" alt="scom_subaddr" width="677" height="351" /></p>
<p>Specify your schedule as desired, click &#8220;Finish&#8221; to end the wizard. Click &#8220;Finish&#8221; again to close the &#8220;Notification Subscriber Wizard&#8221;.<br />
You should now have a subscriber with the command channel as asigned channel.</p>
<p><strong>4. The subscription for new alerts</strong></p>
<p><strong></strong>Now that we have the command notification channel, powershell script and subscriber ready. We can create a new subscription for new alerts.<br />
Go to the &#8220;Administration&#8221; section of the SCOM management console. Click on Notifications-&gt;Subscriptions.</p>
<p>In the &#8220;Notification Subscription Wizard&#8221; specify a name for the new subscription. The next wizard step is the step to define criteria for the subscription.<br />
Specify atleast the &#8220;with specific resolution state&#8221; criteria, offcourse you can add your own other criteria here like you would normally do.</p>
<p><img class="alignnone size-full wp-image-74" title="scom_notsub_wi" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_notsub_wi.png" alt="scom_notsub_wi" width="489" height="365" /></p>
<p>On the next wizard page (Subscribers) add the command subscriber we created in step 3, as shown below.</p>
<p><img class="alignnone size-full wp-image-75" title="scom_subaddr_wi2" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_subaddr_wi2.png" alt="scom_subaddr_wi2" width="477" height="237" /></p>
<p>In the next wizard step (Channels) add the command channel we created in step 1 and specify the desired delay (5 minutes in this case). As shown below:</p>
<p><img class="alignnone size-full wp-image-76" title="scom_delay" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_delay.png" alt="scom_delay" width="476" height="474" /></p>
<p>Click &#8220;Next&#8221;, in the summary step make sure &#8220;Enable this notification subscription&#8221; is checked and click &#8220;Finish&#8221;.<br />
You should now have an subscription ready for new SCOM alerts.</p>
<p><strong>5. Subscription for closed alerts</strong></p>
<p>You can create the subscription channel like you would normally do. The only important step is to get the criteria right. We have to include custom field 1.<br />
This is how the closed subscription criteria look:</p>
<p><img class="alignnone size-full wp-image-79" title="scom_notcustom" src="http://www.maartendamen.com/wp-content/uploads/2009/12/scom_notcustom.png" alt="scom_notcustom" width="483" height="393" /></p>
<p><span style="text-decoration: underline;"><strong>NOTE: there is currently a bug in SCOM R2 when using custom fields in a subscription criteria!</strong></span></p>
<p>For more information about thihs bug visit the following URL:</p>
<p><a href="http://social.technet.microsoft.com/Forums/en/operationsmanagergeneral/thread/260be16a-0f45-4904-8093-7c1caa5ed546">http://social.technet.microsoft.com/Forums/en/operationsmanagergeneral/thread/260be16a-0f45-4904-8093-7c1caa5ed546</a></p>
<p><span style="text-decoration: underline;">You have to update the xml file each time you change something in either of the notifications!</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maartendamen.com/2009/12/scom-alert-notification-subscription-delay-sending-for-x-minutes-and-dont-sent-if-alert-is-auto-resolved-within-that-time/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

