<?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 &#187; powershell</title>
	<atom:link href="http://www.jonathanmedd.net/category/powershell/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>Wed, 01 Feb 2012 13:58:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Basic VMware Cluster Capacity Check with PowerCLI</title>
		<link>http://www.jonathanmedd.net/2012/01/basic-cluster-vmware-capacity-check-with-powercli.html</link>
		<comments>http://www.jonathanmedd.net/2012/01/basic-cluster-vmware-capacity-check-with-powercli.html#comments</comments>
		<pubDate>Wed, 18 Jan 2012 17:09:39 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powercli]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2118</guid>
		<description><![CDATA[I recently needed to provide a high level capacity overview per VMware cluster looking at some metrics of interest that were being used as a guide to the capacity state of a cluster. Note: these are by no means definitive or the ones you should be using in your environment, but for these purposes they [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to provide a high level capacity overview per VMware cluster looking at some metrics of interest that were being used as a guide to the capacity state of a cluster. Note: these are by no means definitive or the ones you should be using in your environment, but for these purposes they met the requirements. The metrics I looked at per cluster were the ratio of vCPUs to pCPUs, the amount of Effective, Allocated and average Active Memory and the amount of Free Diskspace.</p>
<p>A couple of things to note:</p>
<p>1.The section below on datastore freespace filters out the local datastore which contains the name of the host.</p>
<pre class="brush: powershell;">

$VMHost = $Cluster | Get-VMHost | Select-Object -Last 1
$HostName = ($VMHost.name -split &quot;.&quot;, 0, &quot;simplematch&quot;)[0]
$ClusterFreeDiskspaceGB = ($VMHost | Get-Datastore | Where-Object {$_.Name -notmatch $HostName} | Measure-Object -Property FreeSpaceGB -Sum).Sum
</pre>
<p>2. I&#8217;ve recently changed the way I create custom objects to output reports with. For a long time I have used the <a href="http://www.jonathanmedd.net/2009/02/the-noble-array.html">cheat way of Select-Object</a> , partly because of performance and partly because you can&#8217;t control the order of properties in New-Object. These are being addressed in PowerShell v3 (see <a href="http://www.jonathanmedd.net/2011/09/powershell-v3-creating-objects-with-pscustomobject-its-fast.html">here</a> and <a href="http://www.jonathanmedd.net/2011/09/powershell-v3-bringing-ordered-to-your-hashtables.html">here</a>) so I thought it was about time to make the switch. This means for the time being that when working with the output you need to pipe it to Select-Object to control the order of the output, e.g.</p>
<p><strong>Get-Cluster | Get-ClusterCapacityCheck | Select-Object Cluster,ClusterCPUCores,ClusterAllocatedvCPUs,ClustervCPUpCPURatio,ClusterEffectiveMemoryGB,</strong></p>
<p><strong>ClusterAllocatedMemoryGB,ClusterActiveMemoryPercentage,ClusterFreeDiskspaceGB</strong></p>
<p style="text-align: center;"><a href="http://www.jonathanmedd.net/wp-content/uploads/2012/01/Get-ClusterCapacityCheck.png"><img class="aligncenter size-full wp-image-2130" title="Get-ClusterCapacityCheck" src="http://www.jonathanmedd.net/wp-content/uploads/2012/01/Get-ClusterCapacityCheck.png" alt="" width="697" height="246" /></a></p>
<pre class="brush: powershell;">

function Get-ClusterCapacityCheck {
&lt;#
.SYNOPSIS
Retrieves basic capacity info for VMware clusters

.DESCRIPTION
Retrieves basic capacity info for VMware clusters

.PARAMETER  ClusterName
Name of the computer to test the services for

.EXAMPLE
PS C:\&gt; Get-ClusterCapacityCheck -ClusterName Cluster01

.EXAMPLE
PS C:\&gt; Get-Cluster | Get-ClusterCapacityCheck

.NOTES
Author: Jonathan Medd
Date: 18/01/2012
#&gt;

[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Name of the cluster to test&quot;,
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)]
[System.String]
$ClusterName
)

begin {
$Finish = (Get-Date -Hour 0 -Minute 0 -Second 0)
$Start = $Finish.AddDays(-1).AddSeconds(1)

New-VIProperty -Name FreeSpaceGB -ObjectType Datastore -Value {
param($ds)
[Math]::Round($ds.FreeSpaceMb/1KB,0)
} -Force

}

process {

$Cluster = Get-Cluster $ClusterName

$ClusterCPUCores = $Cluster.ExtensionData.Summary.NumCpuCores
$ClusterEffectiveMemoryGB = [math]::round(($Cluster.ExtensionData.Summary.EffectiveMemory / 1KB),0)

$ClusterVMs = $Cluster | Get-VM

$ClusterAllocatedvCPUs = ($ClusterVMs | Measure-Object -Property NumCPu -Sum).Sum
$ClusterAllocatedMemoryGB = [math]::round(($ClusterVMs | Measure-Object -Property MemoryMB -Sum).Sum / 1KB)

$ClustervCPUpCPURatio = [math]::round($ClusterAllocatedvCPUs / $ClusterCPUCores,2)
$ClusterActiveMemoryPercentage = [math]::round(($Cluster | Get-Stat -Stat mem.usage.average -Start $Start -Finish $Finish | Measure-Object -Property Value -Average).Average,0)

$VMHost = $Cluster | Get-VMHost | Select-Object -Last 1
$ClusterFreeDiskspaceGB = ($VMHost | Get-Datastore | Where-Object {$_.Extensiondata.Summary.MultipleHostAccess -eq $True} | Measure-Object -Property FreeSpaceGB -Sum).Sum

New-Object -TypeName PSObject -Property @{
Cluster = $Cluster.Name
ClusterCPUCores = $ClusterCPUCores
ClusterAllocatedvCPUs = $ClusterAllocatedvCPUs
ClustervCPUpCPURatio = $ClustervCPUpCPURatio
ClusterEffectiveMemoryGB = $ClusterEffectiveMemoryGB
ClusterAllocatedMemoryGB = $ClusterAllocatedMemoryGB
ClusterActiveMemoryPercentage = $ClusterActiveMemoryPercentage
ClusterFreeDiskspaceGB = $ClusterFreeDiskspaceGB
}
}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2012/01/basic-cluster-vmware-capacity-check-with-powercli.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using PowerShell To Check That Windows Server Services Set To Automatic Have Started</title>
		<link>http://www.jonathanmedd.net/2012/01/using-powershell-to-check-that-windows-server-services-set-to-automatic-have-started.html</link>
		<comments>http://www.jonathanmedd.net/2012/01/using-powershell-to-check-that-windows-server-services-set-to-automatic-have-started.html#comments</comments>
		<pubDate>Wed, 11 Jan 2012 16:18:44 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[windows server 2003]]></category>
		<category><![CDATA[Windows Server 2008]]></category>
		<category><![CDATA[Windows Server 2008 R2]]></category>
		<category><![CDATA[wmi]]></category>
		<category><![CDATA[Windows Server 2003]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2111</guid>
		<description><![CDATA[Following on from the blog post Testing TCP Port Response from PowerShell  which provided a means to check that servers had fully rebooted after a patching and reboot cycle, I needed to take this one step further and check that all of the Windows Services set to Automatic successfully started after the reboot. This should [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the blog post <a href="http://www.jonathanmedd.net/2011/12/testing-tcp-port-response-from-powershell.html">Testing TCP Port Response from PowerShell</a>  which provided a means to check that servers had fully rebooted after a patching and reboot cycle, I needed to take this one step further and check that all of the Windows Services set to Automatic successfully started after the reboot.</p>
<p>This should be pretty straightforward since we have a <strong>Get-Service</strong> cmdlet. Unfortunately however, this cmdlet does not return a StartMode parameter, i.e. it&#8217;s not possible to tell whether the Startup Type has been set to Automatic, Manual or Disabled. This is quite a large gap in my opinon &#8211; if you agree with me you can vote to get it included in a future release <a href=" http://connect.microsoft.com/PowerShell/feedback/details/416680/get-service-needs-to-add-a-startuptype-noteproperty-to-its-output">here</a>. Of course with PowerShell there&#8217;s usually another way to achieve the same objective and using <strong>Get-WMIObject</strong> it is possible to find out the Startup Type of the service.</p>
<pre class="brush: powershell;">

Get-WmiObject Win32_Service -ComputerName $ComputerName -Filter &quot;StartMode='Auto' AND State='Stopped' AND Name!='SysmonLog'&quot;
</pre>
<p>Notice that we filter out the Perfmon service (SysmonLog) since it is rarely in a started state.</p>
<p>One other thing to watch out for in this script is that the section</p>
<pre class="brush: powershell;">

catch [System.Exception]
</pre>
<p>which is there to catch any WMI queries that fail, e.g. the server hasn&#8217;t rebooted properly or the correct permissions do not exist to make the WMI query, will not pick up any of these failures. This is because try / catch will only catch terminating errors and the WMI failures are non terminating. We can work around this by setting:</p>
<pre class="brush: powershell;">

$ErrorActionPreference = &quot;Stop&quot;
</pre>
<p>and then back to normal afterwards:</p>
<pre class="brush: powershell;">

$ErrorActionPreference = &quot;Continue&quot;
</pre>
<p>The script accepts pipeline input, so for example you could run it like:</p>
<pre class="brush: powershell;">

Get-Content servers.txt | ./Get-AutomaticServiceState.ps1
</pre>
<p>Here it is:</p>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Retrieves any Windows services set to Automatic and are not running

.DESCRIPTION
Retrieves any Windows services set to Automatic and are not running

.PARAMETER  ComputerName
Name of the computer to test the services for

.EXAMPLE
PS C:\&gt; Get-AutomaticServiceState -ComputerName Server01

.EXAMPLE
PS C:\&gt; Get-Content servers.txt | Get-AutomaticServiceState

.NOTES
Author: Jonathan Medd
Date: 11/01/2012
#&gt;

[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Name of the computer to test&quot;,
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)]
[Alias('CN','__SERVER','IPAddress','Server')]
[System.String]
$ComputerName
)

process {

try {

# Set ErrorActionPreference to Stop in order to catch non-terminating WMI errors
$ErrorActionPreference = &quot;Stop&quot;

# Query the server via WMI and exclude the Performance Logs and Alerts Service
$WMI = Get-WmiObject Win32_Service -ComputerName $ComputerName -Filter &quot;StartMode='Auto' AND State='Stopped' AND Name!='SysmonLog'&quot;

}

catch [System.Exception]

{
$WMI = “” | Select-Object SystemName,Displayname,StartMode,State
$WMI.SystemName = $ComputerName
$WMI.Displayname = &quot;Unable to connect to server&quot;
$WMI.StartMode = &quot;&quot;
$WMI.State = &quot;&quot;
}

finally {

$ErrorActionPreference = &quot;Continue&quot;

}

if ($WMI){

foreach ($WMIResult in $WMI){

$MYObject = “” | Select-Object ComputerName,ServiceName,StartupMode,State
$MYObject.ComputerName = $WMIResult.SystemName
$MYObject.ServiceName = $WMIResult.Displayname
$MYObject.StartupMode = $WMIResult.StartMode
$MYObject.State = $WMIResult.State
$MYObject
}
}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2012/01/using-powershell-to-check-that-windows-server-services-set-to-automatic-have-started.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Obtaining Symantec Endpoint Protection Version Info with PowerShell</title>
		<link>http://www.jonathanmedd.net/2011/12/obtaining-symantec-endpoint-protection-version-info-with-powershell.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/obtaining-symantec-endpoint-protection-version-info-with-powershell.html#comments</comments>
		<pubDate>Fri, 23 Dec 2011 12:23:45 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2090</guid>
		<description><![CDATA[Right, let&#8217;s set this one out. I do not, have not ever, nor probably will ever will like any AV Enterprise Management Products. However, sometimes you have to work with them and frequently the data in the Management Product does not actually reflect the end user / server estate. The below function will query the [...]]]></description>
			<content:encoded><![CDATA[<p>Right, let&#8217;s set this one out. I do not, have not ever, nor probably will ever will like any AV Enterprise Management Products. However, sometimes you have to work with them and frequently the data in the Management Product does not actually reflect the end user / server estate. The below function will query the registry of a remote machine(s) and report back the state of the installed Symantec SEP client to help perform a true up.</p>
<p>The<strong> PatternFileDate</strong> value stored in <strong>HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\AV</strong> needs a little figuring out, <a href="http://www.symantec.com/connect/forums/how-check-signature-version-remotely-without-using-symantec-console">this postin</a>g helps figure it out.</p>
<p><em>You can get the Info from this Registry Location</em></p>
<p><em>HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\AV</em></p>
<p><em>On this Key you can find two Values  </em><br />
<em> PatternFileDate  : Current Definition date</em><br />
<em> PatternFileRevision : Revision</em></p>
<p><em>These are Hexadecimal values</em></p>
<p><em>Example:</em><br />
<em> PatternFileDate  : <strong>27090e &#8211; 2009 Oct 14</strong> </em><br />
<em> 27090e &#8211; YYMMDD Format</em><br />
<em> 27 &#8211; 2009</em><br />
<em> 27 Hex is 39 Decimal, this value is since 1970. So 1970+39 = 2009</em></p>
<p><em><strong>09</strong> is <strong>October </strong>(<strong>00</strong>- Jan, <strong>0B</strong> &#8211; Dec)</em><br />
<em> <strong>0e Hex</strong> - <strong>14</strong> in decimal</em></p>
<p><em>PatternFileRevision : <strong>16Hex &#8211; 22</strong></em></p>
<p><em>16 HEX is 22 in Decimal</em></p>
<p>&nbsp;</p>
<pre class="brush: powershell;">

function Get-SEPVersion {
&lt;#
.SYNOPSIS
Retrieve Symantec Endpoint Version, Definition Date and Sylink Group

.DESCRIPTION
Retrieve Symantec Endpoint Version, Definition Date and Sylink Group

.PARAMETER  ComputerName
Name of the computer to query SEP info for

.EXAMPLE
PS C:\&gt; Get-SEPVersion -ComputerName Server01

.EXAMPLE
PS C:\&gt; $servers | Get-SEPVersion

.NOTES
Author: Jonathan Medd
Date: 23/12/2011
#&gt;

[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Name of the computer to query SEP for&quot;,
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('CN','__SERVER','IPAddress','Server')]
[System.String]
$ComputerName
)

begin {
# Create object to enable access to the months of the year
$DateTimeFormat = New-Object System.Globalization.DateTimeFormatInfo

# Set Registry keys to query
$SMCKey = &quot;SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC&quot;
$AVKey = &quot;SOFTWARE\\Symantec\\Symantec Endpoint Protection\\AV&quot;
$SylinkKey = &quot;SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC\\SYLINK\\SyLink&quot;
}

process {

try {

# Connect to Registry
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(&quot;LocalMachine&quot;,$ComputerName)

# Obtain Product Version value
$SMCRegKey = $reg.opensubkey($SMCKey)
$SEPVersion = $SMCRegKey.GetValue('ProductVersion')

# Obtain Pattern File Date Value
$AVRegKey = $reg.opensubkey($AVKey)
$AVPatternFileDate = $AVRegKey.GetValue('PatternFileDate')

# Convert PatternFileDate to readable date
$AVYearFileDate = [string]($AVPatternFileDate[0] + 1970)
$AVMonthFileDate = $DateTimeFormat.MonthNames[$AVPatternFileDate[1]]
$AVDayFileDate = [string]$AVPatternFileDate[2]
$AVFileVersionDate = $AVDayFileDate + &quot; &quot; + $AVMonthFileDate + &quot; &quot; + $AVYearFileDate

# Obtain Sylink Group value
$SylinkRegKey = $reg.opensubkey($SylinkKey)
$SylinkGroup = $SylinkRegKey.GetValue('CurrentGroup')

}

catch [System.Management.Automation.MethodInvocationException]

{
$SEPVersion = &quot;Unable to connect to computer&quot;
$AVFileVersionDate = &quot;&quot;
$SylinkGroup = &quot;&quot;
}

$MYObject = “” | Select-Object ComputerName,SEPProductVersion,SEPDefinitionDate,SylinkGroup
$MYObject.ComputerName = $ComputerName
$MYObject.SEPProductVersion = $SEPVersion
$MYObject.SEPDefinitionDate = $AVFileVersionDate
$MYObject.SylinkGroup = $SylinkGroup
$MYObject

}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/obtaining-symantec-endpoint-protection-version-info-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring HP EVA Recommended Settings for ESXi via PowerCLI</title>
		<link>http://www.jonathanmedd.net/2011/12/configuring-hp-eva-recommended-settings-for-esxi-via-powercli.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/configuring-hp-eva-recommended-settings-for-esxi-via-powercli.html#comments</comments>
		<pubDate>Wed, 21 Dec 2011 16:56:21 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[esxi]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[powercli]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2102</guid>
		<description><![CDATA[The HP Enterprise Virtual Array Family with VMware vSphere 4.0 , 4.1 AND 5.0 Configuration Best Practises Guide, available here, contains many recommendations for ESXi configuration. There are a number of recommended settings in this document to enhance the storage performance, a subset of which I have picked as appropriate for the environment and then [...]]]></description>
			<content:encoded><![CDATA[<p>The HP Enterprise Virtual Array Family with VMware vSphere 4.0 , 4.1 AND 5.0 Configuration Best Practises Guide, available <a href="http://h20195.www2.hp.com/v2/GetPDF.aspx/4AA1-2185ENW.pdf">here</a>, contains many recommendations for ESXi configuration. There are a number of recommended settings in this document to enhance the storage performance, a subset of which I have picked as appropriate for the environment and then needed to configure them on all ESXi hosts.</p>
<p>They can be implemented via PowerCLI and the below script demonstrates how these different types of settings can be configured. The most interesting one for me was setting the default Path Selection Policy to VMW_PSP_RR. The guide recommends you use the following command from the ESXi console:</p>
<p><strong>esxcli nmp satp setdefaultpsp -satp VMW_SATP_ALUA -psp VMW_PSP_RR</strong></p>
<p>With the introduction of the <strong>Get-ESXCLI</strong> cmdlet we can now carry out the equivalent from PowerCLI. <strong>Get-EsxCLI</strong> requires a direct connection to the ESXi host rather than from vCenter, so all the settings in this script are configured via a direct connection to the ESXi host</p>
<p><strong>Warning: Before carrying out any of these types of changes make sure you talk to your Storage Adminstrator to confirm what is appropriate for your own environment. Other array vendors offer different recommendations so be sure to check their documentation for similar settings.</strong></p>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Implement HP Recommended Settings for EVA SAN

.DESCRIPTION
Implement HP Recommended Settings for EVA SAN

.PARAMETER  HostName
Name of the ESXi host to configure the settings on

.EXAMPLE
PS C:\&gt; ./Set-HPEVAESXiConfig.ps1 -Hostname ESX01

.EXAMPLE
PS C:\&gt; Get-Content ESXServers.txt | ./Set-HPEVAESXiConfig.ps1

.NOTES
Author: Jonathan Medd
Date: 21/12/2011
#&gt;

[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Name of the ESXi host to configure the settings on&quot;,
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
[Alias('IPAddress','Server','ComputerName')]
[System.String]
$HostName
)

begin {

Write-Host &quot;Please enter credentials to connect to the ESXi hosts&quot; -ForegroundColor:Yellow
$Credential = Get-Credential
$UserName = $Credential.GetNetworkCredential().UserName
$Password = $Credential.GetNetworkCredential().Password
}

process {

Connect-VIServer $Hostname -User $Username -Password $Password | Out-Null

Write-Host &quot;Setting Disk.DiskMaxIOSize Advanced Option&quot;
Set-VMHostAdvancedConfiguration -VMHost $Hostname -Name Disk.DiskMaxIOSize -Value 128 | Out-Null

Write-Host &quot;Changing any LUNs with MultipathPolicy set to MostRecentlyUsed to be RoundRobin instead&quot;
Get-ScsiLun -VmHost $Hostname -LunType &quot;disk&quot; | Where-Object {$_.MultipathPolicy –eq &quot;MostRecentlyUsed&quot;} | Set-ScsiLun -MultipathPolicy &quot;RoundRobin&quot; | Out-Null

Write-Host &quot;Setting the default PSP to be VMW_PSP_RR&quot;
$esxCli = Get-EsxCli –Server $Hostname
$esxCli.nmp.satp.setdefaultpsp(&quot;VMW_PSP_RR&quot;, &quot;VMW_SATP_ALUA&quot;)

Write-Host &quot;Disconnecting from Host&quot;
$DefaultVIServer | Disconnect-VIServer -Confirm:$false
}
</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/configuring-hp-eva-recommended-settings-for-esxi-via-powercli.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing TCP Port Response from PowerShell</title>
		<link>http://www.jonathanmedd.net/2011/12/testing-tcp-port-response-from-powershell.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/testing-tcp-port-response-from-powershell.html#comments</comments>
		<pubDate>Tue, 20 Dec 2011 12:40:15 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2093</guid>
		<description><![CDATA[Recently I was listening to the PowerScripting Podcast and Hal mentioned a Test-TCPPort function he had put together a while back. I had a similar need to be able to test a bunch of machines post reboot, that they had come back successfully and a Ping test wouldn&#8217;t do since that didn&#8217;t necessarily mean that [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was listening to the <a href="http://powerscripting.net/">PowerScripting Podcast</a> and <a href="http://twitter.com/halr9000">Hal</a> mentioned a <a href="http://halr9000.com/article/418">Test-TCPPort function</a> he had put together a while back. I had a similar need to be able to test a bunch of machines post reboot, that they had come back successfully and a Ping test wouldn&#8217;t do since that didn&#8217;t necessarily mean that Windows has successfully booted <img src='http://www.jonathanmedd.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>So taking inspiration from that post I put together the following script (I convert it to a function for my own use, but it&#8217;s easier for my colleagues to use as a script) which will test by default RDP response from servers and report the results. A few examples of how to use it:</p>
<p><strong>Test a single server</strong></p>
<pre class="brush: powershell;">

.\Test-PortResponse.ps1 -ComputerName Server01 | Format-Table -AutoSize
</pre>
<p><strong>Testing multiple servers</strong></p>
<pre class="brush: powershell;">

Get-Content servers.txt | .\Test-PortResponse.ps1 | Format-Table -AutoSize
</pre>
<p><strong>Testing multiple servers on port 22 and exporting the results to csv</strong></p>
<pre class="brush: powershell;">

Get-Content servers.txt | .\Test-PortResponse.ps1 -Port 22 | Export-Csv Ports.csv -NoTypeInformation
</pre>
<p>Here&#8217;s the code you can use.</p>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Test the response of a computer to a specific TCP port

.DESCRIPTION
Test the response of a computer to a specific TCP port

.PARAMETER  ComputerName
Name of the computer to test the response for

.PARAMETER  Port
TCP Port number to test

.EXAMPLE
PS C:\&gt; ./Test-PortResponse.ps1 -ComputerName Server01

.EXAMPLE
PS C:\&gt; Get-Content Servers.txt | ./Test-PortResponse.ps1 -Port 22

.NOTES
Author: Jonathan Medd
Date: 20/12/2011
#&gt;

[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Name of the computer to test&quot;,
ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)]
[Alias('CN','__SERVER','IPAddress','Server')]
[System.String]
$ComputerName,

[Parameter(Position=1)]
[ValidateRange(1,65535)]
[Int]
$Port = 3389
)

process {

$Connection = New-Object Net.Sockets.TcpClient

try {

$Connection.Connect($ComputerName,$Port)

if ($Connection.Connected) {
$Response = “Open”
$Connection.Close()
}

}

catch [System.Management.Automation.MethodInvocationException]

{
$Response = “Closed / Filtered”
}

$Connection = $null

$MYObject = “” | Select-Object ComputerName,Port,Response
$MYObject.ComputerName = $ComputerName
$MYObject.Port = $Port
$MYObject.Response = $Response
$MYObject

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/testing-tcp-port-response-from-powershell.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>UK PowerShell User Group December 2011 &#8211; Use the WSMAN cmdlets to retreive WMI information</title>
		<link>http://www.jonathanmedd.net/2011/12/uk-powershell-user-group-december-2011-use-the-wsman-cmdlets-to-retreive-wmi-information.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/uk-powershell-user-group-december-2011-use-the-wsman-cmdlets-to-retreive-wmi-information.html#comments</comments>
		<pubDate>Wed, 14 Dec 2011 12:59:52 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[user group]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2072</guid>
		<description><![CDATA[The UK PowerShell User Group for December 2011 will take place at 19.30 GMT on Thursday December 15t. The topic is &#8216;Use the WSMAN cmdlets to retreive WMI information and see a demo of the new WMI API’s CIM cmdlets in PowerShell v3 CTP 2&#8242;. I&#8217;m looking forward to seeing the new CIM cmdlets from [...]]]></description>
			<content:encoded><![CDATA[<p>The UK PowerShell User Group for December 2011 will take place at 19.30 GMT on Thursday December 15t. The topic is &#8216;Use the WSMAN cmdlets to retreive WMI information and see a demo of the new WMI API’s CIM cmdlets in PowerShell v3 CTP 2&#8242;. I&#8217;m looking forward to seeing the new CIM cmdlets from V3 CTP2 since I haven&#8217;t had chance to play with those yet. <a href="http://richardspowershellblog.wordpress.com/2011/12/04/uk-powershell-groupdecember-2011/">Details from Richard Siddaway&#8217;s blog</a> are below:</p>
<p>&nbsp;</p>
<pre>When: Thursday, Dec 15, 2011 7:30 PM (GMT)

Where: Virtual

*~*~*~*~*~*~*~*~*~*</pre>
<p>Discover how to use the WSMAN cmdlets to retreive WMI information and see a demo of the new WMI API’s CIM cmdlets in PowerShell v3 CTP 2</p>
<p><strong>Notes</strong></p>
<p>Richard Siddaway has invited you to attend an online meeting using Live Meeting.<br />
<strong><a href="https://www.livemeeting.com/cc/usergroups/join?id=PJSH3M&amp;role=attend&amp;pw=gG%2FC-75%28m">Join the meeting.</a></strong><br />
<strong>Audio Information</strong><br />
<strong>Computer Audio</strong><br />
To use computer audio, you need speakers and microphone, or a headset.<br />
<strong>First Time Users:</strong><br />
To save time before the meeting, <a href="http://go.microsoft.com/fwlink/?LinkId=90703">check your system </a>to make sure it is ready to use Microsoft Office Live Meeting.<br />
<strong>Troubleshooting</strong><br />
Unable to join the meeting? Follow these steps:</p>
<ol>
<li>Copy this address and paste it into your web browser:
<p>https://www.livemeeting.com/cc/usergroups/join</li>
<li>Copy and paste the required information:<br />
Meeting ID: PJSH3M<br />
Entry Code: gG/C-75(m<br />
Location: https://www.livemeeting.com/cc/usergroups</li>
</ol>
<p>If you still cannot enter the meeting, <a href="http://r.office.microsoft.com/r/rlidLiveMeeting?p1=12&amp;p2=en_US&amp;p3=LMInfo&amp;p4=support">contact support</a></p>
<p><strong>Notice</strong><br />
Microsoft Office Live Meeting can be used to record meetings. By participating in this meeting, you agree that your communications may be monitored or recorded at any time during the meeting.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/uk-powershell-user-group-december-2011-use-the-wsman-cmdlets-to-retreive-wmi-information.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reporting on Windows File Server Shares and NTFS Permissions with PowerShell</title>
		<link>http://www.jonathanmedd.net/2011/12/reporting-on-windows-file-server-shares-and-ntfs-permissions-with-powershell.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/reporting-on-windows-file-server-shares-and-ntfs-permissions-with-powershell.html#comments</comments>
		<pubDate>Thu, 08 Dec 2011 13:48:26 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2031</guid>
		<description><![CDATA[I recently had a requirement to audit the Share and NTFS permissions of a Windows File Server. PowerShell contains the Get-ACL cmdlet which makes retreving the NTFS permissions fairly straightforward, but for the Share permissions it is not so easy, but we can make use of WMI and the Win32_LogicalShareSecuritySetting class. The below forum post [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a requirement to audit the Share and NTFS permissions of a Windows File Server. PowerShell contains the <strong><a href="http://technet.microsoft.com/en-us/library/dd347635.aspx">Get-ACL</a></strong> cmdlet which makes retreving the NTFS permissions fairly straightforward, but for the Share permissions it is not so easy, but we can make use of WMI and the <strong><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394188%28v=vs.85%29.aspx">Win32_LogicalShareSecuritySetting</a></strong> class.</p>
<p>The below forum post details some discussion around using this class to find the Share permissions and unsurprisingly the legendary <a href="http://twitter.com/ShayLevy">Shay Levy</a> provides the solution.</p>
<p><a href="http://groups.google.com/group/powershell-users/browse_thread/thread/43f06ce172e68c38?pli=1" target="_blank">http://groups.google.com/group/powershell-users/browse_thread/thread/43f06ce172e68c38?pli=1</a></p>
<p>The following script makes use of this code and adds some parameters depending on your requirements.</p>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Retrieve report of share permissions

.DESCRIPTION
Retrieve report of share permissions

.PARAMETER  ComputerName
Computer name to retrieve share permissions from

.PARAMETER  Share
Name of the share to retrieve permissions from (optional)

.PARAMETER  OutputFile
Name of the file to output the report to (optional)

.EXAMPLE
PS C:\&gt; Get-SharePermissions.ps1 -ComputerName Server01 -Share Share01 -OutputFile C:\Scripts\SharePermissions.csv

.EXAMPLE
PS C:\&gt; Get-SharePermissions.ps1 -ComputerName Server01

.NOTES
Author: Jonathan Medd
Date: 06/12/2011
Version: 0.1

#&gt;

[CmdletBinding()]
param(

[Parameter(Position=0)]
[System.String]
$ComputerName = '.',

[Parameter(Position=1)]
[System.String]
$Share,

[Parameter(Position=2)]
[System.String]
$OutputFile
)

function Translate-AccessMask($val){
Switch ($val)
{
2032127 {&quot;FullControl&quot;; break}
1179785 {&quot;Read&quot;; break}
1180063 {&quot;Read, Write&quot;; break}
1179817 {&quot;ReadAndExecute&quot;; break}
-1610612736 {&quot;ReadAndExecuteExtended&quot;; break}
1245631 {&quot;ReadAndExecute, Modify, Write&quot;; break}
1180095 {&quot;ReadAndExecute, Write&quot;; break}
268435456 {&quot;FullControl (Sub Only)&quot;; break}
default {$AccessMask = $val; break}
}
}

function Translate-AceType($val){
Switch ($val)
{
0 {&quot;Allow&quot;; break}
1 {&quot;Deny&quot;; break}
2 {&quot;Audit&quot;; break}
}
}

# Create calculated properties
$ShareProperty = @{n=&quot;Share&quot;;e={$ShareName}}
$AccessMask = @{n=&quot;AccessMask&quot;;e={Translate-AccessMask $_.AccessMask}}
$AceType = @{n=&quot;AceType&quot;;e={Translate-AceType $_.AceType}}
$Trustee = @{n=&quot;Trustee&quot;;e={$_.Trustee.Name}}

if ($Share){

$filter=&quot;name='$Share'&quot;

$WMIQuery = Get-WmiObject -Class Win32_LogicalShareSecuritySetting -ComputerName $ComputerName -filter $filter | ForEach-Object {
$ShareName = $_.name
$_.GetSecurityDescriptor().Descriptor.DACL | Select-Object $Shareproperty,$AccessMask,$AceType,$Trustee}
}

else {
$WMIQuery = Get-WmiObject -Class Win32_LogicalShareSecuritySetting -ComputerName $ComputerName | ForEach-Object {
$ShareName = $_.name
$_.GetSecurityDescriptor().Descriptor.DACL | Select-Object $Share,$AccessMask,$AceType,$Trustee }
}

if ($OutputFile){
$WMIQuery | Export-Csv $OutputFile -NoTypeInformation
}

else {
$WMIQuery | Format-Table -AutoSize
}
</pre>
<p>&nbsp;</p>
<p>For NTFS permissions <a href="http://twitter.com/JeffHicks" target="_blank">Jeff Hicks</a> has a very useful post for creating NTFS ACL reports.</p>
<p><a href="http://jdhitsolutions.com/blog/2011/06/creating-acl-reports/" target="_blank">http://jdhitsolutions.com/blog/2011/06/creating-acl-reports/</a></p>
<p>The following is a script based off some of the ideas in that post which you can use for generating a report depending on your requirements.</p>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Retrieve report of NTFS permissions

.DESCRIPTION
Retrieve report of NTFS permissions

.PARAMETER  ComputerName
Computer name to retrieve NTFS permissions from

.PARAMETER  Folder
Name of the NTFS path to retrieve permissions from

.PARAMETER  Recurse
Retrieve permissions from subfolders and files

.PARAMETER  OutputFile
Name of the file to output the report to (optional)

.EXAMPLE
PS C:\&gt; Get-NTFSPermissions.ps1 -ComputerName Server01 -Folder D$\Home -OutputFile C:\Scripts\NTFSPermissions.csv

.EXAMPLE
PS C:\&gt; Get-NTFSPermissions.ps1 -Folder D:\Home -Recurse

.NOTES
Author: Jonathan Medd
Date: 07/12/2011
Version: 0.1

#&gt;

[CmdletBinding()]
param(

[Parameter(Position=0)]
[System.String]
$ComputerName = '.',

[Parameter(Position=1,Mandatory=$true,HelpMessage=&quot;Name of the NTFS path to retrieve permissions from&quot;)]
[System.String]
$Folder,

[Parameter(Position=2)]
[Switch]
$Recurse,

[Parameter(Position=3)]
[System.String]
$OutputFile
)

# Set the Path variable dependent on whether its for a remote machine
if ($ComputerName -eq '.'){
$Path = $Folder
}

else {
$Path = &quot;\\$ComputerName\$Folder&quot;
}

if ($OutputFile){
Get-Childitem $Path -Recurse:$Recurse | ForEach-Object {Get-Acl $_.FullName} | Select-Object @{Name=&quot;Path&quot;;Expression={$_.PSPath.Substring($_.PSPath.IndexOf(&quot;:&quot;)+2) }},@{Name=&quot;Type&quot;;Expression={$_.GetType()}},Owner -ExpandProperty Access | Export-CSV $OutputFile -NoTypeInformation
}

else {
Get-Childitem $Path -Recurse:$Recurse | ForEach-Object {Get-Acl $_.FullName} | Select-Object @{Name=&quot;Path&quot;;Expression={$_.PSPath.Substring($_.PSPath.IndexOf(&quot;:&quot;)+2) }},@{Name=&quot;Type&quot;;Expression={$_.GetType()}},Owner -ExpandProperty Access | Format-Table -AutoSize
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/reporting-on-windows-file-server-shares-and-ntfs-permissions-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell V3 CTP2 &#8211; Now Available</title>
		<link>http://www.jonathanmedd.net/2011/12/powershell-v3-ctp2-now-available.html</link>
		<comments>http://www.jonathanmedd.net/2011/12/powershell-v3-ctp2-now-available.html#comments</comments>
		<pubDate>Tue, 06 Dec 2011 13:30:22 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powershell]]></category>
		<category><![CDATA[v3preview]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2034</guid>
		<description><![CDATA[The second Community Technology Preview of PowerShell V3 is now available. This pre-beta release gives of a flavour of areas of change which may appear in the final release. A CTP has an emphasis on Community , i.e. the PowerShell team is looking for plenty of feedback for this release while they still have time [...]]]></description>
			<content:encoded><![CDATA[<p>The second Community Technology Preview of PowerShell V3 is <a href="http://www.microsoft.com/download/en/details.aspx?id=27548">now available</a>. This pre-beta release gives of a flavour of areas of change which may appear in the final release. A CTP has an emphasis on <strong>Community</strong> , i.e. the PowerShell team is looking for plenty of feedback for this release while they still have time to change things. Below are items logged on <a href="http://connect.microsoft.com/PowerShell">Connect</a> by the community which have been fixed since the release of CTP1 &#8211; so if you find an issue in your testing, please log it on <a href="http://connect.microsoft.com/PowerShell">Connect</a> so it can be reviewed and potentially resolved.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="70"><strong>689302</strong></td>
<td valign="top" width="515">Unable to catch PSRemotingTransportException</td>
</tr>
<tr>
<td valign="top" width="70"><strong>690139</strong></td>
<td valign="top" width="515">Get-Command gets duplicated result if a requested script path contains &#8220;..&#8221;.</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>676882</strong></td>
<td valign="bottom" width="515">Out-GridView and properties with dots</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>687776</strong></td>
<td valign="bottom" width="515">ISE Editor Enhancements</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>687886</strong></td>
<td valign="bottom" width="515">2-pane &#8220;more console-like&#8221; mode for ISE</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>688630</strong></td>
<td valign="bottom" width="515">PowerShell ISE v3 &#8211; UserEnterToSelectInCommandPaneIntellisense should be on by default</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>690164</strong></td>
<td valign="bottom" width="515">V3 &#8211; out-gridview &#8211; remove a criteria close the grid window</td>
</tr>
<tr>
<td valign="top" width="70"><strong>690556</strong></td>
<td valign="top" width="515">Tab Complete in Remote Session</td>
</tr>
<tr>
<td valign="top" width="70"><strong>690784</strong></td>
<td valign="top" width="515">PS3CTP1 &#8211; Object casting regression</td>
</tr>
<tr>
<td valign="top" width="70"><strong>690864</strong></td>
<td valign="top" width="515">Import-Module should check the required PowerShell version before anything else</td>
</tr>
<tr>
<td valign="top" width="70"><strong>690895</strong></td>
<td valign="top" width="515">PS3CTP1: PowerShell.exe shows THROWN error Message in normal output color</td>
</tr>
<tr>
<td valign="top" width="70"><strong>691206</strong></td>
<td valign="top" width="515">PoshV3CTP1: PowerShell Events do not trigger when used with UI (WPF &amp; Windows Forms)</td>
</tr>
<tr>
<td valign="top" width="70"><strong>691439</strong></td>
<td valign="top" width="515">Having an append ability in Export-CSV.</td>
</tr>
<tr>
<td valign="top" width="70"><strong>692617</strong></td>
<td valign="top" width="515">StopProcessing doesn&#8217;t work in v3</td>
</tr>
<tr>
<td valign="top" width="70"><strong>692776</strong></td>
<td valign="top" width="515">PS3CTP1: Variables as property names BROKEN with Assignment Operators</td>
</tr>
<tr>
<td valign="bottom" width="70"><strong>693754</strong></td>
<td valign="bottom" width="515">Powershell 3.0 ISE editor corrupts text</td>
</tr>
<tr>
<td valign="top" width="70"><strong>694600</strong></td>
<td valign="top" width="515">Run with Powershell not executing scripts</td>
</tr>
<tr>
<td valign="top" width="70"><strong>694940</strong></td>
<td valign="top" width="515">NestedModules are unloaded from GLOBAL scope with the parent module.</td>
</tr>
<tr>
<td valign="top" width="70"><strong>694942</strong></td>
<td valign="top" width="515">NestedModules doesn&#8217;t support specifying the version</td>
</tr>
<tr>
<td valign="top" width="70"><strong>695755</strong></td>
<td valign="top" width="515">v3 CTP1: Breaking change &#8211; DayOfWeek and left-hand rule</td>
</tr>
<tr>
<td valign="top" width="70"><strong>695978</strong></td>
<td valign="top" width="515">PS3CTP1: REGRESSION: Get-Member -Static Error</td>
</tr>
<tr>
<td valign="top" width="70"><strong>697131</strong></td>
<td valign="top" width="515">v3 CTP1: Char[] not reversed by Array.Reverse static method</td>
</tr>
<tr>
<td valign="top" width="70"><strong>704136</strong></td>
<td valign="top" width="515">Divide by Zero $? Test Returns True</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>PowerShell V3 CTP2 is part of the Windows Management Framework (WMF) 3.0 CTP2 and can be installed on the following Windows configurations.</p>
<table width="95%" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="28%"><strong>Operating System</strong></td>
<td valign="top" width="23%"><strong>SP Level</strong></td>
<td valign="top" width="30%"><strong>SKUs</strong></td>
<td valign="top" width="17%"><strong>Languages</strong></td>
</tr>
<tr>
<td valign="top" width="28%">Windows 7</td>
<td valign="top" width="23%">SP1</td>
<td valign="top" width="30%">All</td>
<td valign="top" width="17%">English</td>
</tr>
<tr>
<td valign="top" width="28%">Windows Server 2008 R2</td>
<td valign="top" width="23%">SP1 and greater</td>
<td valign="top" width="30%">All but IA64</td>
<td valign="top" width="17%">English</td>
</tr>
</tbody>
</table>
<p>Full details on other changes in CTP2 are <a href="http://blogs.msdn.com/b/powershell/archive/2011/12/02/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download.aspx">detailed on the PowerShell Team Blog</a>:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>I’m pleased to announce that the Community Technology Preview #2 (CTP2) is available for download.</p>
<p><a href="http://www.microsoft.com/download/en/details.aspx?id=27548">Windows Management Framework 3.0 CTP2</a> makes some updated management functionality available to be installed on Windows 7 SP1 &amp; Windows Server 2008 R2 SP1. Windows Management Framework 3.0 contains Windows PowerShell 3.0, WMI &amp; WinRM.</p>
<p><strong>IMPORTANT: </strong>If you have WMF3.0 CTP1 installed, you must uninstall it before installing CTP2.</p>
<p><strong>Overview of changes since WMF 3.0 CTP1<br />
</strong>1. Customer Reported Bug Fixes<br />
Many customer reported bugs have been fixed since the WMF 3.0 CTP1. The release notes contains a list of bug titles, but please check <a href="http://connect.microsoft.com/powershell">Connect</a> for full details.</p>
<p>2. Single Command Pane in Windows PowerShell ISE<br />
The Command and Output panes in Windows PowerShell ISE have been combined into a single Command pane that looks and behaves like the Windows PowerShell console.</p>
<p>3. Updatable Help<br />
The WMF 3.0 CTP1 release notes described a new Updatable Help system in Windows PowerShell 3.0 and included a copy of the help content. The Updatable Help system is now active on the Internet. To download and update help files, type: Update-Help.</p>
<p>4. Windows PowerShell Workflows<br />
A number of enhancements have been made in the scripting experience for Windows PowerShell Workflows, including new keywords: Parallel, Sequence &amp; Inlinescript. A document describing these changes will be published to the download page shortly.</p>
<p>5. Remote Get-Module<br />
The Get-Module cmdlet now supports implicit remoting. You can now use the new PSSession and CIMSession parameters of the Get-Module cmdlet to get the modules in any remote session or CIM session. A number of other module enhancements are listed in the release notes.</p>
<p><strong>Feedback &amp; Bugs</strong><strong><br />
</strong>We welcome any feedback or bug submissions to the Windows PowerShell Connect site: <a href="http://connect.microsoft.com/PowerShell">http://connect.microsoft.com/PowerShell</a></p>
<p><strong>Additional Information:<br />
</strong>This software is a pre-release version. Features and behavior are likely to change before the final release.</p>
<p>This preview release is designed to enable the community to experience and review the preliminary designs and direction of key features Windows PowerShell 3.0 and to solicit feedback before features are finalized.</p>
<p>For an interesting post describing what to expect with a CTP, read <a href="http://blogs.msdn.com/b/powershell/archive/2007/11/02/ctp-ctp-beta.aspx">this very old post</a> from Jeffrey</p>
<p>Travis Jones [MSFT]<br />
Program Manager – Windows PowerShell<br />
Microsoft Corporation</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/12/powershell-v3-ctp2-now-available.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What&#8217;s New In PowerCLI 5.0 &#8211; Slides from UK PowerShell UserGroup</title>
		<link>http://www.jonathanmedd.net/2011/11/whats-new-in-powercli-5-0-slides-from-uk-powershell-usergroup.html</link>
		<comments>http://www.jonathanmedd.net/2011/11/whats-new-in-powercli-5-0-slides-from-uk-powershell-usergroup.html#comments</comments>
		<pubDate>Tue, 22 Nov 2011 22:17:10 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[powercli]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[user group]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[vSphere 5]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2021</guid>
		<description><![CDATA[As promised, here are my slides from this evening&#8217;s UK PowerShell UserGroup &#8211; What&#8217;s New in PowerCLI 5.0. What&#8217;s New in PowerCLI 5.0 View more presentations from jonathanmedd sf]]></description>
			<content:encoded><![CDATA[<p>As promised, here are my slides from this evening&#8217;s UK PowerShell UserGroup &#8211; What&#8217;s New in PowerCLI 5.0.</p>
<div id="__ss_10278749" style="width: 425px;"><strong style="display: block; margin: 12px 0 4px;"><a title="What's New in PowerCLI 5.0" href="http://www.slideshare.net/jonathanmedd/whats-new-in-powercli-50" target="_blank">What&#8217;s New in PowerCLI 5.0</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/10278749" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="425" height="355"></iframe></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/jonathanmedd" target="_blank">jonathanmedd</a></div>
</div>
<p>sf</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/11/whats-new-in-powercli-5-0-slides-from-uk-powershell-usergroup.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Working with the HPQ WMI Provider to find NIC Information on HP Proliant Servers</title>
		<link>http://www.jonathanmedd.net/2011/11/working-with-the-hpq-wmi-provider-to-find-nic-information-on-hp-proliant-servers.html</link>
		<comments>http://www.jonathanmedd.net/2011/11/working-with-the-hpq-wmi-provider-to-find-nic-information-on-hp-proliant-servers.html#comments</comments>
		<pubDate>Mon, 21 Nov 2011 13:32:38 +0000</pubDate>
		<dc:creator>Jonathan Medd</dc:creator>
				<category><![CDATA[HP]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.jonathanmedd.net/?p=2013</guid>
		<description><![CDATA[I recently had a task to query NIC information on a number of HP Proliant servers, this included the connected NIC speed, duplex settings and status of the configured HP Team. I initally looked at the WMI class Win32_NetworkAdapterConfiguration  which contains a lot of info around NIC configuration. Unfortunately, it does not include NIC speed [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a task to query NIC information on a number of HP Proliant servers, this included the connected NIC speed, duplex settings and status of the configured HP Team. I initally looked at the WMI class <strong>Win32_NetworkAdapterConfiguration</strong>  which contains a lot of info around NIC configuration. Unfortunately, it does not include NIC speed or duplex settings.</p>
<p>Looking for alternatives, I discovered a <a href="http://www.peetersonline.nl/index.php/powershell/gather-nic-properties-including-speed-and-duplex/">script from Hugo Peeters</a> which instead queried the registry key <strong>HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}</strong> which looked like it would do the job. However, for some reason this works fine for HP rackmount servers, but blades do not appear to publish NIC info to that registry key so I needed to look for something else.</p>
<p>A colleague pointed me to the <a href="http://h18004.www1.hp.com/products/servers/management/wbem/index.html">HPQ WMI Provider</a>, which I had not seen before and there does not appear to be a lot of published info about either. It can be installed as part of the HP Proliant installation process and adds 800+ classes that can be queried via WMI -  a sample is shown below from the Root\HPQ Namespace:</p>
<p><a href="http://www.jonathanmedd.net/wp-content/uploads/2011/11/HPQWMI.png"><img class="aligncenter size-full wp-image-2014" title="HPQWMI" src="http://www.jonathanmedd.net/wp-content/uploads/2011/11/HPQWMI.png" alt="" width="517" height="687" /></a></p>
<p>In this instance, I was able to use the following classes to obtain the information I needed:</p>
<p><strong>HP_EthernetTeam</strong><br />
<strong>HP_EthernetPort</strong><br />
<strong>HP_WinEthLANEndpoint</strong></p>
<p>There is an absolute wealth of information stored in here, so I would encourage you to check it out if you work with Windows Server on HP systems. The script I put together puts together a basic report of some key NIC info, with the knowledge that there are never more than 4 NICs in a server being queried.</p>
<p>Note that I have used the parameter <strong>-ErrorAction Stop</strong> in the WMI queries, to enforce a terminating error to be generated if the WMI query fails. Without this, the error is non-terminating and does not get caught by the Catch statement.</p>
<pre class="brush: powershell;">

$HP_EthernetTeam = Get-WmiObject -Namespace root\hpq -Class HP_EthernetTeam -ComputerName $ComputerName -ErrorAction Stop
</pre>
<pre class="brush: powershell;">

&lt;#
.SYNOPSIS
Retrieve HP NIC Info from HPQ WMI Namespace

.DESCRIPTION
Retrieve HP NIC Info from HPQ WMI Namespace

.PARAMETER  ServersInputFile
Path to the file containing server names

.PARAMETER  OutputFile
Path to the csv file to output data to

.EXAMPLE
PS C:\&gt; Get-HPNICStatus.ps1 -ServersInputFile C:\Scripts\Servers.txt -OutputFile C:\Scripts\HPNICStatus.csv

#&gt;

[CmdletBinding()]
param(

[Parameter(Position=0,Mandatory=$true,HelpMessage=&quot;Path to the file containing server names&quot;)]
[System.String]
$ServersInputFile,

[Parameter(Position=1,Mandatory=$true,HelpMessage=&quot;Path to the csv file to output data to&quot;)]
[System.String]
$OutputFile
)

$ComputerNames = Get-Content $ServersInputFile

# Allow conversion to MB/sec for NIC speed
$NICSpeedConversionConstant = 1000000

$myCol = @()

foreach ($ComputerName in $ComputerNames){

Write-Host &quot;`n`n&quot;
Write-Host &quot;Querying NIC info on $ComputerName&quot;

# Test for HPQ WMI Namespace and deal with a failure in catch statement
try {

$HP_EthernetTeam = Get-WmiObject -Namespace root\hpq -Class HP_EthernetTeam -ComputerName $ComputerName -ErrorAction Stop
$HP_EthernetPort = Get-WmiObject -Namespace root\hpq -Class HP_EthernetPort -ComputerName $ComputerName -ErrorAction Stop
$HP_WinEthLANEndpoint = Get-WmiObject -Namespace root\hpq -Class HP_WinEthLANEndpoint -ComputerName $ComputerName -ErrorAction Stop

Write-Host &quot;Successful query on $ComputerName&quot;

# Calculate Team Health Status based on WMI query result
switch ($HP_WinEthLANEndpoint.HealthState) {
&quot;0&quot; {$HPTeamStatus = &quot;Unknown&quot;; break}
&quot;5&quot; {$HPTeamStatus = &quot;OK&quot;; break}
&quot;10&quot; {$HPTeamStatus = &quot;Degraded/Warning&quot;; break}
&quot;15&quot; {$HPTeamStatus = &quot;Minor Failure&quot;; break}
&quot;20&quot; {$HPTeamStatus = &quot;Major Failure&quot;; break}
&quot;25&quot; {$HPTeamStatus = &quot;Critical Failure&quot;; break}
&quot;30&quot; {$HPTeamStatus = &quot;Non-recoverable Error&quot;; break}
default {$HPTeamStatus = &quot;Unknown&quot;}
}

# Check Ethernet Port Status
$EthernetPortHealthStateArray = @()

foreach ($EthernetPort in $HP_EthernetPort){

switch ($EthernetPort.HealthState) {
&quot;0&quot; {$EthernetPortHealthState = &quot;Unknown&quot;; break}
&quot;5&quot; {$EthernetPortHealthState = &quot;OK&quot;; break}
&quot;10&quot; {$EthernetPortHealthState = &quot;Degraded/Warning&quot;; break}
&quot;15&quot; {$EthernetPortHealthState = &quot;Minor Failure&quot;; break}
&quot;20&quot; {$EthernetPortHealthState = &quot;Major Failure&quot;; break}
&quot;25&quot; {$EthernetPortHealthState = &quot;Critical Failure&quot;; break}
&quot;30&quot; {$EthernetPortHealthState = &quot;Non-recoverable Error&quot;; break}
default {$EthernetPortHealthState = &quot;Unknown&quot;}
}

$EthernetPortHealthStateObject = &quot;&quot; | Select-Object EthernetPortName,EthernetPortHealthStatus
$EthernetPortHealthStateObject.EthernetPortName = $EthernetPort.Description
$EthernetPortHealthStateObject.EthernetPortHealthStatus = $EthernetPortHealthState
$EthernetPortHealthStateArray += $EthernetPortHealthStateObject

}

$MYObject = “” | Select-Object Servername,HPTeamName,HPTeamStatus,HPTeamSpeed,NIC1Description,NIC1Model,NIC1Speed,NIC1FullDuplex,NIC1HealthState,NIC2Description,NIC2Model,NIC2Speed,NIC2FullDuplex,NIC2HealthState,NIC3Description,NIC3Model,NIC3Speed,NIC3FullDuplex,NIC3HealthState,NIC4Description,NIC4Model,NIC4Speed,NIC4FullDuplex,NIC4HealthState
$MYObject.Servername = $ComputerName
$MYObject.HPTeamName = $HP_EthernetTeam.Description
$MYObject.HPTeamStatus = $HPTeamStatus
$MYObject.HPTeamSpeed = [string]($HP_EthernetTeam.Speed / $NICSpeedConversionConstant) + &quot; MB/sec&quot;
$MYObject.NIC1Description = $HP_EthernetPort[0].Description
$MYObject.NIC1Model = $HP_EthernetPort[0].Caption
$MYObject.NIC1Speed = [string]($HP_EthernetPort[0].Speed / $NICSpeedConversionConstant) + &quot; MB/sec&quot;
$MYObject.NIC1FullDuplex = $HP_EthernetPort[0].FullDuplex
$MYObject.NIC1HealthState = $EthernetPortHealthStateArray[0].EthernetPortHealthStatus
$MYObject.NIC2Description = $HP_EthernetPort[1].Description
$MYObject.NIC2Model = $HP_EthernetPort[1].Caption
$MYObject.NIC2Speed = [string]($HP_EthernetPort[1].Speed / $NICSpeedConversionConstant) + &quot; MB/sec&quot;
$MYObject.NIC2FullDuplex = $HP_EthernetPort[1].FullDuplex
$MYObject.NIC2HealthState = $EthernetPortHealthStateArray[1].EthernetPortHealthStatus
$MYObject.NIC3Description = $HP_EthernetPort[2].Description
$MYObject.NIC3Model = $HP_EthernetPort[2].Caption
$MYObject.NIC3Speed = if ($HP_EthernetPort[2].Speed -ne $null){[string]($HP_EthernetPort[2].Speed / $NICSpeedConversionConstant) + &quot; MB/sec&quot;}
$MYObject.NIC3FullDuplex = $HP_EthernetPort[2].FullDuplex
$MYObject.NIC3HealthState = $EthernetPortHealthStateArray[2].EthernetPortHealthStatus
$MYObject.NIC4Description = $HP_EthernetPort[3].Description
$MYObject.NIC4Model = $HP_EthernetPort[3].Caption
$MYObject.NIC4Speed = if ($HP_EthernetPort[3].Speed -ne $null){[string]($HP_EthernetPort[3].Speed / $NICSpeedConversionConstant) + &quot; MB/sec&quot;}
$MYObject.NIC4FullDuplex = $HP_EthernetPort[3].FullDuplex
$MYObject.NIC4HealthState = $EthernetPortHealthStateArray[3].EthernetPortHealthStatus
$myCol += $MYObject
}

# If WMI query fails
catch {

Write-Host &quot;Unsuccessful query on $ComputerName&quot;

$MYObject = “” | Select-Object Servername,HPTeamName,HPTeamStatus,HPTeamSpeed,NIC1Description,NIC1Model,NIC1Speed,NIC1FullDuplex,NIC1HealthState,NIC2Description,NIC2Model,NIC2Speed,NIC2FullDuplex,NIC2HealthState,NIC3Description,NIC3Model,NIC3Speed,NIC3FullDuplex,NIC3HealthState,NIC4Description,NIC4Model,NIC4Speed,NIC4FullDuplex,NIC4HealthState
$MYObject.Servername = $ComputerName
$MYObject.HPTeamName = &quot;HPQ WMI is not installed or WMI query failed&quot;
$MYObject.HPTeamStatus = &quot;N/A&quot;
$MYObject.HPTeamSpeed = &quot;N/A&quot;
$MYObject.NIC1Description = &quot;N/A&quot;
$MYObject.NIC1Model = &quot;N/A&quot;
$MYObject.NIC1Speed = &quot;N/A&quot;
$MYObject.NIC1FullDuplex = &quot;N/A&quot;
$MYObject.NIC1HealthState = &quot;N/A&quot;
$MYObject.NIC2Description = &quot;N/A&quot;
$MYObject.NIC2Model = &quot;N/A&quot;
$MYObject.NIC2Speed = &quot;N/A&quot;
$MYObject.NIC2FullDuplex = &quot;N/A&quot;
$MYObject.NIC2HealthState = &quot;N/A&quot;
$MYObject.NIC3Description = &quot;N/A&quot;
$MYObject.NIC3Model = &quot;N/A&quot;
$MYObject.NIC3Speed = &quot;N/A&quot;
$MYObject.NIC3FullDuplex = &quot;N/A&quot;
$MYObject.NIC3HealthState = &quot;N/A&quot;
$MYObject.NIC4Description = &quot;N/A&quot;
$MYObject.NIC4Model = &quot;N/A&quot;
$MYObject.NIC4Speed = &quot;N/A&quot;
$MYObject.NIC4FullDuplex = &quot;N/A&quot;
$MYObject.NIC4HealthState = &quot;N/A&quot;
$myCol += $MYObject
}

Clear-Variable HP_EthernetTeam,HP_EthernetPort,HP_WinEthLANEndpoint,HPTeamStatus,EthernetPortHealthStateArray,EthernetPortHealthStateObject,EthernetPortHealthStateArray

}

$myCol | Export-Csv $OutputFile -NoTypeInformation
</pre>
<p>sdf</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jonathanmedd.net/2011/11/working-with-the-hpq-wmi-provider-to-find-nic-information-on-hp-proliant-servers.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

