<?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>Jonathan Medd&#039;s Blog</title>
	<atom:link href="http://www.jonathanmedd.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jonathanmedd.net</link>
	<description>Scripting. Powershell, VMware, Windows, Active Directory &#38; Exchange. All that kind of stuff.....</description>
	<lastBuildDate>Mon, 17 Jun 2013 12:02:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>vCenter Certificate Automation Tool &#8211; what is &#8220;the Original Database Password&#8221;?</title>
		<link>http://www.jonathanmedd.net/2013/06/vcenter-certificate-automation-tool-what-is-the-original-database-password.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/vcenter-certificate-automation-tool-what-is-the-original-database-password.html#comments</comments>
		<pubDate>Mon, 17 Jun 2013 12:02:45 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere 5.1]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=3033</guid>
		<description><![CDATA[Having installed vCenter 5.1 U1a, it was time to replace certificates. Using the vCenter Certificate Automation Tool to replace self-signed SSL certificates with full certificates you will be taken through various menus to replace each certificate: When the time comes to replace the vCenter Server certificate, you will firstly be in Menu 4 and then selecting [...]]]></description>
				<content:encoded><![CDATA[<p>Having installed vCenter 5.1 U1a, it was time to replace certificates. Using the vCenter Certificate Automation Tool to replace self-signed SSL certificates with full certificates you will be taken through various menus to replace each certificate:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert2.png"><img class="aligncenter size-full wp-image-3034" alt="ReplacevCenterCert2" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert2.png" width="574" height="163" /></a></p>
<p>When the time comes to replace the vCenter Server certificate, you will firstly be in Menu 4 and then selecting Option 2, <strong>Update the vCenter Server SSL Certificate</strong> (starting to sound like a dreaded phone call to a utilities or government call centre yet? It&#8217;s almost as painful):</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert1.png"><img class="aligncenter size-full wp-image-3036" alt="ReplacevCenterCert1" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert1.png" width="544" height="128" /></a></p>
<p>One of the questions prompted by selecting this option is <strong>&#8220;Enter the vCenter Server original database password&#8221;</strong>, preceded by some horrible warnings about what might happen if you get it wrong!:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert3.png"><img class="aligncenter size-full wp-image-3037" alt="ReplacevCenterCert3" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/ReplacevCenterCert3.png" width="642" height="88" /></a></p>
<p>I&#8217;m not sure if the choice of the word &#8216;original&#8217; is deliberate here or potentially misleading. Luckily for me this was for a new install, not an upgrade and since I was using Windows Authentication I took it to mean the password of the AD service account for vCenter. Using this was successful for me, what it means if you have historically changed the vCenter service account, moved from a SQL User or currently a SQL user is not immediately clear. I would take it to mean the current account used (Windows or SQL) by vCenter to connect to the database.</p>
<p>Would be interested to hear of others&#8217; experiences.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/vcenter-certificate-automation-tool-what-is-the-original-database-password.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vCenter Server 5.1 installation fails with &#8220;Wrong input – either a command line argument is wrong&#8230;&#8221;</title>
		<link>http://www.jonathanmedd.net/2013/06/vcenter-server-5-1-installation-fails-with-wrong-input-either-a-command-line-argument-is-wrong.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/vcenter-server-5-1-installation-fails-with-wrong-input-either-a-command-line-argument-is-wrong.html#comments</comments>
		<pubDate>Fri, 14 Jun 2013 16:07:28 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere 5.1]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=3021</guid>
		<description><![CDATA[While installing a fresh vCenter 5.1 recently I was presented with this really helpful error message at the point where you are registering a vCenter Server administrator user or group with vCenter Single Sign On: Wrong input &#8211; either a command line argument is wrong, a file cannot be found or the spec file doesn&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>While installing a fresh vCenter 5.1 recently I was presented with this really helpful error message at the point where you are registering a vCenter Server administrator user or group with vCenter Single Sign On:</p>
<p><em>Wrong input &#8211; either a command line argument is wrong, a file cannot be found or the spec file doesn&#8217;t contain the required information, or the clocks on the two systems are not synchronized. Check vm_ssoreg.log in system temporary folder for details.</em></p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall2.png"><img class="aligncenter size-full wp-image-3024" alt="vCenterInstall2" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall2.png" width="514" height="389" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall3.png"><img class="aligncenter size-full wp-image-3025" alt="vCenterInstall3" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall3.png" width="493" height="200" /></a></p>
<p>&nbsp;</p>
<p>There&#8217;s a <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=2035413">VMware KB article which references thi</a>s, but wasn&#8217;t quite my problem. Additionally it states that &#8220;This issue is resolved in VMware vCenter Server 5.1.0a&#8221;, where I was using vCenter 5.1 U1a and you would hope that the fix would be kept in for a later release <img src='http://www.jonathanmedd.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>A communities post <a href="http://communities.vmware.com/thread/417763">here</a> suggested that it may be related to the SSO install option I had chosen below for HA and the fact that the group above was local not AD based:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall4.png"><img class="aligncenter size-full wp-image-3027" alt="vCenterInstall4" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall4.png" width="510" height="387" /></a></p>
<p>&nbsp;</p>
<p>Switching the local Administrators group above for an AD based group then permitted me to continue the install.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/vcenter-server-5-1-installation-fails-with-wrong-input-either-a-command-line-argument-is-wrong.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Failed to verify the service account. Error code: [87] &#8211; when installing vCenter</title>
		<link>http://www.jonathanmedd.net/2013/06/failed-to-verify-the-service-account-error-code-87-when-installing-vcenter.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/failed-to-verify-the-service-account-error-code-87-when-installing-vcenter.html#comments</comments>
		<pubDate>Fri, 14 Jun 2013 13:52:50 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere 5.1]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=3015</guid>
		<description><![CDATA[While installing vCenter 5.1 recently I experienced the following error at the point where you confirm the AD account to use for the vCenter service: Failed to verify the service account. Error code: [87] At first I figured I was mis-entering the credentials, but it turns out to be an issue if the user AD [...]]]></description>
				<content:encoded><![CDATA[<p>While installing vCenter 5.1 recently I experienced the following error at the point where you confirm the AD account to use for the vCenter service:</p>
<p><strong>Failed to verify the service account. Error code: [87]</strong></p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall1.png"><img class="aligncenter size-full wp-image-3017" alt="vCenterInstall1" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/vCenterInstall1.png" width="476" height="172" /></a></p>
<p>At first I figured I was mis-entering the credentials, but it turns out to be an issue<a href="http://communities.vmware.com/thread/299477?tstart=0"> if the user AD account for the vCenter service is the same name as the vCenter computer account</a>.</p>
<p>Renamed the AD account and started the install again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/failed-to-verify-the-service-account-error-code-87-when-installing-vcenter.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Server 2012 on vSphere 5.0 &#8211; The Case of the Missing D:\ Drive</title>
		<link>http://www.jonathanmedd.net/2013/06/windows-server-2012-on-vsphere-5-0-the-case-of-the-missing-d-drive.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/windows-server-2012-on-vsphere-5-0-the-case-of-the-missing-d-drive.html#comments</comments>
		<pubDate>Wed, 12 Jun 2013 16:31:32 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere 5]]></category>
		<category><![CDATA[Windows Server 2012]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2991</guid>
		<description><![CDATA[I sincerely hope this saves somebody else some time because I had a fair amount of head scratching with this today. Installed a Windows Server 2012 VM on vSphere 5.0 U2, pretty standard install with a C:\ drive for OS, Software etc and D:\ for data. This particular server needed to run SQL Server 2012, [...]]]></description>
				<content:encoded><![CDATA[<p>I sincerely hope this saves somebody else some time because I had a fair amount of head scratching with this today. Installed a Windows Server 2012 VM on vSphere 5.0 U2, pretty standard install with a C:\ drive for OS, Software etc and D:\ for data. This particular server needed to run SQL Server 2012, however the install kept repeatedly failing with the error &#8220;Could not find the Database Engine startup handle&#8221;. Initially I suspected that it might be a problem with a corrupt ISO as there are numerous postings around that and some, such as the below, suggesting that it could be an issue with mounting an ISO (I was pretty dubious about this though).</p>
<p><a href="http://mbmccormick.com/2012/12/sql-server-2012-could-not-find-the-database-engine-startup-handle/">http://mbmccormick.com/2012/12/sql-server-2012-could-not-find-the-database-engine-startup-handle/</a></p>
<p>Having messed around with extracting the ISO, copying the files locally and other methods, eventually I tracked down in the SQL Server install log that it seemed to be having an issue reading and writing files to and from the D:\ drive during setup. During the SQL Server install wizard I&#8217;d specified that the path for databases, logs etc would be D:\. So I re-ran the installation and this time left the default of C:\ for everything and voilà, it worked!</p>
<p>No big deal I thought, I&#8217;ll simply change these locations post install. However, when I went to change the database server properties (or attempt to create a database) I was greeted with a dialogue box which only displayed the C:\ drive as accessible, no sign of D:\.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug4.png"><img class="aligncenter size-full wp-image-2992" alt="HotPlug4" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug4.png" width="428" height="566" /></a></p>
<p>Although clearly Windows was happy that a D:\ drive was present.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug2.png"><img class="aligncenter size-full wp-image-2993" alt="HotPlug2" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug2.png" width="524" height="89" /></a></p>
<p>This started ringing other bells because during the time I had been spending copying extracted ISO files around the $Admin share of D:\ had not been accessible (which I was going to look into later &#8211; should have done it then!)</p>
<p><del>Googling</del> Researching this issue landed me at this forum post on SqlServerCentral.com - <a href="http://www.sqlservercentral.com/Forums/Topic1300021-2799-1.aspx">Sql Server 2012 can&#8217;t see 2nd drive</a>. In there they link to this VMware KB article - <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1012225">Disabling the HotAdd/HotPlug capability in ESXi 5.x and ESXi/ESX 4.x virtual machines</a> . Essentially what is happening is that Windows is marking the drive as Removable (i.e. like a USB drive) and consequently some operations that we would normally expect to be available are not. If you look in the taskbar the drives are potentially removable &#8211; although in practice if you try to they are not because they are in use.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug1.png"><img class="aligncenter size-full wp-image-2994" alt="HotPlug1" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug1.png" width="312" height="126" /></a></p>
<p>You can get round this either by applying the suggested workaround from VMware which is to add <strong>devices.hotplug = false</strong> into the .vmx file for the VM or in Windows  <a href="http://www.happysysadm.com/2013/02/access-denied-to-disk-share-on-windows.html">disable a security policy in gpedit.msc under Computer Configuration\Windows Settings\Security Settings\Advanced Audit Policy Configuration\System Audit Policies\Object Access</a> .</p>
<p>I went for the former which you <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1012225">achieve by</a>:</p>
<p>Connect to the ESXi/ESX host or vCenter Server using the vSphere Client.<br />
Power off the virtual machine.<br />
Right-click the virtual machine and click Edit Settings.<br />
Click the Options tab.<br />
Click General &gt; Configuration Parameters &gt; Add Row.<br />
Insert a new row with the name devices.hotplug and a value of false.<br />
Power on the virtual machine.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug3.png"><img class="aligncenter size-full wp-image-2995" alt="HotPlug3" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug3.png" width="589" height="130" /></a></p>
<p>Once powered on Removable Devices are no longer present:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug5.png"><img class="aligncenter size-full wp-image-2997" alt="HotPlug5" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug5.png" width="113" height="105" /></a></p>
<p>The D:\ drive is available over the network via the $Admin share and SQL is now able to see the D:\ drive:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug6.png"><img class="aligncenter size-full wp-image-2998" alt="HotPlug6" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/HotPlug6.png" width="435" height="579" /></a></p>
<p>Incidentally, I blogged about this <a href="http://www.jonathanmedd.net/2010/07/safely-remove-hardware-appears-on-hw-v7-vms.html">similar issue back in 2010</a> and at the time put the <strong>devices.hotplug</strong> setting into standard templates for Windows Servers; looks like I&#8217;ll need to do that for Windows Server 2012 too! Never seem to hear much about other people having issues with this problem though, would like to hear in the comments if it has caused you issues too&#8230;..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/windows-server-2012-on-vsphere-5-0-the-case-of-the-missing-d-drive.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>London VMUG &#8211; July 4th 2013</title>
		<link>http://www.jonathanmedd.net/2013/06/london-vmug-july-4th-2013.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/london-vmug-july-4th-2013.html#comments</comments>
		<pubDate>Mon, 10 Jun 2013 18:13:10 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[user group]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2975</guid>
		<description><![CDATA[The next London VMUG will take place on July 4th 2013 and it looks like a great line up as usual. I’m particularly looking forward to hearing the session about some real world experiences with vCenter SSO. I also heard a rumour that there may be a few copies of a new vCloud book given [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://www.vmug.com/e/in/eid=906" target="_blank">next London VMUG will take place on July 4th 2013</a> and it looks like a great line up as usual. I’m particularly looking forward to hearing the session about some real world experiences with vCenter SSO.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/06/image.png"><img style="display: inline; border: 0px;" title="image" alt="image" src="http://www.jonathanmedd.net/wp-content/uploads/2013/06/image_thumb.png" width="590" height="436" border="0" /></a></p>
<p>I also heard a rumour that there may be a few copies of a new vCloud book given away&#8230;&#8230;.</p>
<p>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/london-vmug-july-4th-2013.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Points From PowerShell Scripting Games Event #4</title>
		<link>http://www.jonathanmedd.net/2013/06/learning-points-from-powershell-scripting-games-event-4.html</link>
		<comments>http://www.jonathanmedd.net/2013/06/learning-points-from-powershell-scripting-games-event-4.html#comments</comments>
		<pubDate>Fri, 07 Jun 2013 22:15:51 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Scripting Games 2013]]></category>
		<category><![CDATA[scripting games 2013]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2983</guid>
		<description><![CDATA[Event 4 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Random AD Users The first part of this event is to work with 20 randomly selected users from Active Directory. Initial thoughts might be that this is pretty straightforward. If you use the [...]]]></description>
				<content:encoded><![CDATA[<p>Event 4 for the <a href="http://scriptinggames.org/">PowerShell Scripting Games 2013</a> has closed, here are a few learning points I picked up on from entries submitted.</p>
<p><strong>1) Random AD Users</strong></p>
<p>The first part of this event is to work with 20 randomly selected users from Active Directory. Initial thoughts might be that this is pretty straightforward. If you use the Get-ADUser cmdlet from the AD module then you could do something like this:</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ADUser | Get-Random -Count 20

</pre>
<p>This might be OK for small testing environments, but could potentially have some performance issues in an AD with thousands of users. It doesn&#8217;t matter so much for this event really, but don&#8217;t forget to consider potential performance issues for the real world.</p>
<p>For instance, if you did have an AD environment that size you could restrict the amount of users returned with:</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ADUser -ResultSetSize 500 | Get-Random -Count 20

</pre>
<p>Also for this event you don&#8217;t need to bring back all of the properties of a user, just those you need to export to the report. Use of the Properties parameter would speed up the query in a large environment too.</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ADUser -ResultSetSize 500 -Properties Department,Title,LastLogonDate,PasswordLastSet,Enabled,LockedOut

</pre>
<p>&nbsp;</p>
<p><strong>2) Testing for additional commands</strong></p>
<p>Since the AD team were slightly late to the party in terms of PowerShell and typically it was one of the first things people wanted to use PowerShell for, there are a number of different methods for accessing AD via PowerShell. You can use ADSI or .NET, the 3rd party set of cmdlets from Quest or since Windows 2008 R2 the Microsoft AD module.</p>
<p>In terms of this event, any of these approaches really is fine. However, I saw a few different approaches for how to test whether a snapin or module was potentially available for use, for instance checking if a cmdlet was present.</p>
<p>I would test it by checking if the snapin or module was installed on the system. Since Get-PSSnapin returns an error if the snapin doesn&#8217;t exist you might want to take two slightly different approaches depending on what you are working with.</p>
<pre class="brush: powershell; title: ; notranslate">

try {

$PSSnapin = Get-PSSnapin Quest.Activeroles.ADManagement -Registered -ErrorAction Stop
 Add-PSSnapin Quest.Activeroles.ADManagement
}
catch {

&quot;blah blah cloud&quot;
}

</pre>
<p>or</p>
<pre class="brush: powershell; title: ; notranslate">

if ($Module = Get-Module ActiveDirectory -ListAvailable){

 Import-Module ActiveDirectory
}
else {

&quot;blah blah cloud&quot;
}

</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/06/learning-points-from-powershell-scripting-games-event-4.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Points From PowerShell Scripting Games Event #3</title>
		<link>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-3.html</link>
		<comments>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-3.html#comments</comments>
		<pubDate>Wed, 22 May 2013 20:40:02 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Scripting Games 2013]]></category>
		<category><![CDATA[scripting games 2013]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2961</guid>
		<description><![CDATA[Event 3 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Filter to the left Some cmdlets in PowerShell have their own filtering capabilities, which can make queries of large data sets more efficient. However, not all cmdlets do have this capability and [...]]]></description>
				<content:encoded><![CDATA[<p>Event 3 for the <a href="http://scriptinggames.org/">PowerShell Scripting Games 2013</a> has closed, here are a few learning points I picked up on from entries submitted.</p>
<p><strong>1) Filter to the left</strong></p>
<p>Some cmdlets in PowerShell have their own filtering capabilities, which can make queries of large data sets more efficient. However, not all cmdlets do have this capability and you will need to pipe the results to Where-Object instead. It&#8217;s always worth checking the help and examples for a cmdlet first to see the best way to filter and if it has an option to do so then use it!</p>
<p>I&#8217;ve seen quite a few entries do this</p>
<pre class="brush: powershell; title: ; notranslate">

Get-WmiObject Win32_LogicalDisk -ComputerName &quot;localhost&quot; | Where {$_.DriveType -eq 3}

</pre>
<p>This will get you the right results, but better is to use the filter parameter of Get-WmiObject</p>
<pre class="brush: powershell; title: ; notranslate">

Get-WmiObject Win32_LogicalDisk -Filter &quot;DriveType=3&quot;

</pre>
<p>&nbsp;</p>
<p><strong>2) ConvertTo-Html: PreContent and PostContent Parameters</strong></p>
<p>Quite a few entries made nice use of these parameters to add additional content to the HTML output generated. For instance you could add an h2 header before the &lt;table&gt; with PreContent</p>
<pre class="brush: powershell; title: ; notranslate">

Get-WmiObject Win32_LogicalDisk -filter &quot;DriveType=3&quot; | Select-Object Name,Size | ConvertTo-Html -PreContent &quot;&lt;h2&gt;Local Fixed Disk Report&lt;/h2&gt;&quot; | Out-File Report.html

</pre>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event3b1.png"><img class="aligncenter size-full wp-image-2966" alt="Event3b" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event3b1.png" width="327" height="167" /></a></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;">It&#8217;s possible to include PowerShell code as part of these parameters, so to fulfill one of the other requirements to place the date and time at the bottom of the report you could do something like this:</span></p>
<pre class="brush: powershell; title: ; notranslate">

Get-WmiObject Win32_LogicalDisk -filter &quot;DriveType=3&quot; | Select-Object Name,Size | ConvertTo-Html -PreContent &quot;&lt;h2&gt;Local Fixed Disk Report&lt;/h2&gt;&quot; -PostContent &quot;&lt;br&gt;&lt;hr&gt;&lt;p&gt; $(Get-Date)&quot; | Out-File Report.html

</pre>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event3c.png"><img class="aligncenter size-full wp-image-2967" alt="Event3c" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event3c.png" width="329" height="249" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VCP-IaaS: Exam Resources</title>
		<link>http://www.jonathanmedd.net/2013/05/vcp-iaas-exam-resources.html</link>
		<comments>http://www.jonathanmedd.net/2013/05/vcp-iaas-exam-resources.html#comments</comments>
		<pubDate>Mon, 20 May 2013 14:17:05 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[vCloud Director]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2956</guid>
		<description><![CDATA[I recently passed the VCP-IaaS exam and thought I would share the resources I used in case it is useful for anyone else. This is the exam which gives those already certified as VCP on vSphere, the VCP-Cloud certification. 1) I took the VMware vCloud Director: Install, Configure, Manage [V5.1] course as my primary source. I [...]]]></description>
				<content:encoded><![CDATA[<p>I recently passed the <a href="http://mylearn.vmware.com/mgrReg/plan.cfm?plan=32003&amp;ui=www_cert">VCP-IaaS exam</a> and thought I would share the resources I used in case it is useful for anyone else. This is the exam which gives those already certified as VCP on vSphere, the VCP-Cloud certification.</p>
<p>1) I took the <a href="http://mylearn.vmware.com/mgrreg/courses.cfm?ui=www_edu&amp;a=one&amp;id_subject=38932">VMware vCloud Director: Install, Configure, Manage [V5.1]</a> course as my primary source. I enjoyed the course and felt it had a good mix of theory and hands on work. There are plenty of new networking concepts to grasp, so it was good to have many whiteboarded descriptions of them from a knowledgeable instructor. One thing to watch out for is that the course covers version 5.1, but the exam as of this date is still 1.5 &#8211; so you need to make sure you are aware of the key differences. Not many of significance for the exam, but the instructor did a good job of pointing them out. Why the exam is still testing 1.5 when 5.1 has been out since September 2012 I&#8217;m not sure!</p>
<p>2) The instructor told us that the previous version of the course for version 1.5 contained vCenter Chargeback content, but it had been removed from this course. It&#8217;s covered in the exam though, so a bit annoying that it&#8217;s no longer in the course. However, I found a free self-paced online course, <a href="http://mylearn.vmware.com/mgrreg/courses.cfm?ui=www_edu&amp;a=one&amp;id_subject=41586">VMware vCenter Chargeback Manager Fundamentals [V2.5]</a>. Having sat through this I can see why it was removed from the vCD training course (boring). Apart from some technical information needed on setting it up, it&#8217;s mostly aimed at beancounters, but useful for getting enough info you need for the exam.</p>
<p>3) As always with any VMware exam make sure you read the<a href="http://mylearn.vmware.com/mgrReg/plan.cfm?plan=32003&amp;ui=www_cert"> blueprint</a> and ensure you work through the <a href="http://mylearn.vmware.com/mgrReg/plan.cfm?plan=32003&amp;ui=www_cert">mock exam</a>. The blueprint is particularly helpful since it links to the correct versions of PDFs for the versions of vCD and vCenter Chargeback being tested on the exam.</p>
<p>4) Whether you install vCD in your homelab or not the online <a href="https://www.projectnee.com/HOL">Hands-On-Labs</a> from VMware contains one lab for vCD and two for vShield which are well worth doing for additional practise.</p>
<p>5) It&#8217;s always good to get some practise questions in to get you used to the typical kind of question you might be used in the exam. So in addition to the mock exam, I also used the <a href="http://www.elasticsky.co.uk/practice-questions/">vCD practise tests</a> from <a href="http://twitter.com/pmcsharry">Paul McSharry</a>.</p>
<p>6) <a href="http://twitter.com/greggrobertson5">Gregg Robertson</a> has a <a href="http://thesaffageek.co.uk/vsphere-5-x-cloud-study-resources/vcp5-iaas-and-vcp5-cloud/">useful list of VCP-IasS resources</a> on his blog.</p>
<p>5) One thing to get to grip with are the vCD networking naming terms, external, internal, isolate, direct, routed, various combinations of those terms etc and what they refer to. Between the training course, various blog sites and the exam, different terms often seem to be used to be used for the same concepts which led to some confusion for me during the exam.</p>
<p>6) As of the date publishing this post there is a 50% off code for any VCP exam available from <a href="http://www.pearsonvue.com/vmware/getcertified/">this page on the Pearson Vue site</a>.</p>
<p>In summary I felt that as with the vSphere VCP exam if you have enough hands-on-experience combined with a good understanding of the theory fundamentals, then you should be fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/05/vcp-iaas-exam-resources.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learning Points From PowerShell Scripting Games Event #2</title>
		<link>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-2.html</link>
		<comments>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-2.html#comments</comments>
		<pubDate>Thu, 09 May 2013 21:10:09 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Scripting Games 2013]]></category>
		<category><![CDATA[scripting games 2013]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2952</guid>
		<description><![CDATA[Event 2 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Win32_Processor This event is a bit of a sneaky one and if you haven&#8217;t been affected by the issue before then you may not know it. The particular issue I am referring to  here is that [...]]]></description>
				<content:encoded><![CDATA[<p>Event 2 for the <a href="http://scriptinggames.org/home.php">PowerShell Scripting Games 2013</a> has closed, here are a few learning points I picked up on from entries submitted.</p>
<p><strong>1) Win32_Processor</strong></p>
<p>This event is a bit of a sneaky one and if you haven&#8217;t been affected by the issue before then you may not know it. The particular issue I am referring to  here is that <a href="http://support.microsoft.com/kb/932370">&#8220;The number of physical hyperthreading-enabled processors or the number of physical multicore processors is incorrectly reported in Windows Server 2003</a>&#8220;. The issue is essentially this:</p>
<p>&#8220;Before you apply this hotfix, the WMI classes and the WMI properties exhibit the following behavior.</p>
<h4 id="tocHeadRef">Win32_ComputerSystem</h4>
<ul>
<li>The <b>NumberOfLogicalProcessors</b> property is not available.</li>
<li>The <b>NumberOfProcessors</b> property returns the number of logical processors that are available on the system.</li>
</ul>
<h4 id="tocHeadRef">Win32_Processor</h4>
<ul>
<li>The number of <b>Win32_Processor</b> instances that are returned is equal to the number of logical processors that are available on the system.</li>
<li>The <b>NumberOfCores</b> property is not available.</li>
<li>The <b>NumberOfLogicalProcessors</b> property is not available.</li>
</ul>
<p>After you apply this hotfix, the WMI classes and the WMI properties exhibit the following behavior.</p>
<h4 id="tocHeadRef">Win32_ComputerSystem</h4>
<ul>
<li>The <b>NumberOfProcessors</b> property returns the number of physical processors that are available on the system.</li>
<li>The <b>NumberOfLogicalProcessors</b> property returns the number of logical processors that are available on the system.</li>
</ul>
<h4 id="tocHeadRef">Win32_Processor</h4>
<ul>
<li>The <b>NumberOfLogicalProcessors</b> property returns the number of logical processors on the current instance.</li>
<li>The <b>NumberOfCores</b> property returns the number of cores on the current instance.</li>
<li>The number of <b>Win32_Processor</b> instances that are returned is equal to the number of physical processors that are available on the system.</li>
</ul>
<p>&#8221;</p>
<p>This tripped me up once when I received back inconsistent results from a large server estate where I was querying via WMI the number of processors per server. Luckily in that environment I was able to deploy the hotfix everywhere, but you might not be able to and potentially you may have further inconsistencies with Windows 2000 servers that can&#8217;t be fixed. This event contains a Windows 2000 server, so you may need to code around it.</p>
<p>The initial thought would be to check the OS version, but then you would have to detect if the hotfix was installed if it was a 2003 box &#8211; probably too much work. So what we could do is check for the <strong>NumberofCores</strong> property on a WMI query for <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394373(v=vs.85).aspx">Win32_Processor</a> and if it doesn&#8217;t exist calculate the number of cores and sockets via other means. I haven&#8217;t tested this on Windows 2003 minus hotfix or 2000 yet, but you should be able to count the number of unique SocketDesignations returned to determine the number of sockets.</p>
<pre class="brush: powershell; title: ; notranslate">
$Processors = Get-WmiObject Win32_Processor
if ($NoOfCores = $Processors.NumberOfCores){

$NoOfSockets = ($Processors | Measure-Object).Count
}
else {

$NoOfCores = 'N/A'
 $NoOfSockets = ($Processors | Select-Object SocketDesignation -Unique | Measure-Object).count
}

</pre>
<p><strong>2) Using Add-Member when creating custom objects</strong></p>
<p>Event 2 requires you to output results and it&#8217;s good to see many people doing this by creating their own objects to output. A number of entries use the Add-Member cmdlet to add properties to their custom object. While this is a perfectly valid way to do it and was the technically prescribed way  in PowerShell v1, I prefer a couple of different approaches and in this <a href="http://www.jonathanmedd.net/2011/09/powershell-v3-creating-objects-with-pscustomobject-its-fast.html">previous article</a> explain why &#8211; mainly around performance. So I would do something like this (note that it does require PowerShell v3)</p>
<pre class="brush: powershell; title: ; notranslate">

[pscustomobject] @{
 Name = $_.Name
 NoOfCores = $NoOfCores
 NoOfSockets = $NoOfSockets
#etc........
}

</pre>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Points From PowerShell Scripting Games Event #1</title>
		<link>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-1.html</link>
		<comments>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-1.html#comments</comments>
		<pubDate>Wed, 01 May 2013 16:25:33 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Scripting Games 2013]]></category>
		<category><![CDATA[scripting games 2013]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2931</guid>
		<description><![CDATA[Event 1 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Get-ChildItem -Recurse When you need to retrieve files from paths with subfolders the Recurse parameter of Get-ChildItem makes this really easy. For instance is a really easy way to return everything [...]]]></description>
				<content:encoded><![CDATA[<p>Event 1 for the <a href="http://scriptinggames.org/home.php">PowerShell Scripting Games 2013</a> has closed, here are a few learning points I picked up on from entries submitted.</p>
<p><strong>1) Get-ChildItem -Recurse</strong></p>
<p>When you need to retrieve files from paths with subfolders the Recurse parameter of <a href="http://technet.microsoft.com/en-us/library/hh849800.aspx">Get-ChildItem</a> makes this really easy. For instance</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ChildItem -Path C:\Application\Log -Filter *.log -Recurse

</pre>
<p>is a really easy way to return everything below C:\Application\Log. In the specific instance of this event, this is OK because you only have three subfolders, but potentially there could be a lot more and some of them might not be relevant.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1a.png"><img class="aligncenter size-full wp-image-2941" alt="Event1a" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1a.png" width="522" height="498" /></a></p>
<p>&nbsp;</p>
<p>So a better way to do this might be to use wildcards in your path. For instance here we know that all of the subfolders that we are interested in contain the string &#8216;app&#8217; so we could use something like the below:</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ChildItem -Path C:\Application\Log\*app*\*.log

</pre>
<p>Note you can use the * wildcard not only for part of the filename, but also the directory and you can combine multiple wildcards.</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1b.png"><img class="aligncenter size-full wp-image-2943" alt="Event1b" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1b.png" width="459" height="497" /></a></p>
<p><strong>2) Copy-Item followed by Remove-Item</strong></p>
<p>The goal of the event is to archive files from the expensive storage to cheaper, archived storage. Some examples used a two-step process to do this with:</p>
<pre class="brush: powershell; title: ; notranslate">

Copy-Item.....

Remove-Item.....

</pre>
<p>(and some did not even include the <a href="http://technet.microsoft.com/en-gb/library/hh849765.aspx">Remove-Item</a>, so the files are duplicated) No need to do that, you can use <a href="http://technet.microsoft.com/en-us/library/hh849852.aspx">Move-Item</a> to make it a one step process.</p>
<p><strong>3) Maintaining the Folder Structure at the Destination</strong></p>
<p>Make sure you read all of the requirements for the event. One of which was to maintain the folder structure at the destination archive. So something like the following will simply end up with all of the log files in one unmanageable folder.</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ChildItem -Path C:\Application\Log\*app*\*.log -file | Move-Item -Destination C:\Archive

</pre>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1c.png"><img class="aligncenter size-full wp-image-2945" alt="Event1c" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1c.png" width="271" height="502" /></a></p>
<p>Since we are not using the Recurse parameter in the initial query, an attempt to move the file will fail because the path does not exist. Instead we can do something similar to the <a href="http://en.wikipedia.org/wiki/Touch_(Unix)">touch</a> command in Unix to first create an empty file, then overwrite it with the file move.</p>
<pre class="brush: powershell; title: ; notranslate">

Get-ChildItem -Path C:\Application\Log\*app*\*.log | ForEach-Object {New-Item -ItemType File -Path &quot;C:\Archive\$($_.Directory.Name)\$($_.Name)&quot; -Force; Move-Item $_ -Destination &quot;C:\Archive\$($_.Directory.Name)&quot; -Force}

</pre>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1d.png"><img class="aligncenter size-full wp-image-2947" alt="Event1d" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/Event1d.png" width="326" height="300" /></a></p>
<p>Looking forward to seeing entries for the next event. Remember you can still join in and there are plenty of prizes to be won!</p>
<p style="text-align: center;"><a href="http://scriptinggames.org/home.php"><img class="aligncenter size-full wp-image-2933" alt="ScriptingGames" src="http://www.jonathanmedd.net/wp-content/uploads/2013/05/ScriptingGames.png" width="144" height="144" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2013/05/learning-points-from-powershell-scripting-games-event-1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
