<?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>Ionut NicaIonut Nica</title>
	<atom:link href="http://www.rivnet.ro/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rivnet.ro</link>
	<description>Windows, Scripting, Virtualization, Cloud Computing - tricks for getting around in the world of Technology</description>
	<lastBuildDate>Thu, 17 May 2012 09:37:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Automate vSphere Certificate Generation</title>
		<link>http://www.rivnet.ro/2012/05/automate-vsphere-certificate-generation.html</link>
		<comments>http://www.rivnet.ro/2012/05/automate-vsphere-certificate-generation.html#comments</comments>
		<pubDate>Thu, 17 May 2012 09:37:14 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[VMWARE]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[Certificates]]></category>
		<category><![CDATA[certreq]]></category>
		<category><![CDATA[openssl]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=634</guid>
		<description><![CDATA[A couple of weeks ago I was working on some audit internally, and I discovered we had some vSphere servers working with self generated certificates. While these servers were unmanaged servers (esxi free license servers), they still needed certificates, as it is the case with such servers, they are &#8220;critical&#8221;, just not critical enough to [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I was working on some audit internally, and I discovered we had some vSphere servers working with self generated certificates. While these servers were unmanaged servers (esxi free license servers), they still needed certificates, as it is the case with such servers, they are &#8220;critical&#8221;, just not critical enough to warrant licenses <img src='http://www.rivnet.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>The &#8220;problem&#8217; with vSphere certificates is that they have to be generated using openSSL and you cannot generate them using Windows tools like, certreq. With certreq you could potentially have done this process much easier. Also there is an issue with using the request files given out by openssl as it does not have template information written in it, and the Windows CA cannot generate a certificate if it does not know which kind of certificate you want.</p>
<p>I trawled the internet for ways to automate this, and I didn&#8217;t find an end to end solution for certificate generation. I only found bits and pieces, and people were writing how to do each certificate one by one. This didn&#8217;t sit well with me, and looking at the workflows I discovered there was really no point in not having a script that does &#8220;it&#8221; automatically. I will define what &#8220;it&#8217; is, by making a short description of the steps required for generating a vSphere certificate:</p>
<ol>
<li>Generate CSR file and key file using OpenSSL</li>
<li>Submit CSR file to certification authority</li>
<li>Retrieve response from certification authority</li>
<li>Rename certificate file and key file  and upload to vSphere host</li>
</ol>
<p>Some notes regarding the setup in which this would work:</p>
<ul>
<li>I used Powerhsell to automate this, so this won&#8217;t work on other platforms.</li>
<li>I used a Windows 2008 R2 PKI CA with a &#8220;Web Server&#8221; Template.</li>
<li>The CA also had automatic approval for this type of certificate (which made automating the response retrieval easier)</li>
<li>User running this script needs to have the right to request/issue the given certificate template, also should be local admin on the box you are running the script, otherwise you would have to modify script to run some parts of the commands with &#8220;runas&#8221;</li>
</ul>
<h2>The script</h2>
<p>I used a preexisting script to get start, the one for certificate mass generation from valcolabs.com, found <a title="here" href="http://www.valcolabs.com/2012/04/11/vsphere-5-ssl-certificates-mass-generation/" target="_blank">here</a>.</p>
<p>What differs from the way they did it, is that I&#8217;ve changed the way variables are passed for building the &#8220;config file&#8221;,  and the fact that each CSR has its own config file, specified on command line. This will help you track your work better for troubleshooting purposes. Something that should be noted is that their script, and also mine, use a special openssl config file, in the sense that the lines to be modified by the script are numbered, not searched in the file, so beware of making changes to the &#8220;custom_openssl.cfg&#8221; file. It could have probably been more elegant to search for the lines in the file, but I didn&#8217;t want to spend time getting it to work.</p>
<p>The download link for the script I built is this one; <a href="http://www.rivnet.ro/wp-content/uploads/2012/05/Generate-vSphere-Cert.zip">Generate-vSphere-Cert</a>, below you will find some explanations on how it works.</p>
<h2>Learning points</h2>
<p>The script takes some parameters as input (get some of them wrong and your script might not work as intended or quit)</p>
<p>a) <strong>vSphereHostFile</strong> &#8211; is a CSV file that must contain the host name and domain name in 2 separate columns.</p>
<p>b) <strong>CAMachineName_CAName</strong> is the name of your CA in the format (hostname\display name)</p>
<p>c) <strong>TemplateName</strong> is the name of the certificate template you want to use for certificate generation</p>
<p><strong>Lines 32 &#8211; 44</strong> you should change the variables there to match your requirements (different paths, different location, country, email, company, etc). There is room for improvement here, you can include this info in the csv file, useful for creating certificates for multiple companies, with different contact information.</p>
<p><strong>Lines 49 &#8211; 73</strong> &#8211; build out a folder structure, one folder per host where all host files will be stored. Also builds CN, SAN&#8217;s (Subject Alternate Names)  &#8211; you may wish to customize what you add here. I added short name, fqdn, i left out IP address as that can change more easily than the name.</p>
<p><strong>Lines 80-97</strong> &#8211; use a temporary file from the original openssl config file containing the parameters we setup until now &#8211; this piece of code uses numbered lines, so if you make changes to the original file, change the line numbers here)</p>
<p><strong>Lines 99-104</strong> &#8211; build out the file/paths to generate a CSR with openssl. The command i used is slightly different than the ones on the internet, I needed a special length for the RSA, so I used:</p>
<pre class="brush: powershell; title: ; notranslate">&quot;$openssldir\openssl.exe req -newkey rsa:2048 -out $csr -keyout $key -config $config&quot;</pre>
<p><strong>Lines 109-114</strong> &#8211; build paths for files to send/receive to/from the Windows CA. I also used something &#8220;unusual&#8221; (as in, not your first page results on google search) which is specifying the CAName and Template name.</p>
<p>The CA name is needed so you do not get a prompt each time certreq is invoked.</p>
<p>The certificate template is specified using the attrib parameter, the missing piece of my &#8220;how to automate&#8221; CSR sumitting, see below:</p>
<pre class="brush: powershell; title: ; notranslate">$ConfigString = &quot;&quot;&quot;$CAMachineName_CAName&quot;&quot;&quot;
$attrib = &quot;CertificateTemplate:$TemplateName&quot;
$issuecerts_cmd = &quot;certreq -submit -attrib $attrib -config $ConfigString $csr $crt $p7b $rsp &quot;</pre>
<p><strong>Lines 117-122</strong> -<strong> Unless you use this script for automating creation of vCenter Certificates, you can comment these lines out</strong>. They generate a pfx certificate which is required with vCenter. PFX certificates are not not required for vSphere host certificates.</p>
<p>The next step to automation would be to upload these files to your vSphere host. I used this script <a href="http://communities.vmware.com/docs/DOC-14655" target="_blank">here</a> and changed some paths to suit my folder structure. You can also use SCP or other methods to upload the file. After the files are uploaded you need to reboot the host for the certificates to take effect.</p>
<p>As always with these scripts, <strong><span style="text-decoration: underline;">do your best to try them in a test environment</span></strong> before unleashing them into production. You are dealing with Certification Authorities and your vSphere hosts. Failure to upload a correct certificate to the hosts will result in you not being able to connect with vSphere Client, and having to go to console (NOT SSH) and regenerate self signed certificate.</p>
<p>I hope this was a useful read, comments and critique are open, as always.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2012%2F05%2Fautomate-vsphere-certificate-generation.html&amp;title=Automate%20vSphere%20Certificate%20Generation" id="wpa2a_2"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2012/05/automate-vsphere-certificate-generation.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking vCenter VM and DB</title>
		<link>http://www.rivnet.ro/2012/01/tracking-vcenter-vm-and-db.html</link>
		<comments>http://www.rivnet.ro/2012/01/tracking-vcenter-vm-and-db.html#comments</comments>
		<pubDate>Tue, 31 Jan 2012 12:10:26 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[VMWARE]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=504</guid>
		<description><![CDATA[It has been a while since I managed to do some writing on my blog, mostly because I&#8217;ve been busy with other Real Life events, and general lack of time. But now I&#8217;m here to share something that has been sitting in my drafts folder for a while. This one is about virtualization. 2010 and [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I managed to do some writing on my blog, mostly because I&#8217;ve been busy with other Real Life events, and general lack of time. But now I&#8217;m here to share something that has been sitting in my drafts folder for a while. This one is about virtualization.</p>
<p>2010 and 2011 were virtualization years for me, I worked on several projects in design, implementation, and I learned so much, that looking back I really get a feeling of accomplishment.<br />
I&#8217;ve also been a little &#8220;cutting edge&#8221;, non conservative with my designs some would say. I guess practice what you preach kind of stuck with me and I made it my mission to build reliable, self contained VMware environments, as much as possible.</p>
<p>As part of the design process, you always have to think about your management software</p>
<ul>
<li>Where do you put the pieces of software that help you manage the environment?</li>
<li>How do you ensure availability and SLA for these components to allow you to recover from failures?</li>
</ul>
<p>The answer to the first question can be:</p>
<p><strong>Option A:</strong> In a management cluster, dedicated to management software for the virtualization stack</p>
<ul>
<li>The advantage is you always know where the VMs are, if you have a failure there are 2 servers they can be on.</li>
<li>The disadvantage is you dedicate two physical boxes for this purpose, which can have a maximum utilization of around 40% for failover reasons.</li>
</ul>
<p><strong>Option B:</strong> Next to production machines</p>
<ul>
<li>The advantage is you don&#8217;t have to setup a management cluster, and you optimize resource utilization in your datacenter.</li>
<li>The disadvantage is that you lose &#8220;determinism&#8221;, the security of &#8220;I know on what server vCenter is sitting, so i don&#8217;t have to look for it&#8221;, if i get a cluster failure or worse.</li>
</ul>
<p>Well I&#8217;ve come up with two &#8220;tricks&#8221; that tackle the drawbacks of the second option, not knowing where your management servers are, making it a preferred choice if your environment does not warrant a dedicated management cluster just for that.</p>
<h3>#1 Track the movement of vCenter and vCenter DB using vCenter Alarms</h3>
<p>This one is a really easy way to keep track of your vCenter components. It works best combined with the second trick you will see below, mainly because it does not cover all scenarios but the advantage of this method is that the information is provided in real time.</p>
<p>What I am proposing is that you create an alarm in vCenter, that monitors for events that change the VMhost of your vCenter VM. These events are:</p>
<ol>
<li>VM is being migrated (manually)</li>
<li>VM is being migrated by DRS</li>
<li>VM is being restarted by HA on another host</li>
</ol>
<p>The third trigger will be hit and miss, it stands to reason, that if vCenter is not up to send the mail since it being restarted, you may or may not get the email, or you will get it after the fact. nevertheless it is good to have it there.</p>
<p>Below are the screenshots of how the alarm would look like:</p>
<p><a href="http://www.rivnet.ro/wp-content/uploads/2012/01/VM-conditions.png"><img class="aligncenter size-full wp-image-614" title="VM conditions" src="http://www.rivnet.ro/wp-content/uploads/2012/01/VM-conditions.png" alt="" width="737" height="471" /></a></p>
<p>On the advanced field put this condition in:</p>
<p><a href="http://www.rivnet.ro/wp-content/uploads/2012/01/trigger-conditions.png"><img class="aligncenter size-full wp-image-613" title="trigger-conditions" src="http://www.rivnet.ro/wp-content/uploads/2012/01/trigger-conditions.png" alt="" width="449" height="391" /></a></p>
<p>Then add some notification address or whatever you prefer</p>
<p><a href="http://www.rivnet.ro/wp-content/uploads/2012/01/Notification.png"><img class="aligncenter size-full wp-image-612" title="Notification" src="http://www.rivnet.ro/wp-content/uploads/2012/01/Notification.png" alt="" width="737" height="471" /></a></p>
<p>Save your alarm, and then try to migrate vCenter and see what happens. You should do this to the vCenter DB server aswell, and any components you feel you should know where they are, for troubleshooting purposes (VUM, Nexus 1000v Supervisor Modules, Management Appliances).</p>
<h3>#2 Check the vSphere host where vCenter is running using a scheduled script</h3>
<p>Another wasy to check where your vCenter components stay is using a scheduled PowerCLI script that runs once a day and sends you an email where vCenter VM and vCenter database are sitting (which vSphere host)</p>
<p>This script assumes following:</p>
<ol>
<li>vCenter VM name in inventory = vCenter VM hostname</li>
<li>vCenter is using separate database, if you don&#8217;t care about that, you can remove the references to the DB.</li>
<li>vCenter Database name in inventory = vCenter Database hostname or at least a cNAME with this name (e.g. RO-vcenter &gt; RO-vCenter-DB name, and alias in DNS)</li>
</ol>
<p>You can customize this by entering a CSV file of the names of the vcenter instances and their respective databases.</p>
<pre class="brush: powershell; title: ; notranslate"> #version 0.1
#initial release

Add-PSSnapin Vmware.VimAutomation.Core -ErrorAction:SilentlyContinue
Set-PowerCLIConfiguration -DefaultVIServerMode multiple -Confirm:$false
#Write-Host -ForegroundColor Yellow &quot;This script Generates a report detailing which host has the vCenter VM and vCenter DB VM`
#If you wish to cancel Press Ctrl+C,otherwise press Enter&quot;
#Read-Host

#using fqdn because certificates are issued using a FQDN
$vCenter = ('vcenter','vcenter2','vcenter3')

If ($global:DefaultVIServers -ne $null) {
	DisConnect-VIServer * -Force -Confirm:$false }
$vCenter | % {Connect-VIServer $_ -NotDefault:$false}

$Report = @()
$vCenters = $global:DefaultVIServers | % {
	$row = &quot;&quot; | select vCenterInstance,FrontendVMHost,DBVMName,DBVMHost
	$row.vCenterInstance = $_.Name
	$row.FrontendVMHost = (get-vm -Name $_.Name.Split(&quot;.&quot;)[0] -server $_.Name).VMHost
	#db is hostname + db
	$dbvm = &quot;$($_.Name.Split(&quot;.&quot;)[0])DB&quot;
	$DBVMName = ([System.Net.Dns]::GetHostByName($dbvm)).HostName.Split(&quot;.&quot;)[0]
	$row.DBVMName = $DBVMName
	$row.DBVMHost = (get-vm -Name $DBVMName* -server $_.Name).VMHost
	$Report += $row
}

$FileDate = get-date -Uformat &quot;%Y%m%d-%H%M%S&quot;
$Path = &quot;c:\temp\vsphere\&quot;
$File = &quot;$FileDate-vCenter-InfraLocation.csv&quot;
$Report | Export-Csv -NoTypeInformation -UseCulture &quot;$Path$File&quot;

$encoding = [System.Text.Encoding]::UTF8
#I made the convoluted out-string construct because the object cannot be serialized&quot;
$ReportBody = $null
$ReportBody += $Report | % { &quot;
`n
`n$($_.vCenterInstance)`n$($_.FrontendVMHost)`n$($_.DBVMName)`n$($_.DBVMHost)&quot;}$Body = &quot;&lt;/pre&gt;
&lt;div&gt;I'm the PowerCLI Magic Script. This is the list of your vCenter instances and their locations in the Infrastructure.
`
If you ever lose track of them, this email is the reminder. The latest update is from $FileDate
`
Below is the detailed information about each Instance:
`
`n`n`n`n`n`n$ReportBody`n`n
&lt;table border=&quot;`&amp;quot;1`&amp;quot;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;vCenterInstance&lt;/td&gt;
&lt;td&gt;FrontendVMHost&lt;/td&gt;
&lt;td&gt;DBVMName&lt;/td&gt;
&lt;td&gt;DBVMHost&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;&quot;

Send-MailMessage -Smtpserver smtpserver -From 'admin_vmware@foo.com' -To 'vSphereAdministrators@foo.com' -Body $Body -Bodyashtml -Encoding $encoding -Subject &quot;vCenter Instances List&quot; -Attachments $Path$File</pre>
<div></div>
<h4>Learning points:</h4>
<p><strong>Line 11:</strong> This is where you define you vCenter server names, if you have more of them. I had 3 for example.</p>
<p><strong>Line 22 &amp; 27</strong>: This is where you perform a get-vm to find out the host where this VM is residing on</p>
<p>The rest of the script is just to cycle through all vCenter instances and create an email that it sends to a given email address.</p>
<p>Perhaps to some people this may seem unnecessary, as they may not have faced major outages, perhaps to some it may seem that these monitoring tricks are not enough to cover monitoring of all &#8216;outages&#8217; situations, but I find it is not worse than having a separate management cluster, with the added benefit of not having to deal with another separate management cluster.</p>
<p>C&amp;C as always is welcome</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2012%2F01%2Ftracking-vcenter-vm-and-db.html&amp;title=Tracking%20vCenter%20VM%20and%20DB" id="wpa2a_4"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2012/01/tracking-vcenter-vm-and-db.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get List of Installed Windows Updates</title>
		<link>http://www.rivnet.ro/2011/09/get-list-of-installed-windows-updates-powershell.html</link>
		<comments>http://www.rivnet.ro/2011/09/get-list-of-installed-windows-updates-powershell.html#comments</comments>
		<pubDate>Fri, 02 Sep 2011 13:48:23 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WSUS]]></category>
		<category><![CDATA[installed updates]]></category>
		<category><![CDATA[updates list]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=520</guid>
		<description><![CDATA[This post falls into the category of note to self posts. A while back I researched the Internet for a way to get the list of installed updates on a computer. This is useful for those of us still using Microsoft WSUS without SCCM or some other Reporting Tool, because WSUS reports only the number [...]]]></description>
			<content:encoded><![CDATA[<p>This post falls into the category of note to self posts. A while back I researched the Internet for a way to get the list of installed updates on a computer.<br />
This is useful for those of us still using Microsoft WSUS without SCCM or some other Reporting Tool, because WSUS reports only the number of computers having or not having a patch installed/applicable, but not which ones.<br />
As of this date there are no Powershell cmdlets that let you get this information, no WMI query no nothing. You have to get it programatically, so I went along and created the following powershell code that creates a report.</p>
<pre class="brush: powershell; title: ; notranslate">$InputObject = Read-host -Prompt &quot;Insert Computername to get list of installed updates&quot;;
$Report = @()
$filename = &quot;$env:Temp\Report_$(get-date -Uformat &quot;%Y%m%d-%H%M%S&quot;).csv&quot;
$InputObject | % {
   $objSession = [activator]::CreateInstance([type]::GetTypeFromProgID(&quot;Microsoft.Update.Session&quot;,$_))
   $objSearcher= $objSession.CreateUpdateSearcher()
   $HistoryCount = objSearcher.GetTotalHistoryCount
   $colSucessHistory = $objSearcher.QueryHistory(0, $HistoryCount)
   Foreach($objEntry in $colSucessHistory | where {$_.ResultCode -eq '2'}) {
       $pso = &amp;quot;&amp;quot; | select Computer,Title,Date
       $pso.Title = $objEntry.Title
       $pso.Date = $objEntry.Date
       $pso.computer = $_
       $Report += $pso
       }
   $objSession = $null
   }
}
$Report | where { $_.Title -notlike 'Definition Update*'} | Export-Csv $filename -NoTypeInformation -UseCulture
ii $filename</pre>
<p>Once you run this report and have an csv viewer installed (excel for example( it will open up the file so you can review it. When exporting I did a filter to remove MS Forefront definition updates as it is pretty irrelevant most of the time, you use other tools to manage Forefront definitions.</p>
<h2>Learning Points</h2>
<p><strong>Line 05</strong> &#8211; This line creates and instance of the Windows Update API. What is neat about this function is the fact that can create an instance of the API and connect to a remote computer, notice the &#8220;$_&#8221; at the end of the line.</p>
<p><strong>Line 09</strong> &#8211; In this line after searching the entire history we filter out all but successful updates. Yes it would be nice to do that in the actual search, but I don&#8217;t know if it is possible. So I resorted to filtering out only successful result codes.</p>
<p>Below is a table with possible values. This can be useful if you want to generate a report based on the result code</p>
<table style="width: auto;" border="0" align="left">
<tbody>
<tr>
<td style="text-align: left;">Result Code</td>
<td style="text-align: left;">Update Status</td>
</tr>
<tr>
<td style="text-align: left;">0</td>
<td style="text-align: left;">Not Started</td>
</tr>
<tr>
<td style="text-align: left;">1</td>
<td style="text-align: left;">In Progress</td>
</tr>
<tr>
<td style="text-align: left;">2</td>
<td style="text-align: left;">Successful</td>
</tr>
<tr>
<td style="text-align: left;">3</td>
<td style="text-align: left;">Incomplete</td>
</tr>
<tr>
<td style="text-align: left;">4</td>
<td style="text-align: left;">Failed</td>
</tr>
<tr>
<td style="text-align: left;">5</td>
<td style="text-align: left;">Aborted</td>
</tr>
</tbody>
</table>
<div style="clear: both; font-size: 0; line-height: 0;">&nbsp;</div>
<p>That&#8217;s about it with getting the list of installed updates, the bit of code above can be easily integrated to run across a large number of computers. Thanks for reading and feedback.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2011%2F09%2Fget-list-of-installed-windows-updates-powershell.html&amp;title=Get%20List%20of%20Installed%20Windows%20Updates" id="wpa2a_6"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2011/09/get-list-of-installed-windows-updates-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use KMS server across Active Directory Forests</title>
		<link>http://www.rivnet.ro/2011/08/how-to-use-kms-server-across-active-directory-forests.html</link>
		<comments>http://www.rivnet.ro/2011/08/how-to-use-kms-server-across-active-directory-forests.html#comments</comments>
		<pubDate>Wed, 31 Aug 2011 16:57:25 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Desktops and Laptops]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[KMS cross forest]]></category>
		<category><![CDATA[KMS DNS Record]]></category>
		<category><![CDATA[KMS Host]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=527</guid>
		<description><![CDATA[Recently I made a slight career change and also with it came a small challenge. We were given 2 Active Directory Forests, one was actively being used and the other one had very few users, but was going to get much larger very quick. People were also deploying Windows 7, Windows 2008 R2 and Office [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I made a slight career change and also with it came a small challenge. We were given 2 Active Directory Forests, one was actively being used and the other one had very few users, but was going to get much larger very quick. People were also deploying Windows 7, Windows 2008 R2 and Office 2010. All of these products canuse KMS license keys, which basically means you have one Key Management Service Server in your organization to which all Windows and other MS products refer to for validating their license periodically. That server must have a valid Windows License, which gets activated to the Internet, then you just enable that server as a KMS host Server. Enough with the background, you can read more about deploying a KMS server <a href="http://technet.microsoft.com/en-us/library/dd772269.aspx" target="_blank">here</a>.</p>
<p>Now back to the problem at hand. Since the 2 organizations to whom the 2 forests belonged to had pretty loose security requirements, we wanted to save us the hassle of creating and managing a second KMS server, and just using the KMS server we had available. KMS is also not so restrictive when it comes to accepting license validation requests.</p>
<p>KMS clients have 2 ways in which they determine where the KMS service is located (i will use contoso.com as the &#8220;main&#8221; forest for this example):</p>
<ul>
<li><strong>Specify it m</strong><strong>anually using a built in windows command line script</strong>. For example to specify the kms.contoso.com server for a machine just run from administrator command prompt this command:</li>
</ul>
<pre class="brush: powershell; title: ; notranslate">cscript %windir%\system32\slmgr.vbs /skms kms.contoso.com:1688</pre>
<ul>
<li>Windows uses DNS to determine the KMS servers (pretty much like Windows does to determine which servers offer AD Authentication). When KMS host is installed in creates an SRV record in the DNS in _.tcp.contoso.com. This record looks like this:</li>
</ul>
<p style="padding-left: 60px;">ServiceName: _vlmcs</p>
<p style="padding-left: 60px;">Port: 1688 (default)</p>
<p style="padding-left: 60px;">Host offering the service: kms.contoso.com</p>
<p style="padding-left: 60px;">The Final srv record looks like this: _vlmcs._tcp.contoso.com</p>
<p>As you can see there is not so much rocket science in the way a KMS host is published in DNS. Also there is no requirement that the computer trying to validate a license against KMS be joined to a domain. All the computer needs does is a srv DNS query to determine where the KMS licensing host is. Based on this information it talks to KMS and validates the licenses.</p>
<p>So to make sure computers in forest <strong>rivnet.org</strong>, for example, can find KMS in DNS do following:</p>
<p>1. Create a new A Record for the IP address of the KMS server kms.contoso.com, in rivnet.org DNS, for example <strong>kms.rivnet.org</strong></p>
<p>2. Create a new SRV Type record in _tcp.rivnet.org DNS, with following details</p>
<p style="padding-left: 30px;">ServiceName: _vlmcs</p>
<p style="padding-left: 30px;">Port: 1688 (default)</p>
<p style="padding-left: 30px;">Host offering the service: kms.rivnet.org</p>
<p>The Final srv record looks like this: _vlmcs._tcp.rivnet.org</p>
<p>You can do all this by using dnscmd (available in Windows7/2008) run this command:</p>
<pre class="brush: powershell; title: ; notranslate">dnscmd &lt;DNSServerName&gt; /RecordAdd &lt;ZoneName&gt; _vlmcs._tcp.&lt;ForestName&gt; SRV 0 100 1688</pre>
<p>3. Test from a client computer that the SRV record is available in DNS, by running this on a command prompt:</p>
<pre class="brush: powershell; title: ; notranslate">nslookup -type=srv _vlmcs._tcp.rivnet.org</pre>
<p>You should get an output that points to the DNS record you created in step 1.</p>
<p>4. Test the client computer can validate his license to the KMS host by running this command from an elevated command prompt:</p>
<pre class="brush: powershell; title: ; notranslate">cscript %windir%\system32\slmgr.vbs /ato

cscript %windir%\system32\slmgr.vbs /dli</pre>
<p>There should be a line like this:</p>
<p style="padding-left: 30px;"><em>KMS machine name from DNS: kms.rivnet.org:1688</em></p>
<p>And that&#8217;s it with using KMS from any other forest in your own AD. In short:</p>
<p>1. Add Host record for KMS host</p>
<p>2. Add SRV record for KMS host</p>
<p>3. Attempt activation, verify activation was done using KMS host.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2011%2F08%2Fhow-to-use-kms-server-across-active-directory-forests.html&amp;title=How%20to%20use%20KMS%20server%20across%20Active%20Directory%20Forests" id="wpa2a_8"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2011/08/how-to-use-kms-server-across-active-directory-forests.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things to keep in mind about Snapshots</title>
		<link>http://www.rivnet.ro/2011/01/things-to-keep-in-mind-about-snapshots.html</link>
		<comments>http://www.rivnet.ro/2011/01/things-to-keep-in-mind-about-snapshots.html#comments</comments>
		<pubDate>Sat, 29 Jan 2011 12:59:56 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[VMWARE]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[datastore sizing]]></category>
		<category><![CDATA[snapshots]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vmx]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=445</guid>
		<description><![CDATA[Some time ago I setup a VMWare environment, and I was involved in sizing and design decisions. I did a lot of reading about how to size the VMFS datastores how many VMDKs per datastore, how to calculate appropriate size. Everyone on the web mentioned you have to take into account snapshot size, so I [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago  I setup a VMWare environment, and I was involved in sizing and design decisions. I did a lot of reading about how to size the VMFS datastores how many VMDKs per datastore, how to calculate appropriate size. Everyone on the web mentioned you have to take into account snapshot size, so I did (for a good read on snapshots try this <a href="http://blogs.vmware.com/vipowershell/2010/09/snapshot-size.html" target="_blank">post</a> by VMWare). I split VMFS datastores according to roles (Logs, Database, OS, swap) and accounted for a snapshot allowance for each datastore.</p>
<p>Fastforward 3 months later and a couple of snapshot VMs and I do a usage report on the datastores to notice something I didn&#8217;t expect. I used the VMware vCenter reporting features to get a disk usage (which are pretty sweet by the way). I was amazed the report said <strong>zero space</strong> used for snapshots (although those VMs had snapshots and VDMKs on the datastores). I cycled through the Datastores and found where the snapshots were stored. They were stored on the Datastore where the OS was found, same where the config file was located, then I looked it up in the documentation and found this:</p>
<ul>
<li>
<h4><span style="font-size: small;">The default location for snapshots of Virtual Machines is their Working Directory.</span></h4>
</li>
<li>
<h4><span style="font-size: small;">The default Working Directory is the datastore where the Configuration File (.vmx) of the VM is stored.</span><em><span style="font-size: small;"><strong> </strong></span></em></h4>
</li>
</ul>
<p>Wow, that was unexpected, for me at least since that meant I undersized my OS datastore a little. So this question haunted me, ok, how to change this setting in dire situations, when you want to avoid VMs crashing because your datastore is out of space. I then did more research and discovered this:</p>
<ul>
<li>
<h4><span style="font-size: small;">Default Working Directory can be changed if you change the VMX file using </span><span style="font-size: small;">by adding/changing <em><strong>this line: workingDir=&#8221;path/path/&#8221;</strong></em></span><span style="font-size: small;"> </span></h4>
</li>
<li>
<h4><span style="font-size: small;">Doing so will ALSO change the location of your .vswp file (the swap file created by vSphere) to the location specified by &#8220;WorkingDir&#8221;</span></h4>
</li>
</ul>
<p><span style="font-size: small;">According to <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1004082" target="_blank">this</a> article you can also specify the location of the swap file within the VMX by adding this line:</span> <strong>sched.swap.dir = &#8220;/vmfs/volumes/Volume1/VM/&#8221;</strong>. However this setting or adding the workingdir to the configuration file will take effect over the &#8220;Store Virtual Machine Swap file in location specified by the Host&#8221; option (on the logic that VM settings take precedence over host settings, unless defaults are used for VM &#8211; please correct me if wrong)</p>
<p>The consequence of this is that you no longer define swap file storage at host level (which was pretty easy because you have much fewer hosts) instead you define it at VM level (which you may have in the hundreds). Taking this further you&#8217;d probably have to use powershell to set this easily&#8230;and have this thorougly documented for each VM.</p>
<p>You can see how from something relatively benign changing defaults for Snapshots turns into quite an administrative burden. Then you have to balance administrative burden vs reisizing datastores.</p>
<h3>Datastore sizing &#8211; revisited</h3>
<p>Now with this information the way datastores are sized get a little more complex. Prior to me knowing about this I read what really smart and knowledgeable people had to say about about datastore sizing and it went a little like this:</p>
<p><strong>(Avg VM * #VMs ) * (100% + (Snapshot Allowance) + 10% Reserve) </strong></p>
<p>Snapshot allowance was 10-20%.</p>
<p>Now that is great for datastores that hold the entire VM inside it, I wanted to separate I/O you have to create multiple datastores and each VM can have more than 1 VMDK the math above applies to a single type of Datastore (e.g. for a Dastore for DB vdmks)</p>
<p><strong>(Avg DB VMDK * #VMDKs</strong><strong> ) * (100% + (Snapshot Allowance) + </strong><strong>10%Reserve</strong><strong>) </strong></p>
<p><strong><br />
</strong></p>
<p>In light of my recent discovery about snapshots, the math changes yet again, <span style="text-decoration: underline;">the sizing would be:</span></p>
<p><strong>(AvgVMDK * #VMDKs</strong><strong>) * (100% + 10% Reserve)</strong></p>
<p>Now assuming you store the VMDK where you store your OS VDMDK sizing<strong> this DataStore</strong> changes as follows:</p>
<p><strong><span style="font-size: x-large;"> </span>(AvgVDMK * #VMDKs</strong><strong>) * <strong>(100% + 10%Reserve)+(Other Datastores [db,app,log,swap]) <span style="font-size: xx-large;"><span style="font-size: x-large;"> </span><span style="font-size: small;">+ <span style="font-size: large;">Snapshot Allowance</span></span></span></strong></strong></p>
<p>Where Snapshot Allowance is now sized different:</p>
<p><strong>Snapshot Allowance = (OS Datastore Size + DB/App/Log/Swap Datastore Size) * (10-20%)</strong></p>
<p><strong><br />
</strong></p>
<p>In essence if no VMware snapshot defaults are changed and snapshots will be used (they are found in a lot of processes within VMware &#8211; backup solutions, VDI, development, patch management of guests) the space occupied by these snapshots is important and it is also <strong>important where snapshots consume this space from</strong>. Whatever the design, it must include some form or &#8220;snapshots space management&#8221; to use some fancy words for it. Any comments or different angles on this are welcome as usual.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2011%2F01%2Fthings-to-keep-in-mind-about-snapshots.html&amp;title=Things%20to%20keep%20in%20mind%20about%20Snapshots" id="wpa2a_10"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2011/01/things-to-keep-in-mind-about-snapshots.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change vSphere Service Console IP</title>
		<link>http://www.rivnet.ro/2010/12/change-vsphere-service-console-ip.html</link>
		<comments>http://www.rivnet.ro/2010/12/change-vsphere-service-console-ip.html#comments</comments>
		<pubDate>Sun, 19 Dec 2010 08:01:10 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[High Availability]]></category>
		<category><![CDATA[VMWARE]]></category>
		<category><![CDATA[vSphere]]></category>
		<category><![CDATA[Service Console]]></category>
		<category><![CDATA[VMware HA]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=418</guid>
		<description><![CDATA[Now I get a chance to write an article I&#8217;ve been meaning to about something I&#8217;ve run into while working with vSphere 4.1. Initially I&#8217;ve called it a &#8220;bug&#8221;" (may have said on twitter I guess), now I&#8217;m starting to think &#8220;it serves me right&#8221; in a way. It is about what happens when you [...]]]></description>
			<content:encoded><![CDATA[<p>Now I get a chance to write an article I&#8217;ve been meaning to about something I&#8217;ve run into while working with vSphere 4.1. Initially I&#8217;ve called it a &#8220;bug&#8221;" (may have said on twitter I guess), now I&#8217;m starting to think &#8220;it serves me right&#8221; in a way. It is about what happens when you want to change the vSphere Service Console IP, of a host that is already in a cluster. Here&#8217;s the history:</p>
<ul>
<li>3 Hosts configured in a cluster. After some weeks it was decided that we had to change the IP&#8217;s and vLAN , to make room for some other vLANs that needed room to grow.</li>
<li>No problem, get the new IP&#8217;s, talk to the network guys to trunk the ports on the physical hosts and reconfigure switches to make sure that traffic can talk to our vCenter Server.</li>
<li>Google for how to change the Service Console IP&#8230;.5 minutes later Google for how to change also the vLAN ID of the Service Console. So for <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=4309499" target="_blank">changing the IP</a> and  <a href="http://www.geekshangout.com/?q=node/17" target="_blank">vLAN</a> these are 2 good places to start.
<ul>
<li>Place host in maintenance mode (while still in cluster &#8211; we chose to not remove it or delete the cluster since we had resource pools configured)</li>
<li>Make all the change (IP, gateway, hosts file)</li>
<li>Test settings (ping, nslookup)</li>
<li>Now once all hosts are reconfigured properly we update each host hosts file with the updated IP/hostname entries for the other nodes in a cluster.</li>
</ul>
</li>
<li>Obviously when I took each host out of maintenance mode our clusters would not work, to be expected.</li>
<li>Now&#8230;let&#8217;s reconfigure vSphere Cluster since it was not a proper cluster anymore. Reconfigure cluster finishes &#8220;Successfully&#8221;(task took longer than we expected it to), everything seems great.</li>
</ul>
<p>Fast forward a few days later, I do a routine configuration check of the systems and our cluster starts to throw &#8220;HA agent misconfigured errors&#8221;. I discover although I updated the hosts file on vSphere, the OLD ip addresses were still there. I mean there was a mix of the old settings and new settings. I start asking my colleagues if anyone made any changes, but no one had done anything. After some troubleshooting (which included a file level search for files where that IP may be listed on the vSphere host) I concluded this:</p>
<p><span style="font-size: small;"><span style="font-size: medium;">&#8220;When you try to <em>reconfigure the IP address </em>of a host that is in a cluster, and then you <em>Reconfigure the cluster for HA</em>, somewhere (maybe vCenter DB) information about the IP&#8217;s of the hosts is stored, <strong>as they were joined to the Cluster initially</strong>! Therefore any cluster reconfiguration of hosts with new IP&#8217;s will get a mix of old IP and new IP in the <strong>/etc/hosts</strong> file and possibly <em>Reconfigure for HA Errors</em>&#8221;<br />
</span></span></p>
<p><span style="font-size: small;"><span style="font-size: medium;">To fix this, obviously we disabled HA, disbanded the cluster and recreated it back again.</span><br />
</span></p>
<h3>The right way to change vSphere Service Console IP</h3>
<p>In light of these issues these are the steps to properly change the IP address of a host:</p>
<ol>
<li>If host is in a cluster, remove it from the cluster.</li>
<li>Put host in maintenance mode.</li>
<li>Disconnect from vCenter</li>
<li>Login to physical (or remote KVM) console and change IP settings. Change the gateway by editing /etc/sysconfig/network so that the <strong>GATEWAY</strong> line is pointing to your new gateway. Change the IP using these commands.</li>
</ol>
<pre class="brush: bash; title: ; notranslate">esxcfg-vswif -i &lt;new IP &gt; -n &lt;new Mask&gt; vswif0
esxcfg-vswitch vSwitch0 -p &lt;port group Name&gt; -v &lt;VLAN ID&gt;
esxcfg-vswif -s vswif0
esxcfg-vswif -e vswif0</pre>
<p>5. Ping your reconfigured host to see all is working properly.</p>
<p>6.Rejoin host to the cluster, reconfigure for HA (let HA reconfigure your hosts file instead of manual changing it). Enjoy not having to worry about cluster issues <img src='http://www.rivnet.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>A colleague of mine also wrote this &#8220;interactive script&#8221; that prompts you for required information for changing all these settings, I&#8217;m a bit LSI (Linux Shell Impaired).</p>
<pre class="brush: bash; title: ; notranslate">#!/bin/sh
echo &quot;New IP :&quot;
read new_ip
echo &quot;New Mask:&quot;
read new_mask
echo &quot;New Gw:&quot;
read new_gw
echo &quot;New vlan:&quot;
read new_vlan
sed -i &quot;s/`cat /etc/sysconfig/network |grep GATEWAY=|cut -d = -f 2`/$new_gw/g&quot; /etc/sysconfig/network

esxcfg-vswif -i $new_ip -n $new_mask vswif0
esxcfg-vswitch vSwitch0 -p &quot;Service Console&quot; -v $new_vlan

esxcfg-vswif -s vswif0
esxcfg-vswif -e vswif0</pre>
<p>I hope you enjoyed the read, and remember:</p>
<p><strong>If you need to change the IP of a host in a cluster&#8230;.remove it from the cluster first, saves yourself some time and braincells.</strong> Comments and critique are welcome, as usual.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2010%2F12%2Fchange-vsphere-service-console-ip.html&amp;title=Change%20vSphere%20Service%20Console%20IP" id="wpa2a_12"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2010/12/change-vsphere-service-console-ip.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dismount Recovery Storage Group using Exchange 2007 Shell</title>
		<link>http://www.rivnet.ro/2010/11/dismount-recovery-storage-group-using-exchange-2007-shell.html</link>
		<comments>http://www.rivnet.ro/2010/11/dismount-recovery-storage-group-using-exchange-2007-shell.html#comments</comments>
		<pubDate>Sun, 14 Nov 2010 22:02:10 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Mailbox Recovery]]></category>
		<category><![CDATA[Management Shell]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[data recovery]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange Management Shell]]></category>
		<category><![CDATA[Recovery Storage Group]]></category>
		<category><![CDATA[RSG]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=413</guid>
		<description><![CDATA[Dismounting the RSG from and Exchange Mailbox server is the last step after you have recovered data you needed. I would like to stress here that my experience tells me this is the step when you will encounter issues, not necesarily issues with the process itself but mostly with the GUI interface. I&#8217;ve spent a [...]]]></description>
			<content:encoded><![CDATA[<p>Dismounting the RSG from and Exchange Mailbox server is the last step after you have recovered data you needed. I would like to stress here that my experience tells me this is the step when you will encounter issues, not necesarily issues with the process itself but mostly with the GUI interface. I&#8217;ve spent a lot of time trying to figure out which a RSG won&#8217;t dismount, when the GUI reported success. So I have come up with a script that does this using exchange management shell, which gives you a little more control and additional debugging information.</p>
<p>Here is what you will need to accomplish this:</p>
<ul>
<li>Exchange Server Administrator Rights where the RSGs are located.</li>
<li>Exchange Management Shell since this entire procedure is best done using powershell scripting.</li>
<li>Run the script as Administrator to avoid errors due to enabled UAC</li>
</ul>
<h3>The Script</h3>
<pre class="brush: powershell; title: ; notranslate">#Dismount DB, Remove, DB, Remove Storage Group
$DB_in_RSG = Get-MailboxDatabase -Server &lt;ENTERSERVER&gt; | where {$_.Recovery -like '*true*'}
Write-Host -ForegroundColor Green &quot;The Database in the RSG ($($DB_in_RSG.Name)) will be Dismounted. Press Ctrl+C to cancel or Enter to continue&quot;
Read-Host
$DB_in_RSG | Dismount-Database -Verbose -Debug

Write-Host -ForegroundColor Green &quot;The Database in the RSG will be Removed. Press Ctrl+C to cancel or Enter to continue&quot;
Read-Host
$DB_in_RSG | Remove-MailboxDatabase -Verbose -Debug

#Now deleting the files of the database
$SG_Path = (Get-StorageGroup $DB_in_RSG.StorageGroup).SystemFolderPath
Write-Host -ForegroundColor Green &quot;The actual DB files will be removed (stored in $SG_Path). Please check previous steps completed successfully before continuing. Press Ctrl+C to cancel or Enter to continue.&quot;
Read-Host
get-item $SG_Path | del -Force -Recurse -Verbose -Debug

#Now removing storage group
Write-Host -ForegroundColor Green &quot;The RSG will be Removed. Press Ctrl+C to cancel or Enter to continue&quot;
Read-Host
Remove-StorageGroup -Identity $DB_in_RSG.StorageGroup -Verbose –Debug</pre>
<h3>Learning Points</h3>
<p>There are a few steps you need to do:</p>
<ol>
<li>Grab the RSG (there is only one per server) &#8211; stored in the script in <strong>$DB_in_RSG</strong></li>
<li>You dismount the database from the server using <strong>Dismount-Database</strong> cmdlet.</li>
<li>After disomunting the database you remove the Database using <strong>Remove-MailboxDatabase</strong> cmdlet. This will just remove the DB from Exchange, the files will remain on the file system.</li>
<li>The actual files on the file system get removed using the path from variable <strong>$SG_Path.</strong> Use <strong>del</strong> cmdlet with <strong>-force -recurse</strong> to bypass any confirmation prompts.</li>
<li>The last step is removing the Recovery Storage Group from the Exchange. The commandlet for this is <strong>Remove-StorageGroup</strong>.</li>
</ol>
<p>That&#8217;s about it, pretty easy actually. Although this script is the last in the series I reccomend you actually run this before anything, before mounting the RSG or at least do a check to see if a RSG is already mounted.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2010%2F11%2Fdismount-recovery-storage-group-using-exchange-2007-shell.html&amp;title=Dismount%20Recovery%20Storage%20Group%20using%20Exchange%202007%20Shell" id="wpa2a_14"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2010/11/dismount-recovery-storage-group-using-exchange-2007-shell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restore a mailbox in the Recovery Storage Group</title>
		<link>http://www.rivnet.ro/2010/11/restore-a-mailbox-in-the-recovery-storage-group.html</link>
		<comments>http://www.rivnet.ro/2010/11/restore-a-mailbox-in-the-recovery-storage-group.html#comments</comments>
		<pubDate>Sun, 07 Nov 2010 17:48:10 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Mailbox Recovery]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Exchange Management Shell]]></category>
		<category><![CDATA[export-mailbox]]></category>
		<category><![CDATA[get-mailbox]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=421</guid>
		<description><![CDATA[Finally I managed to find some more time about posting the next bits of the Exchange mailbox recovery process. Last post we discussed how to mount the database into the RSG. This time we will be discussing how to restore a user&#8217;s mailbox in the original mailbox location and how to restore the mailbox data [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I managed to find some more time about posting the next bits of the Exchange mailbox recovery process. Last post we discussed how to mount the database into the RSG. This time we will be discussing how to restore a user&#8217;s mailbox in the original mailbox location and how to restore the mailbox data to another temporary mailbox and exporting that out of the temporary mailbox.</p>
<p>Here is what you will need to accomplish this:</p>
<ul>
<li>Exchange Server Administrator Rights where the mailbox(es) are located.</li>
<li>Full mailbox access for exporting emails out of the temp mailbox I was talking about</li>
<li>Exchange Management Shell since this entire procedure is best done using powershell scripting.</li>
<li>Obviously free space both on the Database disk aswell as disk space where the PST file will be saved.</li>
</ul>
<h3>The Script</h3>
<pre class="brush: powershell; title: ; notranslate">#Parameters Section
param (
 [parameter(Mandatory = $true)]
 [string]$paramRestoredUser
)

cls
#Restore mailbox section
$Filter = &quot;SamAccountName -like '$paramRestoredUser'&quot;
$SourceAlias = Get-Mailbox -Filter $Filter -IgnoreDefaultScope

If ($SourceAlias -eq $null) {
 Write-Host -foregroundcolor Red &quot;No Mailbox for SamAccountName $paramRestoredUser found.Script will quit&quot;
exit
 }

$RSG_DB = Get-MailboxDatabase -Server $SourceAlias.ServerName | where {$_.Recovery -like '*true*'}
if ($RSG_DB -eq $null) {
 Write-Host -ForegroundColor Red &quot;No RSG was found on $($SourceAlias.ServerName). Script will quit now!&quot;
 exit }

$TargetAlias = Get-Mailbox e2k7_Restore_MBX
Write-Host -ForegroundColor Green &quot;Input the date of the restored mailbox:&quot;
$RestoreDate = Read-Host

$TargetFolder = &quot;$($SourceAlias)_$RestoreDate&quot;
Restore-Mailbox -Identity $TargetAlias.Alias -RSGMailbox $SourceAlias.ExchangeGuid -RSGDatabase $RSG_DB -TargetFolder $TargetFolder -BadItemLimit 1000 -Verbose -Debug -Confirm -ValidateOnly

echo &quot;-ValidateOnly switch from the command above is removed. Please check no errors occured above and everything is configured properly. Press Enter to continue CTRL+C to cancel the script!&quot;
Read-Host
Restore-Mailbox -Identity $TargetAlias.Alias -RSGMailbox $SourceAlias.ExchangeGuid -RSGDatabase $RSG_DB -TargetFolder $TargetFolder -BadItemLimit 1000 -Verbose -Debug -Confirm

#building an excluded folders list, just in case we did another restore and the previous content was not deleted
$IncludedFolders = $TargetFolder
$ExclFoldersList = @()
$ExcludedFolders = Get-MailboxFolderStatistics $TargetAlias | where-object { $_.FolderPath -notlike &quot;*$($IncludedFolders)*&quot;} | Select-Object FolderPath | foreach-object {
 $ExclFoldersList += $_.FolderPath }
$ExclFoldersList = ([string]::join(&quot;,&quot;,$ExclFoldersList)).Replace(&quot;/&quot;,&quot;\&quot;)

$UserName = $TargetAlias
$PSTPath = &quot;Q:\UserPersonalFolders&quot;
&quot;Excluded folders list: $ExclFoldersList&quot;
Read-Host
export-Mailbox -Identity $UserName.SamAccountName -BadItemLimit 1000 -DeleteContent $True -PSTFolderPath $PSTPath -ExcludeFolders $ExclFoldersList</pre>
<h3>The details for the Script</h3>
<p>First the script gathers data about the restored mailbox, and from that info the Recovery Storage Group (<strong>$SourceAlias</strong>). It also needs a target mailbox, where the restored data will be stored (<strong>$TargetAlias</strong>) (needless to say I did in a &#8220;forest friendly way, using -Filter cmdlet looking up the given SamAccountName). The data will be moved from the mailbox in the RSG into the <strong>$TargetAlias</strong> mailbox. It will be placed in a folder, named with the date of the restored data (<strong>$RestoreDate</strong>). Restoring the data is done with this command:</p>
<pre class="brush: powershell; title: ; notranslate">Restore-Mailbox -Identity $TargetAlias.Alias -RSGMailbox $SourceAlias.ExchangeGuid -RSGDatabase $RSG_DB -TargetFolder $TargetFolder -BadItemLimit 1000 -Verbose -Debug -Confirm -ValidateOnly</pre>
<p>Now we want to export the data from the <strong>$TargetAlias</strong> into a PST file. This is easy to do via the <strong>Export-Mailbox </strong>cmdlet. The problem appears when you do for instance multiple exports in the same target mailbox and then a mass export, or just have left old data in the target mailbox. You do get data separated into folders, if your <strong>$TargetFolder</strong> name is unique, but the <strong>Export-Mailbox</strong> cmdlet cannot export data based on this information (it can only do some filtering (date,content,subject)  and I believe it is resource intensive). What Export-Mailbox does have is the  &#8220;<strong>-Excludefolders</strong>&#8221; parameter which lets you not export certain data.</p>
<p>The trick I came up with was to scan the <strong>$TargetAlias</strong> mailbox for foldernames (I used <strong>Get-MailboxFolderStatistics</strong> for that) and build a list of the folders that did not contain the value I entered in the  <strong>$TargetFolder</strong> variable upon restore. Besides that you also have to do some parsing of the output from get mailboxfolderstatistics into something <strong>Export-Mailbox</strong> understands. This is what I did:</p>
<pre class="brush: powershell; title: ; notranslate">$IncludedFolders = $TargetFolder
$ExclFoldersList = @()
$ExcludedFolders = Get-MailboxFolderStatistics $TargetAlias | where-object { $_.FolderPath -notlike &quot;*$($IncludedFolders)*&quot;} | Select-Object FolderPath | foreach-object {
 $ExclFoldersList += $_.FolderPath }
$ExclFoldersList = ([string]::join(&quot;,&quot;,$ExclFoldersList)).Replace(&quot;/&quot;,&quot;\&quot;)</pre>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 645px; width: 1px; height: 1px;">downtime romtelecom</div>
<p>In the end I just ran the Export-Mailbox on the target mailbox, specifying the excluded files and that was that.</p>
<p>The whole process is pretty easy, the actual restore is done in a one liner (Restore-Mailbox), but as you can see error checking and failproofing the script make up the rest of the work. Hope you enjoy this, next up is how to dismount a RSG, the scripted &#8220;clean-way&#8221;.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2010%2F11%2Frestore-a-mailbox-in-the-recovery-storage-group.html&amp;title=Restore%20a%20mailbox%20in%20the%20Recovery%20Storage%20Group" id="wpa2a_16"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2010/11/restore-a-mailbox-in-the-recovery-storage-group.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restoring mailboxes in Exchange 2007 (part 1)</title>
		<link>http://www.rivnet.ro/2010/07/restoring-a-mailbox-in-exchange2007-part-1-of-3.html</link>
		<comments>http://www.rivnet.ro/2010/07/restoring-a-mailbox-in-exchange2007-part-1-of-3.html#comments</comments>
		<pubDate>Thu, 15 Jul 2010 20:30:01 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Mailbox Recovery]]></category>
		<category><![CDATA[MS Exchange 2007]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[data recovery]]></category>
		<category><![CDATA[Exchange 2007]]></category>
		<category><![CDATA[Recovery Storage Group]]></category>
		<category><![CDATA[RSG]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=419</guid>
		<description><![CDATA[Lately I&#8217;ve been doing a number of mailbox restore procedures on Exchange 2007, so I thought it would be a good idea to make my own posts about it (yes it involves scripting), because things are not always as straightforward as MS or TechNet say it is. This is going to be a multi-part post: [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been doing a number of mailbox restore procedures on Exchange 2007, so I thought it would be a good idea to make my own posts about it (yes it involves scripting), because things are not always as straightforward as MS or TechNet say it is. This is going to be a multi-part post: Create the RSG and mount the DB to be restored, Restore mailbox(es), Remove the restored DB and RSG. Before you think about it I&#8217;m going to answer it for you:</p>
<p style="padding-left: 30px;">Q: But why don&#8217;t we use the nice GUI Tool from Exchange Management Console (Extra.exe) and do it from there, &#8220;we don&#8217;t need no scripting&#8221;?</p>
<p style="padding-left: 30px;">A: My experience tells me the scripted method is safer and works &#8220;as expected&#8221; unlike the GUI, which says it did something, when it didn&#8217;t (I&#8217;ve spent days trying to figure out why a RSG Database won&#8217;t actually dismount when the GUI said: &#8220;Completed Successfully&#8221;.</p>
<p>OK, let&#8217;s get on with it. All that I am about to explain requires <strong>Exchange Administrator</strong> privileges on the Exchange servers.</p>
<p>We will be creating a Recovery Storage Group, this is the first step in the restore process. To create the RSG you need following:</p>
<ul>
<li>Adequate disk-space to restore the mailbox database, locally on the Exchange Server where the DB was residing</li>
<li>Exchange Management Shell running as Administrator (especially on CCR clusters)</li>
<li>No other Recovery Storage Group already created on that server with an existing RSG database (you can only have 1 RSG with 1 DB in the RSG). It is best to remove any previous RSG completely then recreate it for your needs.</li>
<li>Specific information like which DB to link to the RSG and the list of mailboxes to restore.</li>
</ul>
<p>Creating a Recovery Storage Group can be as easy as this:</p>
<pre class="brush: powershell; title: ; notranslate">New-StorageGroup -Server &lt;MBX Role Server Name&gt; -Name &lt;StorageGroup Name&gt; -LogFolderPath &lt;Logs Folder&gt; -SystemFolderPath &lt;SystemFiles Path&gt; -Recovery -Verbose</pre>
<p>The command is very similar to creating a new SG, except for the <em>-Recovery</em> switch, designating it as a Recovery Storage Group. I added the -Verbose switch so you can see what is going on behind the scenes.</p>
<pre class="brush: powershell; title: ; notranslate">New-MailboxDatabase -MailboxDatabaseToRecover &lt;Mailbox Name&gt; -StorageGroup &lt;Recovery Storage Group Name&gt; -EdbFilePath &lt;path to store edb file&gt; -Verbose</pre>
<p>Here it is just as easy as creating a new mailbox database, only you are creating it in the recovery storage group you created with the previous command. The <strong>key </strong>thing to remember here is that the value of the &#8220;MailboxDatabaseToRecoverParameter&#8221; must be the exact same name of the mailboxDB of which you want to recover from. <strong>If the name is different</strong> you will not be able to run any restore commands, because it will not be able to find any mailboxes when it searches the recovered database.</p>
<h3>A working script for creating the RSG</h3>
<p>Below I&#8217;m sharing with you a working snippet that should help in creating a recovery storage group and DB. In short here is what the code does:</p>
<p>Using a given UserPrincipalName&#8230;</p>
<ul>
<li>Attempts to retrieve the mailbox for the UPN (it is a &#8220;forest friendly&#8221; coding for retrieving the mailbox). If it fails it quits</li>
<li>Checks if a folder structure for placing, logs, system files and the edb file exists (I used a location called d:, use a variable if you like).</li>
<li>If folders already exist, it will quit, otherwise it will create a folder with the MDB name, and logs and edb subfolders,</li>
<li>Next it checks if a Recovery Storage Group already exists, unless you cancel the script it will continue to use this RSG, with the given details. Otherwise it will create a RSG on its own.</li>
<li>It will then create a mailbox database where you / your backup admin will restore your exchange backup.</li>
</ul>
<pre class="brush: powershell; title: ; notranslate">﻿$MBX_UPN = Read-Host
$Filter = &quot;UserPrincipalName -like '$MBX_UPN'&quot;
$SourceMBX =  get-mailbox -IgnoreDefaultScope -Filter $Filter
If ($SourceMBX -eq $null) {
	Write-Host -foregroundcolor Red &quot;No Mailbox for $MBX_ID found`nScript will Quit&quot;
	exit }
Write-Host -ForegroundColor Green &quot;Source Mailbox is`n $SourceMBX&quot;

$LinkedMDB = Get-MailboxDatabase -Identity $SourceMBX.Database
Write-Host -ForegroundColor Green &quot;Ok, Database ($($LinkedMDB.StorageGroup.Name)) is grabbed, now creating RSG Folders and RSG`nPress Enter to continue or Ctrl+C to Cancel&quot;
Read-Host

#Checking if the RSG folders already exist, if not attempt to create them
If ((Test-Path &quot;d:\$($LinkedMDB.StorageGroup.Name)&quot;)) {
 Write-Host -ForegroundColor Red &quot;Folder already exists. Please remove d:\$($LinkedMDB.StorageGroup.Name) before running this script again.`nScript will quit&quot;
 exit
 }
$SysPath = New-Item -Type Directory -Path d: -Name $LinkedMDB.StorageGroup.Name | Get-Item
If ((Test-path $SysPath)) {
 $DBPath = New-Item -Type Directory -Path $SysPath -Name DB | Get-Item
 $LogsPath = New-Item -Type Directory -Path $SysPath -Name Logs | Get-Item
 }
#If folders were created successfully we can continue
If ((Test-path $SysPath) -and (Test-path $DBPath) -and (Test-path $LogsPath)) {
 #Checking if RSG already exists
$RSG_check = Get-StorageGroup -Server $LinkedMDB.ServerName | where {$_.Recovery -like &quot;True&quot;}
 If ($RSG_check -ne $null) {
 Write-Host -ForegroundColor Magenta &quot;A RSG was found on $($RSG_check.ServerName). Here are RSG Details:&quot;
 $RSG_Check | select-object Name,Identity,Recovery,LogFolderPath,SystemFolderPath | fl
 Write-Host -ForegroundColor Magenta &quot;To use this RSG Press Enter, to cancel Press Ctrl+C&quot;
 Read-Host
 }
 Else {
 Write-Host -ForegroundColor Green &quot;Now creating Recovery Storage Group...&quot;
 New-StorageGroup -Server $LinkedMDB.Server -Name &quot;Recovery Storage Group&quot; -LogFolderPath $LogsPath.FullName -SystemFolderPath $SysPath.FullName -Recovery -Verbose
 }
 Write-Host -ForegroundColor Green &quot;OK! No RSG found. Now creating RSG Database...&quot;
 New-MailboxDatabase -MailboxDatabaseToRecover $LinkedMDB.AdminDisplayName -StorageGroup &quot;$($LinkedMDB.ServerName)\Recovery Storage Group&quot; -EdbFilePath &quot;$($DBPath.FullName)\$($LinkedMDB.Name).edb&quot; -Verbose
 }
Else {
 Write-Host -ForegroundColor Red &quot;Could not Create folder or folder structure in d:\$($LinkedMDB.StorageGroup.Name). Check messages above for errors! Script will quit.&quot;
 exit
 }</pre>
<p>This is about it with creating a Recovery Storage Group, it is actually not difficult, just remember to name the MDB inside the RSG with the same name as the source MDB (this was also required on Exchange 2003, as far as I know). Also you cannot have more than one RSG per Maibox Server, it is best to remove any RSG you have after you are finished recovering data. Next post we will discuss how to restore data from a MDB and how to remove the RSG.</p>
<p>As always I value your feedback and hope you found this post useful.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2010%2F07%2Frestoring-a-mailbox-in-exchange2007-part-1-of-3.html&amp;title=Restoring%20mailboxes%20in%20Exchange%202007%20%28part%201%29" id="wpa2a_18"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2010/07/restoring-a-mailbox-in-exchange2007-part-1-of-3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix High Hardware Interrupts on HP Probook 6540b</title>
		<link>http://www.rivnet.ro/2010/05/fix-high-hardware-intrerupts-on-hp-probook-6540b.html</link>
		<comments>http://www.rivnet.ro/2010/05/fix-high-hardware-intrerupts-on-hp-probook-6540b.html#comments</comments>
		<pubDate>Thu, 27 May 2010 18:57:58 +0000</pubDate>
		<dc:creator>Ionut Nica</dc:creator>
				<category><![CDATA[Desktops and Laptops]]></category>
		<category><![CDATA[Drivers]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[driver hacking]]></category>
		<category><![CDATA[Hp Probook]]></category>
		<category><![CDATA[Storage Drivers]]></category>

		<guid isPermaLink="false">http://www.rivnet.ro/?p=401</guid>
		<description><![CDATA[A few days back I discovered an &#8220;issue&#8221; with new installation of Windows XP on HP Probook 6540b laptops (have read reports on the internet about 6440b behaving the same). What I noticed is that after installing all the drivers from the HP website, computer appeared sluggish, especially disk operations, opening task manager was a [...]]]></description>
			<content:encoded><![CDATA[<p>A few days back I discovered an &#8220;issue&#8221; with new installation of Windows XP on HP Probook 6540b laptops (have read reports on the internet about 6440b behaving the same). What I noticed is that after installing all the drivers from the HP website, computer appeared sluggish, especially disk operations, opening task manager was a 5 second task. The solution to this problem was to obtain the latest disk controller drivers from the Intel Website and then install a specific controller type, instead of letting Windows choose automatically. But first, time for this small disclaimer:</p>
<p><span style="text-decoration: underline;"><em><strong>The steps below should be attempted after you have backed up your Windows installation and/or relevant documents, please do not attempt this procedure before doing a backup of your system. Double, triple, quadruple check that the problems I am describing here exactly match your hardware, software and symptoms observed. This procedure can damage your operating system, possibly even the hardware, this post comes with no warranties, it is not supported by HP, Intel or any other vendor as far as I know. Also this post is valid at the time of writing, new fixed drivers may appears by the time you are reading this, making it obsolete.<br />
</strong></em></span></p>
<h3>Symptoms and Conditions</h3>
<ul>
<li>Sluggish Disk performance</li>
<li>Sluggish computer performance when doing disk based operations</li>
<li>BIOS is configured to use IDE mode not AHCI mode for SATA disks (you configured for IDE because AHCI was not working)</li>
<li>Device Manager is showing a primary IDE channel device configured for PIO mode only &#8211; you cannot select UDMA mode</li>
<li>Using SysInternals Process Explorer reveals 25% CPU is  Hardware Interrupts when accessing disk continuously (on an i5 cpu that is 1 core&#8230;spread over all 4  cores). Interrupts usage goes down when disk is idle.</li>
<li>Your storage controllers are detected as:
<ul>
<li>&#8220;Intel(R) 5 Series/3400 Series Chipset Family 2 port Serial ATA  Storage Controller&#8221;</li>
<li>&#8220;Intel(R) 5  Series/3400 Series Chipset Family 4 port Serial ATA  Storage Controller&#8221;</li>
</ul>
</li>
<li>The Storage Controllers detected above have Hardware ID&#8217;s:
<ul>
<li>PCI\VEN_8086&amp;DEV_<strong>3B2D</strong></li>
<li>PCI\VEN_8086&amp;DEV_<strong>3B2E</strong></li>
</ul>
</li>
</ul>
<h3>Trials and Errors</h3>
<p>As you can see starting from the High Hardware interrupts up to device  being put into PIO mode, it is clear that there is some driver issue  somewhere. What you can try and watch it fail:</p>
<ul>
<li>Delete disk controller devices then use scan for hardware changes so windows will reinstall drivers. After reboot you will see the problem still exists.</li>
<li>Delete disk controller devices then download latest Intel <a href="http://downloadcenter.intel.com/Detail_Desc.aspx?ProductID=2101&amp;DwnldID=18860&amp;lang=eng&amp;iid=dc_rss" target="_blank">drivers</a>, automatically choose which driver to install. After reboot you will see no changes, same device will be detected, same drivers installed.</li>
<li>Reinstall OS re-add drivers one by one, you will have the same problem.</li>
</ul>
<h3>The solution</h3>
<p>You need to manually select a device driver to install from the <a href="http://downloadcenter.intel.com/Detail_Desc.aspx?ProductID=2101&amp;DwnldID=18860&amp;lang=eng&amp;iid=dc_rss" target="_blank">driver</a> package for Intel&#8217;s Rapid Storage Technology (I think the former name for these drivers, in general, was Matrix Storage Manager). The problem is that the drivers that come with Windows can only use PIO Mode, and the driver package from Intel does not contain the Hardware ID&#8217;s you found above. The drivers do work, to get them to work you have to either:</p>
<ol>
<li>Manually install drivers selecting a specific device driver to install</li>
<li>Hack the driver files so they include your device ID&#8217;s (&#8220;hardcore&#8221;  option, try #1 before you go there <img src='http://www.rivnet.ro/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</li>
</ol>
<h3>Option 1 &#8211; Do a manual driver install</h3>
<p>This works mostly after you installed the operating system. here&#8217;s what you need to do exactly:</p>
<ul>
<li><strong>Download </strong>the driver package</li>
<li>Using Device Manager <strong>delete storage controllers</strong> from the laptop</li>
<li>In Device Manager click &#8220;<strong>Scan for hardware changes</strong>&#8220;, the New Hardware Wizard appears</li>
<li>Choose <strong>don&#8217;t search Windows Update</strong></li>
<li>Next choose &#8220;<strong>Install from specific location</strong>&#8220;</li>
<li>Next choose &#8220;<strong>Don&#8217;t search I will choose driver to install</strong>&#8220;</li>
<li>On the next screen <strong>click on &#8220;have disk&#8221; </strong>and point it to the <strong>location of the extracted driver files</strong>. <strong>Click OK </strong>to close driver <strong>selection</strong>. List will be populated with a bunch of devices</li>
<li>From the devices list select &#8220;<em><span style="text-decoration: underline;"><strong>Intel(R) 5 Series 6 Port SATA AHCI Controller</strong></span></em>&#8220;</li>
<li><strong>Click OK </strong>and correct drivers should install now. If you are asked to reboot, choose OK</li>
<li>After the reboot go into the <strong>BIOS, change SATA mode to AHCI.</strong> If you keep SATA mode to IDE your XP install will BSOD (the reason is you added SATA drivers to XP, and the controller talks IDE, if left unconfigured)</li>
<li>Now you should see that your <strong>devices are installed correctly </strong>and you have no more hardware interrupts. Also the Disk Controllers section in Device Manager looks different, fewer devices left there.</li>
</ul>
<h3>Option 2 &#8211; Hack the Driver files</h3>
<p>This option is useful if you want to make a driver package for an unattended installation or just want to have a set of drivers that will work &#8220;out of the box&#8221;. What we will do in short is <em>add a few lines of code to the files in the driver package, pointing the Hardware ID&#8217;s to the </em>&#8220;<em><span style="text-decoration: underline;"><strong>Intel(R) 5 Series 6 Port SATA AHCI Controller</strong></span></em>&#8221; we manually installed with Option 1. Here&#8217;s how to do it:</p>
<ul>
<li>Extract drivers to a folder, you should have these files inside among some other txt&#8217;s:
<ul>
<li>iaAHCI.cat,iaAHCI.inf,iaStor.cat,iaStor.inf,IaStor.sys,TXTSETUP.OEM</li>
</ul>
</li>
<li><strong>Open iaAHCI.inf file </strong>for editing and search at the end of the file for the &#8220;strings&#8221; section. Look for the string<em> &#8220;PCI\VEN_8086&amp;DEV_3B2F&amp;CC_0106.DeviceDesc</em>&#8221; which matches to the Intel 5 series 6 port controller . As you can see after the DEV_ follows &#8220;3B2F&#8221;, pretty similar to our Hardware ID&#8217;s:
<ul>
<li>PCI\VEN_8086&amp;DEV_3B2D</li>
<li>PCI\VEN_8086&amp;DEV_3B2E</li>
</ul>
</li>
<li>Before the DEV_3B2F line create 2 new lines where you duplicate the DEV_3B2F line, BUT you replace 3B2F with the last 4 characters from the other device ID&#8217;s (one line will have 3B2D the other 3B2E). The point is to have the Hardware ID&#8217;s of your controller point to the correct driver name.</li>
<li>Now we have to track any place in the document where &#8220;3B2F&#8221; appears and add the same text for Hardware ID&#8217;s 3B2F and 3B2E. The section you are looking for to add lines are in &#8220;<strong>[INTEL_HDC.ntx86]</strong>&#8220;, there is a line containing 3b2f, add 1 line for each Hardware ID.</li>
<li><strong>Save iaAHCI.inf and close it</strong></li>
<li>Update Disk Controller drivers by <strong>pointing Windows hardware wizard to your modifed .inf file<br />
</strong></li>
</ul>
<p>With this inf file Windows should be able to install the driver it needs without you having to select which driver to install from the list. The logic is that now Windows knows where to find the correct drivers, because the Hacked Intel Driver contains the device ID&#8217;s Windows is looking for.</p>
<h3>Option 2+, unattended installs</h3>
<p>This next section is about changing the TXTSETUP.OEM so you can do  unattended installations using this hacked INF file. You can follow the Intel guide to injecting drivers for &#8220;F6 Install&#8221;, but you need to change the TXTSETUP.OEM file that comes with this package. Do following:</p>
<ul>
<li><strong>From the driver package Open TXTSETUP.OEM </strong>for editing.</li>
<li>In the iaAHCI.inf section look for the &#8220;Intel(R) 5 Series 6 Port SATA AHCI Controller&#8221;. To the left of that string is the text &#8220;iaAHCI_5_1&#8243;.</li>
<li>Do a search for the string &#8220;iaAHCI_5_1&#8243; in the document, you should find a section called &#8220;[HardwareIds.scsi.iaAHCI_5_1]&#8220;.</li>
<li>When found copy it and the line after it ( looks like &#8220;id = &#8220;PCI\VEN_8086&amp;DEV_3B2F&amp;CC_0106&#8243;,&#8221;iaStor&#8221;") 2 times. The 2 copies you can change instead of being 3B2F to 3B2D and 3B2E respectively.</li>
<li>In the end you should have 3 &#8220;hardwareIDs&#8221; sections, 1 with 3B2F, the original and the other 2 Hardware ID&#8217;s you need.</li>
<li>Save and close TXTSETUP.OEM.</li>
<li>Follow Intel&#8217;s &#8220;F6 install&#8221; procedure to deploy Windows XP using these modified files (all the files in the package + modded iaAHCI.inf and TXTSETUP.OEM)</li>
<li>You must configure BIOS to use AHCI mode, drives will not work with IDE mode (didn&#8217;t for me)</li>
</ul>
<p>Phew, this was a long and &#8220;hard&#8221; post. I hope the general idea is clear:</p>
<p>For installing from windows just make sure to select the controller I mentioned (the 6 port device) when doing the complete manual install.</p>
<p>For the hacked inf and OEM files double check and triple check the changes you are making. the point is to add the HW ID&#8217;s to the INF file, so it will install the drivers the same way as for the Hardware ID ending with 3B2F.</p>
<p>My best guess is that this mess-up is due to some slightly different versions or ID&#8217;s being stamped erroneous onto the controllers when they were shipped. I hope this was helpful, please report back any mistakes you notice.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.rivnet.ro%2F2010%2F05%2Ffix-high-hardware-intrerupts-on-hp-probook-6540b.html&amp;title=Fix%20High%20Hardware%20Interrupts%20on%20HP%20Probook%206540b" id="wpa2a_20"><img src="http://www.rivnet.ro/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.rivnet.ro/2010/05/fix-high-hardware-intrerupts-on-hp-probook-6540b.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

