<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>blog.powershell.no &#187; Jan Egil Ring</title>
	<atom:link href="http://blog.powershell.no/author/janegilring/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.powershell.no</link>
	<description>On Windows PowerShell and other admin-related topics</description>
	<lastBuildDate>Mon, 06 Feb 2012 09:18:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.powershell.no' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/e22e511529c14fbc92cde5589d6231b4?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>blog.powershell.no &#187; Jan Egil Ring</title>
		<link>http://blog.powershell.no</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.powershell.no/osd.xml" title="blog.powershell.no" />
	<atom:link rel='hub' href='http://blog.powershell.no/?pushpress=hub'/>
		<item>
		<title>Getting information about Run As Accounts for services and scheduled tasks</title>
		<link>http://blog.powershell.no/2012/02/05/getting-information-about-run-as-accounts-for-services-and-scheduled-tasks/</link>
		<comments>http://blog.powershell.no/2012/02/05/getting-information-about-run-as-accounts-for-services-and-scheduled-tasks/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 13:38:27 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Desktop management]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Server management]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[run as account]]></category>
		<category><![CDATA[scheduled task]]></category>
		<category><![CDATA[service account]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/?p=1003</guid>
		<description><![CDATA[On a default Windows installation there is a number of Windows services and scheduled tasks. These are configured to run with a specified set of credentials like LocalSystem, LocalService or NetworkService. New services is typically created when installing applications, which in a domain environment often require a domain account configured as the run as account. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=1003&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On a default Windows installation there is a number of <a href="http://en.wikipedia.org/wiki/Windows_service">Windows services</a> and <a href="http://en.wikipedia.org/wiki/Windows_Task_Scheduler">scheduled tasks</a>. These are configured to run with a specified set of <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms686005(v=vs.85).aspx">credentials</a> like LocalSystem, LocalService or NetworkService. New services is typically created when installing applications, which in a domain environment often require a domain account configured as the run as account. The same requirement is true for scheduled tasks, in example a scheduled script which requires specific credentials.</p>
<p>A good practice is keeping track of these run as accounts, as they could potentially be a security threat. For instance a bad practice would be to configure a service or scheduled task to run as an Administrator account, when there is no need for it to run with administrative privileges.</p>
<p>In order to gather information about run as accounts for services and scheduled tasks I`ve created an <a href="http://huddledmasses.org/a-guide-to-advanced-functions/">advanced function</a> in Windows PowerShell, named Get-RunAsAccount. The function uses Windows Management Instrumentation (WMI) to gather information about services, and schtasks.exe to gather information about scheduled tasks.</p>
<p>The Get-ScheduledTask function, which is a wrapper function around schtasks.exe, is created by PowerShell MVP <a href="http://www.xipher.dk/WordPress/">Claus Nielsen</a>. A two part series about managing scheduled tasks is available on the PowerShell Magazine:</p>
<ul>
<li><a href="http://www.powershellmagazine.com/2011/11/21/managing-scheduled-tasks-in-your-environment-part-i">Managing scheduled tasks in your environment – Part I</a></li>
<li><a href="http://www.powershellmagazine.com/2011/11/22/managing-scheduled-tasks-in-your-environment-part-ii">Managing scheduled tasks in your environment – Part II</a></li>
</ul>
<p>The article series also provides a function for changing the username and password for a scheduled task.</p>
<p><strong><span style="font-size:x-small;">Get-RunAsAccount</span></strong></p>
<p>More than one item may be specified on the –Computername parameter, for example &#8220;Computer-A, computer-B&#8221;, thus we use a foreach construct to loop through to the $computername variable.</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:a3dabb73-1f10-41bb-9986-fab5a61de22c" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: powershell;">
    PROCESS {
                    foreach ($computer in $computername) {
                Get-RunAsAccountWorker -computername $computer
            }
    }

</pre></p>
</div>
<p>Next, we set up basic error handling by using a <a href="http://blog.usepowershell.com/2011/04/caught-in-a-trap-dealing-with-errors/">try/catch block</a>, where we start by sending a ping request using Test-Connection, and attempting a connection to the target computer using WMI.</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:103779c2-c2cd-405d-a15a-c324f6960ca2" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: powershell;">
try {
        if ((Test-Connection -ComputerName $computername -Count 1 -Quiet) -and ($computersystem = Get-WmiObject -Class win32_computersystem -Computername $computername -ErrorAction stop)) {
        Write-Verbose &quot;Connected to computer $computername&quot;

        $connectivity = &quot;Success&quot;

        $output = @()
</pre></p>
</div>
<p>If the Test-Connection cmdlet fails, the “else” script block on line 116 will be executed, populating a hash-table for the output variable where the Connectivity property is set to “Failed (ping)”. If the WMI connection fails, an exception is generated and the code in the catch block on line 132 is executed. If the connection succeed we write a message which will be shown if the –Verbose parameter is specified, informing the user that we successfully connected to the computer.</p>
<p>We populate the $connectivity variable which will be used later on, and we set up an empty array for the matching services and scheduled tasks found on the target computer.</p>
<p>Next we gather all services on the computer. Notice that we specify a filter for Get-WmiObject, which performs a wildcard match using the provided RunAsUser parameter value. If the parameter isn`t specified, all services will be returned.</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:1e6f9e4a-4351-40ee-8041-6ca9dcb16c92" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: powershell;">
        $services = Get-WmiObject win32_service -filter &quot;(StartName Like '%$runasuser%')&quot; -ComputerName $computername -ErrorAction Stop | Select-Object name,startname

        if ($services) {

        foreach ($service in $services) {

        Write-Verbose &quot;Processing service $($service.name)&quot;

        $outputservice = @{}
        $outputservice.Computername = $computersystem.name
        $outputservice.Connectivity = &quot;Success&quot;
        $outputservice.Type = &quot;Service&quot;
        $outputservice.Name = $service.name
        $outputservice.RunAsAccount = $service.startname

        $output += $outputservice

        }

        }
</pre></p>
</div>
<p>If any services is found, a foreach construct will loop through all the services found, generate a hash-table with information about the service and add it to the $output variable created earlier. The same procedure is then repeated for gathering information about scheduled tasks, using Claus` Get-ScheduledTask function. One difference is that we first check if the RunAsUser parameter is specified, and then run the Get-ScheduledTask function with the correct parameters:</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:7ba6d292-691a-46b5-b61c-074612b18505" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: powershell;">
        if ($RunAsUser) {
        $tasks = Get-ScheduledTask -ComputerName $computername -RunAsUser $RunAsUser | Select-Object taskname,runasuser
        }
        else {
        $tasks = Get-ScheduledTask -ComputerName $computername | Select-Object taskname,runasuser
        }

        if ($tasks) {

        foreach ($task in $tasks) {

        Write-Verbose &quot;Processing task $($task.taskname)&quot;

        $outputtask = @{}
        $outputtask.Computername = $computersystem.name
        $outputtask.Connectivity = &quot;Success&quot;
        $outputtask.Type = &quot;ScheduledTask&quot;
        $outputtask.Name = $task.taskname
        $outputtask.RunAsAccount = $task.runasuser

        $output += $outputtask

        }

        }
</pre></p>
</div>
<p>In the end we output the gathered information. We first check if there is any information populated in the $output variable, as this might be empty if the RunAsAccount parameter is specified, and no services or scheduled tasks running as the specified account is found. If any information is found, we do a foreach loop to output each entry (a hash-table containing either service or task information) to the pipeline:</p>
<div id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:96da52b5-2496-47cf-9845-53e1399cb61e" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;"><pre class="brush: powershell;">
        if ($output) {
        foreach ($ht in $output) {

        New-Object -TypeName PSObject -Property $ht

             }

        }

        else {

        $outputinfo = @{}
        $outputinfo.Computername = $($computername)
        $outputinfo.Connectivity = &quot;Success&quot;
        $outputinfo.Type = $null
        $outputinfo.Name = $null
        $outputinfo.RunAsAccount = $null

        New-Object -TypeName PSObject -Property $outputinfo

        }
</pre></p>
</div>
<p>If the $output variable is empty we create a single object which indicates that we have successfully connected to the computer, but not found any matching services or scheduled tasks.</p>
<p>As a general recommendation in PowerShell; <span style="text-decoration:underline;">Always output the information as objects</span>. This leaves it up to the consumer of the script or function to decide what to do next. For example he or she might decide to insert the information to a SQL-table, generate an HTML report or export the information to a CSV-file.</p>
<p>We will end the walkthrough by looking at some example usage:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb.png?w=377&#038;h=50" alt="image" width="377" height="50" border="0" /></a></p>
<p>We start by dot-sourcing the function into our current PowerShell session. There is a number of ways to define the function, have a look at the bottom of <a href="http://huddledmasses.org/a-guide-to-advanced-functions/">this article</a> for more information.</p>
<p>Next we run the function without specifying a computer name, which means it will run on the local computer:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb1.png?w=263&#038;h=149" alt="image" width="263" height="149" border="0" /></a></p>
<p>In the example above we specified “demo” as the value for the RunAsUser parameter. In this case “demo” is the name of the Active Directory domain, and thus all services and scheduled tasks running under a domain account will be returned.</p>
<p>In the next example the input for the computername parameter is gathered from a text-file, and the RunAsUser we`re looking for is “administrator”:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb2.png?w=589&#038;h=131" alt="image" width="589" height="131" border="0" /></a></p>
<p>In the last example we`re retrieving all computer accounts in Active Directory which has the word “server” as part of the OperatingSystem property. We`re then “renaming” the name property of the computer accounts to “computername” using Select-Object, which in turn will make Get-RunAsAccount able to bind to the computername parameter when we pipe all the computer account objects to it:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb3.png?w=644&#038;h=229" alt="image" width="644" height="229" border="0" /></a></p>
<p>We could also choose to export the information to a comma separated file:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb4.png?w=644&#038;h=33" alt="image" width="644" height="33" border="0" /></a></p>
<p>Which in turn can be opened and customized in Microsoft Office Excel:</p>
<p><a href="http://janegilring.files.wordpress.com/2012/02/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2012/02/image_thumb5.png?w=513&#038;h=97" alt="image" width="513" height="97" border="0" /></a></p>
<p>You can download the function from <a href="http://gallery.technet.microsoft.com/Getting-information-about-438b5b1c">here</a>. Feel free to leave a comment if you encounter a bug or have suggestions for improvement.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/1003/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/1003/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/1003/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=1003&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2012/02/05/getting-information-about-run-as-accounts-for-services-and-scheduled-tasks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2012/02/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Demos, slides and videos from Nordic Infrastructure Conference 2012 sessions</title>
		<link>http://blog.powershell.no/2012/01/22/demos-slides-and-videos-from-nordic-infrastructure-conference-2012-sessions/</link>
		<comments>http://blog.powershell.no/2012/01/22/demos-slides-and-videos-from-nordic-infrastructure-conference-2012-sessions/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 13:49:12 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[NIC]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Nordic Infrastructure Conference 2012]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/?p=987</guid>
		<description><![CDATA[On January 13th – 14th the Nordic Infrastructure Conference (NIC) was arranged in Oslo, Norway for the first time. The goal for the conference is creating a premier event for all IT-professionals in the Nordics, and the first edition of NIC was a great success with a number of excellent speakers. &#160; Demos, slides and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=987&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On January 13th – 14th the Nordic Infrastructure Conference (<a href="http://www.nic2012.com/about_nic_2012">NIC</a>) was arranged in Oslo, Norway for the first time. The goal for the conference is creating a premier event for all IT-professionals in the Nordics, and the first edition of NIC was a great success with a number of excellent <a href="http://www.nic2012.com/nic2012_agenda/speakers">speakers</a>.</p>
<p>&#160;</p>
<p>Demos, slides and videos from my 3 sessions at the NIC conference is now available:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="114">
<p><b>Session</b></p>
</td>
<td valign="top" width="349">
<p><b>Description</b></p>
</td>
<td valign="top" width="63">
<p><b>Slides</b></p>
</td>
<td valign="top" width="77">
<p><b>Demos</b></p>
</td>
<td valign="top" width="77">
<p><b>Video</b></p>
</td>
</tr>
<tr>
<td valign="top" width="114">
<p>Introducing PowerShell 3.0</p>
</td>
<td valign="top" width="349">
<p>Since Windows 7 and Windows Server 2008 R2, Windows PowerShell has been a part of the core operating system, meaning we will see the next version of PowerShell in Windows 8. In this session we will look at what`s new in Windows PowerShell 3.0, based on the Windows Developer Preview released at the BUILD conference in September. You will get to see new features in PowerShell itself, as well as new modules for managing Windows 8 and Windows Server 8.</p>
</td>
<td valign="top" width="63">
<p><a href="http://www.slideshare.net/janegilring/introducing-powershell-30">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="https://skydrive.live.com/redir.aspx?cid=4e672563938ed1e2&amp;resid=4E672563938ED1E2!502&amp;parid=4E672563938ED1E2!501">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="http://vimeo.com/nicconf/review/35062648/e7d3b2a682">Link</a></p>
</td>
</tr>
<tr>
<td valign="top" width="114">
<p>Practical PowerShell for the Windows Administrator</p>
</td>
<td valign="top" width="349">
<p>Have you ever needed to perform the same task on more than one server? In this session you will see demos on how you can manage Windows systems using Windows PowerShell. You will get to see different techniques for remote management, demos of managing Hyper-V with and without System Center Virtual Machine Manager as well as several other demos.</p>
</td>
<td valign="top" width="63">
<p><a href="http://www.slideshare.net/janegilring/practical-powershell-for-the-windows-administrator">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="https://skydrive.live.com/redir.aspx?cid=4e672563938ed1e2&amp;resid=4E672563938ED1E2!504&amp;parid=4E672563938ED1E2!501">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="http://vimeo.com/nicconf/review/35065641/3366444595">Link</a></p>
</td>
</tr>
<tr>
<td valign="top" width="114">
<p>Preparing for Office 365</p>
</td>
<td valign="top" width="349">
<p>In this session we will look at how you can prepare your organization for Office 365, ranging from technical requirements for clients and servers to identity management. The session will focus on the core infrastructure of the Office 365 service.</p>
</td>
<td valign="top" width="63">
<p><a href="http://www.slideshare.net/janegilring/preparing-for-office-365">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="https://skydrive.live.com/redir.aspx?cid=4e672563938ed1e2&amp;resid=4E672563938ED1E2!503&amp;parid=4E672563938ED1E2!501">Link</a></p>
</td>
<td valign="top" width="77">
<p><a href="http://vimeo.com/nicconf/review/35055183/72c2dba269">Link</a></p>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>Other PowerShell-related sessions at the conference was <a href="http://vimeo.com/nicconf/review/35053006/5d895aa209">An introduction to WMI And PowerShell</a> and <a href="http://vimeo.com/nicconf/review/35061905/3cb45966a2">WMI Eventing with PowerShell</a> by PowerShell MVP <a href="http://tfl09.blogspot.com/">Thomas Lee</a>.</p>
<p>All the other sessions from the conference is available for viewing <a href="http://www.nic2012.com/nic2012_agenda">here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/987/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/987/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/987/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=987&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2012/01/22/demos-slides-and-videos-from-nordic-infrastructure-conference-2012-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>
	</item>
		<item>
		<title>2012 Microsoft MVP Award</title>
		<link>http://blog.powershell.no/2012/01/06/2012-microsoft-mvp-award/</link>
		<comments>http://blog.powershell.no/2012/01/06/2012-microsoft-mvp-award/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 10:03:16 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Community]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/?p=977</guid>
		<description><![CDATA[On January 1st last year I was awarded the Microsoft MVP Award for my contributions in the PowerShell community. The MVP Award is valid for 1 year, and is based on the contributions for the past year. On January 1st this year I was re-awarded for my 2nd year as an MVP: Dear Jan Egil [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=977&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On January 1st last year <a href="http://blog.powershell.no/2011/01/01/microsoft-mvp-award/">I was awarded</a> the Microsoft MVP Award for my contributions in the PowerShell community. The MVP Award is valid for 1 year, and is based on the contributions for the past year. On January 1st this year I was re-awarded for my 2nd year as an MVP:</p>
<blockquote><p><em>Dear Jan Egil Ring,</em><br />
<em> Congratulations! We are pleased to present you with the 2012 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in PowerShell technical communities during the past year.</em></p></blockquote>
<p>I feel very honored to be part of this outstanding community, and I look forward to an exciting year coming with a new release of Windows and PowerShell.</p>
<p><strong><span style="font-size:small;">Resources</span></strong></p>
<p><a href="http://mvp.support.microsoft.com/gp/aboutmvp">About the MVP Award Program</a></p>
<p><a href="https://mvp.support.microsoft.com/communities/mvp.aspx?product=1&amp;competency=PowerShell&amp;page=1">Windows PowerShell MVP Awardees</a></p>
<p><a href="http://www.mvps.org/">MVPs.org community site</a></p>
<p><a href="https://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpfaqs">Microsoft MVP FAQ</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/977/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/977/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/977/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=977&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2012/01/06/2012-microsoft-mvp-award/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing the PowerShell Network Adapter Configuration module</title>
		<link>http://blog.powershell.no/2011/11/22/introducing-the-powershell-network-adapter-configuration-module/</link>
		<comments>http://blog.powershell.no/2011/11/22/introducing-the-powershell-network-adapter-configuration-module/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 22:59:02 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Remote Management]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Server management]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[dnsserversearchorder]]></category>
		<category><![CDATA[netconnectionid]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[psnetadapterconfig]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/?p=963</guid>
		<description><![CDATA[For a Windows administrator, working with network adapters is a common task. A common approach many companies use is configuring servers with static IP addresses (IPv4) and clients using DHCP. The IP address is just one of many properties of a network adapter, as we also have properties like subnet mask, default gateway, DNS server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=963&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For a Windows administrator, working with network adapters is a common task. A common approach many companies use is configuring servers with static IP addresses (IPv4) and clients using DHCP. The IP address is just one of many properties of a network adapter, as we also have properties like subnet mask, default gateway, DNS server search order and so on. Configuring these properties is usually performed during the initial setup of a computer, either manually or by a deployment mechanism.</p>
<p>The configuration of a network adapter is mostly static, however, from time to time some properties might need to be changed. In example the subnet on a network is expanded to meet new requirements, and thus the subnet mask property must be updated on computers not using DHCP. Another scenario is the setup of new DNS servers, with a decision not to keep the existing DNS servers` IP addresses. I recently faced the last scenario, where several hundred servers configured with static IP addresses needed to have their DNS configuration updated. Using Windows PowerShell the task can be automated, even if we need to perform the task on 10, 100 or 1000 servers. However, the more computers a script is run against, the more important it is to implement proper error handling and logging to keep track of which computers is updated.</p>
<p>The above task is just one of many potential tasks for configuring a network adapter. Since I was unable to find any existing PowerShell module/library for working with network adapters on Windows systems, I decided to create a project on Codeplex:</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:small;">The PowerShell Network Adapter Configuration module</span></strong></p>
<p>The PowerShell Network Adapter Configuration (PSNetAdapterConfig) module is a PowerShell module for working with network adapters on Windows-based computers. The module is using Windows Management Instrumentation (WMI) to retrieve and configure properties of network adapters.</p>
<p>The current release of the module makes use of the following WMI-classes:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394217(v=vs.85).aspx">Win32_NetworkAdapterConfiguration</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx">Win32_NetworkAdapter</a></li>
</ul>
<p>The module currently contains 4 functions:</p>
<ul>
<li><strong>Get-DNSServerSearchOrder</strong> – get the DNS client settings for a network adapter (the property name is DNSServerSearchOrder)</li>
<li><strong>Get-NetConnectionId</strong> – get the name of a network adapter (the property name is NetConnectionId)</li>
<li><strong>Set-DNSServerSearchOrder</strong> – change the configured DNSServerSearchOrder. This function contains two parameter sets, one for replacing the current DNSServerSearchOrder property value, the other for adding/removing IP addresses from the current value</li>
<li><strong>Set-NetConnectionId</strong> – change the name of a network adapter. In example, change the name from “Local Area Connection” to “Server VLAN 42”</li>
</ul>
<p>I will add functions to the module when I find time, but I also hope that people in the community will contribute by either improving the existing functions, providing suggestions or creating new functions.</p>
<p>When downloading a PowerShell module from the internet (typically a zip-file), beginners often get into problems because they don`t know that the file first needs to be unblocked (Right-click the zip-file-&gt;Properties-&gt;Unblock). To overcome this challenge I created a Windows installer (MSI) file which is easy to install and does not need to be unblocked:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb.png?w=244&#038;h=191" alt="image" width="244" height="191" border="0" /></a></p>
<p>The default install path is %userprofile%\Documents\WindowsPowerShell\Modules, and the user have the option to override the module path.</p>
<p>The installer was created using <a href="http://wix.sourceforge.net/">Windows XML Installer (Wix)</a>, based on Chad Miller`s blog-post <a href="http://sev17.com/2010/11/building-a-powershell-module-installer/">Building A PowerShell Module Installer</a>.</p>
<p>When the module is installed, we can use Import-Module to import the module, and Get-Command to list the available commands:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb1.png?w=469&#038;h=245" alt="image" width="469" height="245" border="0" /></a></p>
<p>As we can see there is also an alias for each of the commands (functions).</p>
<p>By using Get-Help we can see available parameters along with their descriptions, as well as several examples:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb2.png?w=644&#038;h=343" alt="image" width="644" height="343" border="0" /></a></p>
<p>The functions supports both <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.parameterattribute.valuefrompipeline(VS.85).aspx">ValueFromPipeline</a> and <a href="http://msdn.microsoft.com/en-us/library/system.management.automation.parameterattribute.valuefrompipelinebypropertyname(VS.85).aspx">ValueFromPipelineByPropertyName</a>, which means we can leverage the PowerShell pipeline. Have a look at example 3 on the above image to see how computers can be retrieved from Active Directory using Get-ADComputer, and then piped directly into the Set-DNSServerSearchOrder function.</p>
<p>The functions outputs PowerShell objects, which mean we can use regular PowerShell techniques to work with the data, in example converting the objects to <a href="http://www.windowsitpro.com/blog/powershell-with-a-purpose-blog-36/windows-powershell/making-reports-powershell-part-3-3-141151">HTML</a> or CSV. I typically use Export-Csv to output the data to CSV-files which in turn can be converted to Excel spreadsheets:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb3.png?w=644&#038;h=76" alt="image" width="644" height="76" border="0" /></a></p>
<p>&nbsp;</p>
<p>The functions is using a try/catch construct, using the following logic:</p>
<ol>
<li>Ping the computer, if unsuccessful the property “Connectivity” on the output object is set to “Failed (ping”)</li>
<li>Connect to the computer using WMI, if unsuccessful the property “Connectivity” on the output object is set to “Failed (ping”)</li>
<li>The property “Connectivity” on the output object is set to “Successful” if step 1 and 2 succeeds</li>
<li>Retrieve or change the applicable properties using WMI</li>
</ol>
<p>When working with a large number of computers we can use Sort-Object in PowerShell to filter the output objects based on the Connectivity property, or the sorting functionality in Microsoft Excel if the output objects is piped to a CSV-file.</p>
<p>&nbsp;</p>
<p>The final example I will show is using the Set-NetConnectionId function. On a test-computer we have a network adapter named “Local Area Connection 5”:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb4.png?w=244&#038;h=54" alt="image" width="244" height="54" border="0" /></a></p>
<p>Using Set-ConnectionId we can specify the subnet for which network adapter to perform the change on (the above network adapter has an IP address of 192.168.56.10) and specify the new name of the network connection:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb5.png?w=593&#038;h=165" alt="image" width="593" height="165" border="0" /></a></p>
<p>When the command has run we can see that the connection name for the adapter has changed:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/11/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" src="http://janegilring.files.wordpress.com/2011/11/image_thumb6.png?w=244&#038;h=55" alt="image" width="244" height="55" border="0" /></a></p>
<p>One additional feature that might be included to this function is the ability to provide a hash-table with a mapping of subnets and NetConnectionIds, which will make it easy to create a consistent naming convention for network adapters.</p>
<p>As a final note, all functions has a Logfile parameter, allowing us to log error message to the specified file.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:medium;">Requirements</span></strong></p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ff637750.aspx">Windows PowerShell 2.0</a></li>
<li>ICMP (ping) and WMI firewall openings from the computer running the module to the target computers</li>
<li>Administrator permissions on the target computers</li>
</ul>
<p>To avoid the firewall requirements, a workaround is running the functions from a PowerShell script locally on target computers using a software distribution product like System Center Configuration Manager.<br />
Another option is to run the functions over <a href="http://blog.powershell.no/2010/03/04/enable-and-configure-windows-powershell-remoting-using-group-policy/">PowerShell remoting</a>.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:medium;">Download and feedback</span></strong></p>
<p>The module is available for download on the Codeplex project site <a href="http://psnetadapterconfig.codeplex.com">http://psnetadapterconfig.codeplex.com</a>. Please use the <a href="http://psnetadapterconfig.codeplex.com/discussions">Discussions</a> and <a href="http://psnetadapterconfig.codeplex.com/workitem/list/basic">Issue Tracker</a> sites on the project site to report bugs and feature requests.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:medium;">Resources</span></strong></p>
<p>The functions is too long to walkthrough in a blog-post, so I will direct you to the following resources to get started working with advanced functions and modules in PowerShell:</p>
<p><a href="http://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/">An Introduction to PowerShell Modules</a> by Jonathan Medd.</p>
<p><a href="http://www.windowsitpro.com/blog/powershell-with-a-purpose-blog-36/windows-powershell/scriptmodule-advanced-function-139582">An Example ScriptModule and Advanced Function</a> by Don Jones.</p>
<p><a href="http://jamesone111.wordpress.com/2011/04/10/ten-tips-for-better-powershell-functions/">Ten tips for better PowerShell functions</a> by James O`Neill.</p>
<p><a href="http://jamesone111.wordpress.com/2011/10/24/maximize-the-reuse-of-your-powershell/">Maximize the reuse of your PowerShell</a> by James O`Neill.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/963/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/963/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/963/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=963&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/11/22/introducing-the-powershell-network-adapter-configuration-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/11/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Test-Connection error handling gotcha in PowerShell 2.0</title>
		<link>http://blog.powershell.no/2011/10/23/test-connection-error-handling-gotcha-in-powershell-2-0/</link>
		<comments>http://blog.powershell.no/2011/10/23/test-connection-error-handling-gotcha-in-powershell-2-0/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 11:53:47 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[error handling]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Test-Connection]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/10/23/test-connection-error-handling-gotcha-in-powershell-2-0/</guid>
		<description><![CDATA[The Test-Connection cmdlet in Windows PowerShell was introduced in version 2.0, with the purpose of sending ICMP echo request packets (&#34;pings&#34;) to one or more computers as stated in the cmdlet`s documentation. The cmdlet has a number of useful parameters, for example –Count to specify the number of request packets to send (the default is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=948&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Test-Connection cmdlet in Windows PowerShell was introduced in version 2.0, with the purpose of sending ICMP echo request packets (&quot;pings&quot;) to one or more computers as stated in the cmdlet`s <a href="http://technet.microsoft.com/nb-no/library/dd315259(en-us).aspx">documentation</a>.</p>
<p>The cmdlet has a number of useful parameters, for example –Count to specify the number of request packets to send (the default is 4) and –Quiet to suppress errors and make the cmdlet return either true or false:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/10/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/10/image_thumb.png?w=581&#038;h=198" width="581" height="198" /></a></p>
<p>The –Quiet parameter is very useful when writing a script or function where you only want to perform an operation if the target computer responds to ping requests. A basic example of using this technique:</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">if</span> <span style="color:#000000;">(</span><span style="color:#0000ff;">Test-Connection</span> <span style="color:#000080;">-ComputerName</span> <span style="color:#8a2be2;">doesntexist</span> <span style="color:#000080;">-Count</span> <span style="color:#800080;">1</span><span style="color:#000000;">)</span> <span style="color:#000000;">{</span>
<span style="color:#006400;">#Proceed with script operation</span>
<span style="color:#000000;">}</span></pre>
<p>A few weeks ago I stumbled upon a problem when trying to use a <a href="http://technet.microsoft.com/en-us/library/dd315350.aspx">try/catch</a> block in a PowerShell function. What I wanted to do was to catch a <a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.pingexception(v=vs.80).aspx">ping exception</a> when using Test-Connection. Here is the code I was running:</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">try</span>
<span style="color:#000000;">{</span>
<span style="color:#0000ff;">Test-Connection</span> <span style="color:#000080;">-ComputerName</span> <span style="color:#8a2be2;">doesntexist</span> <span style="color:#000080;">-Count</span> <span style="color:#800080;">1</span> <span style="color:#000080;">-ErrorAction</span> <span style="color:#8a2be2;">stop</span>
<span style="color:#000000;">}</span>            

<span style="color:#00008b;">catch</span> <span style="color:#008080;">[System.Net.NetworkInformation.PingException]</span>
<span style="color:#000000;">{</span>
<span style="color:#8b0000;">'Catched PingException'</span>
<span style="color:#000000;">}</span>            

<span style="color:#00008b;">catch</span>
<span style="color:#000000;">{</span>
<span style="color:#8b0000;">'General catch'</span>
<span style="color:#000000;">}</span></pre>
<p>To my surprise, the PingException wasn`t catched:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/10/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/10/image_thumb1.png?w=535&#038;h=204" width="535" height="204" /></a></p>
<p>I then tried setting up a new System.Net.NetworkInformation.Ping object, to see if the PingException catch worked when using the object`s Send-method:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/10/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/10/image_thumb2.png?w=419&#038;h=202" width="419" height="202" /></a></p>
<p>This worked, so the problem seemed to be related to the Test-Connection cmdlet.</p>
<p>Earlier this week I attended the <a href="http://www.theexpertsconference.com/europe/2011/general-information/2011-powershell-deep-dive/">PowerShell Deep Dive</a> conference in Frankfurt, which was part of The Experts Conference 2011. In the evening the organizers set up a Script Club, where the attendees could explore various PowerShell features together, as well as getting assistance in problem solving. Together with PowerShell MVP Jeff Hicks I sat down and looked into the issue with Test-Connection. As we couldn`t figure out why the PingException catch block didn`t work as expected, we got assistance from a PowerShell team member who was attending the conference, Jason Shirk.</p>
<p>Jason explained to us that there is a bug with Test-Connection`s ErrorAction parameter in PowerShell 2.0, which is resolved in PowerShell 3.0 (not in <a href="http://blogs.msdn.com/b/powershell/archive/2011/09/20/windows-management-framework-3-0-community-technology-preview-ctp-1-available-for-download.aspx">CTP 1</a>). This means my example above will work in the next version of PowerShell. Until then, Jason showed us a workaround for PowerShell 2.0:</p>
<pre class="PowerShellColorizedScript"><span style="color:#00008b;">try</span>
<span style="color:#000000;">{</span>
<span style="color:#0000ff;">Test-Connection</span> <span style="color:#000080;">-ComputerName</span> <span style="color:#8a2be2;">doesntexist</span> <span style="color:#000080;">-Count</span> <span style="color:#800080;">1</span> <span style="color:#000080;">-ErrorAction</span> <span style="color:#8a2be2;">stop</span>
<span style="color:#000000;">}</span>            

<span style="color:#00008b;">catch</span> <span style="color:#008080;">[System.Management.Automation.ActionPreferenceStopException]</span>
<span style="color:#000000;">{</span>
<span style="color:#00008b;">try</span> <span style="color:#000000;">{</span>
<span style="color:#00008b;">throw</span> <span style="color:#ff4500;">$_</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">exception</span>
<span style="color:#000000;">}</span>            

<span style="color:#00008b;">catch</span> <span style="color:#008080;">[System.Net.NetworkInformation.PingException]</span> <span style="color:#000000;">{</span>
<span style="color:#8b0000;">'Catched PingException'</span>
<span style="color:#000000;">}</span>            

<span style="color:#00008b;">catch</span> <span style="color:#000000;">{</span>
<span style="color:#8b0000;">'General catch'</span>
<span style="color:#000000;">}</span>
<span style="color:#000000;">}</span></pre>
<p>The workaround is to go into the inner exception of ActionPreferenceStopException to perform the PingException catch.</p>
<p>Many thanks to Jason Shirk for the assistance. For others, I would highly recommend to attend the <a href="http://www.theexpertsconference.com/us/2012/powershell.html">next</a> PowerShell Deep Dive. In addition to great presentations, you also get to network with other PowerShell enthusiasts, as well as attending the very fun and exciting Script Club in the evenings.</p>
<p>&#160;</p>
<p><strong><font size="2">Related resources</font></strong></p>
<ul>
<li><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/12/powershell-error-handling-and-why-you-should-care.aspx">PowerShell Error Handling and Why You Should Care</a> </li>
<li><a href="http://powershell.com/cs/blogs/tips/archive/2009/09/14/trap-and-try-catch.aspx">Trap and Try/Catch</a> </li>
<li><a href="http://blog.usepowershell.com/category/deep-dive/error-handling/">Error Handling</a> </li>
<li><a href="http://blogs.msdn.com/b/powershell/archive/2006/11/03/erroraction-and-errorvariable.aspx">-ErrorAction and –ErrorVariable</a> </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/948/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/948/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/948/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=948&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/10/23/test-connection-error-handling-gotcha-in-powershell-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/10/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/10/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/10/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>What`s New in Windows PowerShell 3.0</title>
		<link>http://blog.powershell.no/2011/09/25/whats-new-in-windows-powershell-3-0/</link>
		<comments>http://blog.powershell.no/2011/09/25/whats-new-in-windows-powershell-3-0/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 17:03:01 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Windows PowerShell 3.0]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/09/25/whats-new-in-windows-powershell-3-0/</guid>
		<description><![CDATA[Since the release of Windows 7 and Windows Server 2008 R2, Windows PowerShell is included in the operating system and enabled by default. This means Windows PowerShell 3.0 will be available in the next version of Windows. A preview version for developers of the next Windows version was released a few weeks ago, which means [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=936&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Since the release of Windows 7 and Windows Server 2008 R2, Windows PowerShell is included in the operating system and enabled by default. This means Windows PowerShell 3.0 will be available in the next version of Windows.</p>
<p>A preview version for developers of the next Windows version was released a few weeks ago, which means we also got a preview of Windows PowerShell 3.0. The&#160; preview version of the client operating system is available <a href="http://msdn.microsoft.com/en-us/windows/apps/br229516">here</a>, while the server version is available on <a href="http://msdn.microsoft.com/en-us/subscriptions/default.aspx">MSDN</a>.</p>
<p>Earlier this week the PowerShell team <a href="http://blogs.msdn.com/b/powershell/archive/2011/09/20/windows-management-framework-3-0-community-technology-preview-ctp-1-available-for-download.aspx">announced</a> that a Community Technology Preview (CTP 1) is available for <a href="http://www.microsoft.com/download/en/details.aspx?id=27548">download</a>, which means we can also try out PowerShell 3.0 on computers running Windows 7 and Windows Server 2008 R2. The <a href="http://support.microsoft.com/kb/968929/en-us">current version</a> of the Windows Management Framework includes Windows PowerShell 2.0, Windows Remote Management (WinRM) 2.0 and Background Intelligent Transfer Service (BITS) 4.0, while the new Windows Management Framework CTP contains Windows PowerShell 3.0, Windows Management Instrumentation (WMI) and Windows Remote Management.</p>
<p>Some of the most important new features in PowerShell 3.0 is listed in the previous mentioned <a href="http://blogs.msdn.com/b/powershell/archive/2011/09/20/windows-management-framework-3-0-community-technology-preview-ctp-1-available-for-download.aspx">announcement</a> from the PowerShell team, but there is also a huge number of other new features.</p>
<p>A great number of persons in the PowerShell community has already started to discover and write about the new features. One of them is the new Windows PowerShell Web Access in the next version of Windows Server, which I`ve previously written an <a href="http://blog.powershell.no/2011/09/14/windows-powershell-web-access/">article</a> about.</p>
<p>Instead of listing all the articles I`ve discovered so far in this article, I posted them as a TechNet Wiki article as part of the existing PowerShell V3 Guide:</p>
<p><a href="http://social.technet.microsoft.com/wiki/contents/articles/powershell-v3-guide.aspx">TechNet Wiki: PowerShell V3 Guide</a>     <br /><a href="http://social.technet.microsoft.com/wiki/contents/articles/powershell-v3-featured-articles.aspx">TechNet Wiki: PowerShell V3 Featured articles</a></p>
<p>I would like to encourage you to contribute to the TechNet Wiki article when you discover new writings about Windows PowerShell 3.0.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/936/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/936/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/936/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=936&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/09/25/whats-new-in-windows-powershell-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows PowerShell Web Access</title>
		<link>http://blog.powershell.no/2011/09/14/windows-powershell-web-access/</link>
		<comments>http://blog.powershell.no/2011/09/14/windows-powershell-web-access/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 22:48:08 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Windows PowerShell 3.0]]></category>
		<category><![CDATA[Windows PowerShell v3]]></category>
		<category><![CDATA[Windows PowerShell Web Access]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/09/14/windows-powershell-web-access/</guid>
		<description><![CDATA[In the Windows Server Developer Preview (“Windows 8 Server”) released recently, a preview version of Windows PowerShell 3.0 is also included. In addition to the many news in the next version of PowerShell which I won`t cover in this article is a brand new feature named Windows PowerShell Web Access. As the name indicates this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=931&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the Windows Server Developer Preview (“Windows 8 Server”) <a href="http://msdn.microsoft.com/en-us/windows/home/">released recently</a>, a preview version of Windows PowerShell 3.0 is also included. In addition to the many news in the next version of PowerShell which I won`t cover in this article is a brand new feature named Windows PowerShell Web Access. As the name indicates this makes it possible to use Windows PowerShell using a browser from a computer, in addition to mobile devices.</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:small;">Installation, configuration and user experience</span></strong></p>
<p>Windows PowerShell Web Access is available as a feature in the new Server Manager:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb.png?w=420&#038;h=216" alt="image" width="420" height="216" border="0" /></a></p>
<p>After the feature is installed, some additional steps which is described in %systemroot%\Web\PowerShellWebAccess\wwwroot\README.txt is required:</p>
<blockquote><p>To complete the installation of Windows PowerShell Web Access, please perform the<br />
following tasks:</p>
<p>1) Open a Windows PowerShell console with elevated user rights.</p>
<p>To do this, right click on PowerShell.exe, or a Windows PowerShell shortcut,<br />
and then click &#8220;Run as administrator.&#8221;</p>
<p>2) Be sure your Windows PowerShell environment is configured to run scripts.</p>
<p>For more information, see &#8220;Running Scripts from Within Windows PowerShell&#8221;<br />
(<a href="http://technet.microsoft.com/en-us/library/ee176949.aspx)">http://technet.microsoft.com/en-us/library/ee176949.aspx)</a>.</p>
<p>3) Run the following script:</p>
<p>${env:\windir}\Web\PowerShellWebAccess\wwwroot\setup.ps1</p>
<p>This is typically C:\Windows\Web\PowerShellWebAccess\wwwroot\setup.ps1</p>
<p>4) Create a server certificate.</p>
<p>For a test server, you can create a self-signed certificate by using the<br />
Web Server (IIS) management console:</p>
<p>(${env:\windir}\system32\inetsrv\InetMgr.exe)</p>
<p>From within the IIS management console, open the Web Servers parent node.<br />
This is typically the node immediately under the Start Page node.</p>
<p>In the results pane, select &#8220;Server Certificates&#8221; on the center pane, then<br />
select &#8220;Create Self-Signed Certificate.&#8221;</p>
<p>5) Create an SSL binding.</p>
<p>In the IIS management console, select &#8220;Default Web Site,&#8221; and then click<br />
&#8220;Bindings&#8221; on the &#8220;Actions&#8221; menu. Click &#8220;Add,&#8221; select &#8220;https&#8221; on<br />
the &#8220;Type&#8221; pull-down menu, and then in the &#8220;SSL certificate&#8221; list, select the<br />
certificate that you created in step 4.</p>
<p>For more information about how to create a server certificate and an SSL binding,<br />
see &#8220;How to Set Up SSL on IIS 7&#8243;<br />
(<a href="http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7">http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7</a>).</p></blockquote>
<p>The setup.ps1 script will create a new Web Application Pool and a new Web Application in Internet Information Services:</p>
<p><em>$ErrorActionPreference = &#8216;stop&#8217;</em></p>
<p><em>$wwwroot = &#8220;${env:\windir}\Web\PowerShellWebAccess\wwwroot&#8221;</em></p>
<p><em>if (!(Test-Path $wwwroot))<br />
{<br />
Write-Error &#8220;PowerShell Web Access has not been installed on this machine&#8221;<br />
}</em></p>
<p><em>#<br />
# Copy localized files to neutral location<br />
#<br />
foreach ($target in ($wwwroot,&#8221;$wwwroot\bin&#8221;))<br />
{<br />
foreach ($culture in (&#8220;en&#8221;,&#8221;en-us&#8221;,&#8221;qps-ploc&#8221;))<br />
{<br />
$source = &#8220;$target\$culture&#8221;</em></p>
<p><em>        if (Test-Path $source)<br />
{<br />
copy &#8220;$source\*&#8221; $target<br />
}<br />
}<br />
}</em></p>
<p><em>#<br />
# Setup ASP.NET application<br />
#<br />
Import-Module WebAdministration</em></p>
<p><em>if (Get-WebApplication -name &#8220;pswa&#8221;)<br />
{<br />
Write-Error &#8220;The Windows PowerShell Web Access application (pswa) already exists on this machine&#8221;<br />
}</em></p>
<p><em>New-WebAppPool &#8220;pswa&#8221;</em></p>
<p><em>New-WebApplication -Name &#8220;pswa&#8221; -Site &#8220;Default Web Site&#8221; -PhysicalPath $wwwroot -ApplicationPool &#8220;pswa&#8221;</em></p>
<p>&nbsp;</p>
<p>If the script runs successfully, it returns the following output:</p>
<p><em>PS C:\&gt; C:\Windows\Web\PowerShellWebAccess\wwwroot\setup.ps1</em></p>
<p><em>Name                     State        Applications</em></p>
<p><em>&#8212;-                     &#8212;&#8211;        &#8212;&#8212;&#8212;&#8212;</em></p>
<p><em>pswa                     Started</em></p>
<p><em>Path             : /pswa</em></p>
<p><em>ApplicationPool  : pswa</em></p>
<p><em>EnabledProtocols : http</em></p>
<p><em>PhysicalPath     : C:\Windows\Web\PowerShellWebAccess\wwwroot</em></p>
<p>&nbsp;</p>
<p>The final configuration step is to create and add a binding to a certificate as described in the <a href="http://learn.iis.net/page.aspx/144/how-to-set-up-ssl-on-iis-7">link</a> provided in the readme.txt file.</p>
<p>When done, you can access the feature by using the URL https://&lt;servername&gt;/pswa :</p>
<p>&nbsp;</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb1.png?w=454&#038;h=364" alt="image" width="454" height="364" border="0" /></a></p>
<p>Specify credentials and a computer name to connect to, then hit the “Sign in” button. Another connection type available is “Connection URI”:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb2.png?w=219&#038;h=63" alt="image" width="219" height="63" border="0" /></a></p>
<p>&nbsp;</p>
<p>The options available under “Advanced Options”:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb3.png?w=313&#038;h=239" alt="image" width="313" height="239" border="0" /></a></p>
<p>&nbsp;</p>
<p>The available authentication types:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb4.png?w=244&#038;h=170" alt="image" width="244" height="170" border="0" /></a></p>
<p>&nbsp;</p>
<p>After signing in, you`ll be presented with a console looking like this:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb5.png?w=644&#038;h=453" alt="image" width="644" height="453" border="0" /></a></p>
<p>&nbsp;</p>
<p>The console host is called “ServerRemoteHost”:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/09/image_thumb6.png?w=533&#038;h=251" alt="image" width="533" height="251" border="0" /></a></p>
<p>&nbsp;</p>
<p>Tab-completion works just like in the regular Windows PowerShell console host, and we also have access to the history by pressing the up and down arrows. To logoff, there is a Logoff-button in the bottom right corner.</p>
<p>The PowerShell Web Access also works perfectly fine on mobile devices. I`ve tried it on a Windows Phone 7 device, but unfortunately I don`t have any screen captures to share yet.</p>
<p>Congratulations to the Windows PowerShell team for providing this excellent new feature!</p>
<p><em>Note: Please be aware that this is a feature in a prerelease version of the next version of Windows Server, and thus the feature might be different in the final product.</em></p>
<p><span style="text-decoration:underline;">Update 15.09.2011</span></p>
<p>Screen capture from PowerShell Web Access running on an Iphone:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/09/ps_web_screen_capture.jpg"><img class="alignleft size-medium wp-image-933" title="PS_Web_screen_capture" src="http://janegilring.files.wordpress.com/2011/09/ps_web_screen_capture.jpg?w=198&#038;h=300" alt="" width="198" height="300" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/931/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/931/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/931/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=931&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/09/14/windows-powershell-web-access/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/09/ps_web_screen_capture.jpg?w=198" medium="image">
			<media:title type="html">PS_Web_screen_capture</media:title>
		</media:content>
	</item>
		<item>
		<title>Hyper-V: How to unbind a physical NIC from a Virtual Switch using WMI and PowerShell</title>
		<link>http://blog.powershell.no/2011/08/30/hyper-v-how-to-unbind-a-physical-nic-from-a-virtual-switch-using-wmi-and-powershell/</link>
		<comments>http://blog.powershell.no/2011/08/30/hyper-v-how-to-unbind-a-physical-nic-from-a-virtual-switch-using-wmi-and-powershell/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 18:50:33 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[Hyper-V R2]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[hyper-v]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[unbind ethernet port]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/08/30/hyper-v-how-to-unbind-a-physical-nic-from-a-virtual-switch-using-wmi-and-powershell/</guid>
		<description><![CDATA[If you`re not already familiar with networking in Microsoft Hyper-V I would recommend you to have a look at this whitepaper from Microsoft, which described how networking works in Hyper-V. The following solution will describe a problem which might occur when configuring virtual networks in Hyper-V. Consider the following scenario: You`re about to configure a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=912&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you`re not already familiar with networking in Microsoft Hyper-V I would recommend you to have a look at <a href="http://www.microsoft.com/download/en/details.aspx?id=9843">this</a> whitepaper from Microsoft, which described how networking works in Hyper-V.</p>
<p>The following solution will describe a problem which might occur when configuring virtual networks in Hyper-V. Consider the following scenario:</p>
<ul>
<li>You`re about to configure a new external virtual network in Hyper-V using Hyper-V Manager remotely from another computer. This is a common scenario when working with the Core edition of Windows Server 2008/2008 R2.</li>
<li>When selecting the physical NIC to bind to the new virtual network, you choose the adapter which you are remotely connecting to the Hyper-V host through.</li>
</ul>
<p>What happens in this scenario is that the Virtual Switch Management Service is <a href="http://msdn.microsoft.com/en-us/library/cc136768(v=vs.85).aspx">binding</a> the external Ethernet port for the selected NIC to the Microsoft Windows Virtualization network subsystem. What normally should happen next is that the converted Ethernet port should be bound to the new virtual switch you are creating. However, this never happens since the NIC you are remotely managing the Hyper-V host through is no longer available in the parent operating system. This leaves the NIC in an “orphaned” state, since you cannot use the NIC in the parent operating system, and it`s not in use by any virtual networks.</p>
<p>To resolve this issue, whether using the full GUI version or the Core version of Windows Server, you need to manually unbind the the Ethernet port. There is an UnbindExternalEthernetPort available on the Msvm_VirtualSwitchManagementService WMI class, which is fully documented in <a href="http://msdn.microsoft.com/en-us/library/cc136981(v=vs.85).aspx">this</a> article on MSDN.</p>
<p>To invoke the WMI method we can use Windows PowerShell. To ease the procedure I`ve created a PowerShell function you can use if you ever come into the need for manually unbinding an external Ethernet port in Hyper-V:</p>
<p>&nbsp;</p>
<p><span style="color:#00008b;">Function</span><span style="color:#000000;"> </span><span style="color:#8a2be2;">Select-List</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#000000;">    </span><span style="color:#00008b;">Param</span><span style="color:#000000;">   </span><span style="color:#000000;">(</span><span style="color:#a9a9a9;">[</span><span style="color:#add8e6;">Parameter</span><span style="color:#000000;">(</span><span style="color:#000000;">Mandatory</span><span style="color:#a9a9a9;">=</span><span style="color:#ff4500;">$true</span><span style="color:#000000;">  </span><span style="color:#a9a9a9;">,</span><span style="color:#000000;">valueFromPipeline</span><span style="color:#a9a9a9;">=</span><span style="color:#ff4500;">$true</span><span style="color:#000000;"> </span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">]</span><span style="color:#ff4500;">$InputObject</span><span style="color:#a9a9a9;">,</span><span style="color:#000000;"> </span><br />
<span style="color:#000000;">             </span><span style="color:#a9a9a9;">[</span><span style="color:#add8e6;">Parameter</span><span style="color:#000000;">(</span><span style="color:#000000;">Mandatory</span><span style="color:#a9a9a9;">=</span><span style="color:#ff4500;">$true</span><span style="color:#000000;">)</span><span style="color:#a9a9a9;">]</span><span style="color:#ff4500;">$Property</span><span style="color:#000000;">)</span></p>
<p><span style="color:#000000;">    </span><span style="color:#00008b;">begin</span><span style="color:#000000;">   </span><span style="color:#000000;">{</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;"> </span><span style="color:#000000;">@(</span><span style="color:#000000;">)</span><span style="color:#000000;">  </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">    </span><span style="color:#00008b;">process</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$i</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">+=</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$inputobject</span><span style="color:#000000;">  </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">    </span><span style="color:#00008b;">end</span><span style="color:#000000;">     </span><span style="color:#000000;">{</span><span style="color:#000000;"> </span><span style="color:#00008b;">if</span><span style="color:#000000;"> </span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">count</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">-eq</span><span style="color:#000000;"> </span><span style="color:#800080;">1</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">[</span><span style="color:#800080;">0</span><span style="color:#a9a9a9;">]</span><span style="color:#000000;">}</span><span style="color:#000000;"> </span><span style="color:#00008b;">elseif</span><span style="color:#000000;"> </span><span style="color:#000000;">(</span><span style="color:#ff4500;">$i</span><span style="color:#a9a9a9;">.</span><span style="color:#000000;">count</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">-gt</span><span style="color:#000000;"> </span><span style="color:#800080;">1</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#000000;">                  </span><span style="color:#ff4500;">$Global:counter</span><span style="color:#a9a9a9;">=</span><span style="color:#800080;">-1</span><br />
<span style="color:#000000;">                  </span><span style="color:#ff4500;">$Property</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">@(</span><span style="color:#000000;">@{</span><span style="color:#000000;">Label</span><span style="color:#a9a9a9;">=</span><span style="color:#8b0000;">&#8220;ID&#8221;</span><span style="color:#000000;">;</span><span style="color:#000000;"> </span><span style="color:#000000;">Expression</span><span style="color:#a9a9a9;">=</span><span style="color:#000000;">{</span><span style="color:#000000;"> </span><span style="color:#000000;">(</span><span style="color:#ff4500;">$global:Counter</span><span style="color:#a9a9a9;">++</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">}</span><span style="color:#000000;">}</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">+</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$Property</span><br />
<span style="color:#000000;">                  </span><span style="color:#0000ff;">format-table</span><span style="color:#000000;"> </span><span style="color:#000080;">-inputObject</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$i</span><span style="color:#000000;"> </span><span style="color:#000080;">-autosize</span><span style="color:#000000;"> </span><span style="color:#000080;">-property</span><span style="color:#000000;"> </span><span style="color:#ff4500;">$Property</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">|</span><span style="color:#000000;"> </span><span style="color:#0000ff;">out-host</span><br />
<span style="color:#000000;">                 </span><span style="color:#ff4500;">$Response</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Read-Host</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;Select NIC to unbind&#8221;</span><br />
<span style="color:#000000;">                  </span><span style="color:#00008b;">if</span><span style="color:#000000;"> </span><span style="color:#000000;">(</span><span style="color:#ff4500;">$response</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">-gt</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;&#8221;</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><span style="color:#000000;"> </span><br />
<span style="color:#000000;">                        </span><span style="color:#ff4500;">$I</span><span style="color:#a9a9a9;">[</span><span style="color:#ff4500;">$response</span><span style="color:#a9a9a9;">]</span><span style="color:#000000;"> </span><br />
<span style="color:#000000;">                  </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">              </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">            </span><span style="color:#000000;">}</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#00008b;">function</span><span style="color:#000000;"> </span><span style="color:#8a2be2;">Remove-HVExternalEthernetPort</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span></p>
<p><span style="color:#ff4500;">$ExternalEthernetPort</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Get-WMIObject</span><span style="color:#000000;"> </span><span style="color:#000080;">-class</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;Msvm_ExternalEthernetPort&#8221;</span><span style="color:#000000;"> </span><span style="color:#000080;">-namespace</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;root\virtualization&#8221;</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">|</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Select-List</span><span style="color:#000000;"> </span><span style="color:#000080;">-Property</span><span style="color:#000000;"> </span><span style="color:#8a2be2;">name</span></p>
<p><span style="color:#ff4500;">$HVSwitchObj</span><span style="color:#000000;"> </span><span style="color:#a9a9a9;">=</span><span style="color:#000000;"> </span><span style="color:#0000ff;">Get-WMIObject</span><span style="color:#000000;"> </span><span style="color:#000080;">-class</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;MSVM_VirtualSwitchManagementService&#8221;</span><span style="color:#000000;"> </span><span style="color:#000080;">-namespace</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;root\virtualization&#8221;</span></p>
<p><span style="color:#00008b;">if</span><span style="color:#000000;"> </span><span style="color:#000000;">(</span><span style="color:#ff4500;">$ExternalEthernetPort</span><span style="color:#000000;">)</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#006400;">$HVSwitchObj.UnbindExternalEthernetPort()</span><br />
<span style="color:#000000;">}</span><br />
<span style="color:#00008b;">else</span><span style="color:#000000;"> </span><span style="color:#000000;">{</span><br />
<span style="color:#00008b;">throw</span><span style="color:#000000;"> </span><span style="color:#8b0000;">&#8220;An error occured. Choose a valid ExternalEthernetPort from the provided list&#8221;</span><br />
<span style="color:#000000;">}</span></p>
<p><span style="color:#000000;">}</span></p>
<p><span style="font-size:xx-small;">Note: The Select-List function is a modified version of the Select-List function available in the PowerShell Management Library for Hyper-V available on CodePlex (see link below).</span></p>
<p>You can either paste the function into a PowerShell session or save it into ps1-file and <a href="http://technet.microsoft.com/en-us/library/ee176949.aspx#ECAA">dot source</a> it. When done you can invoke the function like this:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/08/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" src="http://janegilring.files.wordpress.com/2011/08/image_thumb4.png?w=566&#038;h=148" alt="image" width="566" height="148" border="0" /></a></p>
<p>When you`ve entered the index number for the NIC you want to remove, a return value of 0 indicates the operation succeeded. Any other value indicates an error (look at the previous mentioned <a href="http://msdn.microsoft.com/en-us/library/cc136981(v=vs.85).aspx">MSDN-article</a> for more information).</p>
<p>&nbsp;</p>
<p><strong><span style="font-size:x-small;">More resources on managing Hyper-V using PowerShell</span></strong></p>
<p><a href="http://pshyperv.codeplex.com/">PowerShell Management Library for Hyper-V</a> – this is an excellent PowerShell module for managing Hyper-V available on CodePlex</p>
<p><a href="http://technet.microsoft.com/en-us/library/gg650469.aspx">System Center Virtual Machine Manager 2012: Scripting</a></p>
<p><a href="http://technet.microsoft.com/en-us/library/cc764259.aspx">System Center Virtual Machine Manager 2008 R2: Scripting</a></p>
<p><a href="http://blogs.msdn.com/b/taylorb/archive/2008/05/26/hyper-v-wmi-using-powershell-scripts-part-5-creating-virtual-switchs-networks.aspx">Hyper-V WMI Using PowerShell Scripts</a></p>
<p><a href="http://blogs.msdn.com/b/virtual_pc_guy/archive/2009/02/24/script-determining-virtual-switch-type-under-hyper-v.aspx">Script: Determining Virtual Switch Type Under Hyper-V</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/912/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/912/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/912/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=912&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/08/30/hyper-v-how-to-unbind-a-physical-nic-from-a-virtual-switch-using-wmi-and-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/08/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>How to automatically convert Windows PowerShell transcripts into script-files</title>
		<link>http://blog.powershell.no/2011/08/12/how-to-automatically-convert-windows-powershell-transcripts-into-script-files/</link>
		<comments>http://blog.powershell.no/2011/08/12/how-to-automatically-convert-windows-powershell-transcripts-into-script-files/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 20:02:01 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[transcript]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/08/12/how-to-automatically-convert-windows-powershell-transcripts-into-script-files/</guid>
		<description><![CDATA[In Windows PowerShell we can use the Start-Transcript cmdlet to record PowerShell sessions to a text-file. This will record both the commands you`ve run as well as the output from the commands. Windows PowerShell MVP Jeffery Hicks recently wrote a great tip in his Friday Fun series on his blog, which tells you how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=908&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Windows PowerShell we can use the <a href="http://technet.microsoft.com/en-us/library/dd347721.aspx">Start-Transcript</a> cmdlet to record PowerShell sessions to a text-file. This will record both the commands you`ve run as well as the output from the commands.</p>
<p>Windows PowerShell MVP Jeffery Hicks recently wrote a <a href="http://jdhitsolutions.com/blog/2011/08/friday-fun-export-transcript-to-script/">great tip</a> in his <a href="http://jdhitsolutions.com/blog/category/friday-fun/">Friday Fun series</a> on his blog, which tells you how to convert a PowerShell transcript into a PowerShell script file. That is, you`ll get a ps1-file which contains the commands extracted from the transcript. Combined with an object event which triggers when PowerShell exits, this can be set up to happen automatically. Jeff actually blogged <a href="http://jdhitsolutions.com/blog/2009/09/powershell-exit-stage-left/">another</a> Friday Fun tip a couple years ago which describes how to set up such an object event.</p>
<p>Lets have a look at an example on how this would work. First we launch a new PowerShell session and executes a few commands:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/08/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/08/image_thumb.png?w=244&#038;h=128" width="244" height="128" /></a></p>
<p>&#160;</p>
<p>When we exit PowerShell we`ll get two files in a specified log directory:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/08/image1.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;margin:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/08/image_thumb1.png?w=244&#038;h=68" width="244" height="68" /></a></p>
<p>&#160;</p>
<p>The transcript file (txt-file) contains all commands, errors and output from our session:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/08/image2.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/08/image_thumb2.png?w=483&#038;h=308" width="483" height="308" /></a></p>
<p>&#160;</p>
<p>The PowerShell script file (ps1-file) contains a script header and the commands from our session:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/08/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/08/image_thumb3.png?w=413&#038;h=430" width="413" height="430" /></a></p>
<p>&#160;</p>
<p>This means that every PowerShell session automatically generates a PowerShell script file which can be the foundation for a new script.</p>
<p>To set this up you first need to copy the Export-Transcript PowerShell function from Jeff`s <a href="http://jdhitsolutions.com/blog/2011/08/friday-fun-export-transcript-to-script/">blog-post</a> and add it to your <a href="http://technet.microsoft.com/en-us/library/ee692764.aspx">PowerShell profile</a> (Microsoft.PowerShell_profile.ps1), in addition to the following:</p>
<p>&#160;</p>
<div style="border-bottom:black 1px solid;border-left:black 1px solid;width:750px;overflow:auto;border-top:black 1px solid;border-right:black 1px solid;padding:5px;">
<table border="0" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<td valign="top">
<div style="background:#cecece;padding:5px;"><font face="Consolas"><font color="#000000">001                  <br />002                   <br />003                   <br />004                   <br />005                   <br />006                   <br />007                   <br />008                   <br />009</font></font>               </div>
</td>
<td valign="top" nowrap="nowrap">
<div style="background:#fcfcfc;padding:5px;"><font face="Consolas"><span><font color="#006400"><font>#Define variable for the transcript path, which we`ll use to generate the path to the ps1-file</font></font></span><font>                  <br /><span><font color="#ff0000">$transcriptlog</font></span><span><font color="#000000">&#160;</font></span><span><font color="#a9a9a9">=</font></span><font color="#000000"><span>&#160;</span><span>(</span></font><span><font color="#8b0000">&quot;C:\PS-logs\PS-Transcript_&quot;</font></span><span><font color="#a9a9a9">+</font></span><span><font color="#8b0000">&quot;{0:yyyy-MM-dd_HH-mm-ss}&quot;</font></span><span><font color="#000000">&#160;</font></span><span><font color="#a9a9a9">-f</font></span><font color="#000000"><span>&#160;</span><span>(</span></font><span><font color="#0000ff">Get-Date</font></span><span><font color="#000000">)</font></span><span><font color="#a9a9a9">+</font></span><span><font color="#8b0000">&quot;.txt&quot;</font></span><span><font color="#000000">)</font></span>                   <br /><span><font color="#0000ff">Start-Transcript</font></span><span><font color="#000000">&#160;</font></span><span><font color="#00008b">-Path</font></span><span><font color="#000000">&#160;</font></span><span><font color="#ff0000">$transcriptlog</font></span><span><font color="#000000">&#160;</font></span><span><font color="#a9a9a9">|</font></span><span><font color="#000000">&#160;</font></span><span><font color="#0000ff">Out-Null</font></span>                   </p>
<p><span><font color="#006400">#Export transcript to ps1-file on exit</font></span>                   <br /><span><font color="#0000ff">Register-EngineEvent</font></span><span><font color="#000000">&#160;</font></span><span><font color="#ff00ff">PowerShell.Exiting</font></span><span><font color="#000000">&#160;</font></span><span><font color="#00008b">–action</font></span><font color="#000000"><span>&#160;</span><span>{</span></font>                   <br /></font></font><font><font face="Consolas"><font color="#0000ff"><span>Stop-Transcript</span>                     <br /><span>Export-Transcript</span></font><span><font color="#000000">&#160;</font></span><span><font color="#00008b">-Transcript</font></span><span><font color="#000000">&#160;</font></span><span><font color="#ff0000">$transcriptlog</font></span><span><font color="#000000">&#160;</font></span><span><font color="#00008b">-Script</font></span><font color="#000000"><span>&#160;</span><span>(</span><span>(</span></font><span><font color="#ff0000">$transcriptlog</font></span><span><font color="#a9a9a9">.</font></span><font color="#000000"><span>Replace</span><span>(</span></font><span><font color="#8b0000">&quot;Transcript&quot;</font></span><span><font color="#a9a9a9">,</font></span><span><font color="#8b0000">&quot;Script&quot;</font></span><font color="#000000"><span>)</span><span>)</span></font><span><font color="#a9a9a9">.</font></span><font color="#000000"><span>Replace</span><span>(</span></font><span><font color="#8b0000">&quot;txt&quot;</font></span><span><font color="#a9a9a9">,</font></span><span><font color="#8b0000">&quot;ps1&quot;</font></span></font></font><font face="Consolas"><font><font color="#000000"><span>)</span><span>)</span>                     <br /><span>}</span><span>&#160;</span></font><span><font color="#a9a9a9">|</font></span><span><font color="#000000">&#160;</font></span><span><font color="#0000ff">Out-Null</font></span><font color="#000000"> </font></font></font></div>
</td>
</tr>
</tbody>
</table></div>
<p>&#160;</p>
<p>While this is very useful, there is a few gotcha`s to be aware of:</p>
<ul>
<li>This doesn`t work if your exiting PowerShell using the X button. The PowerShell.Exiting event is only triggered when using the exit command. </li>
<li>This doesn`t work in the Windows PowerShell ISE, since that PowerShell host doesn`t support transcripts. </li>
<li>If you`ve <a href="http://huddledmasses.org/powershell-power-user-tips-a-better-prompt/">customized</a> your PowerShell prompt, you`ll need to tweak the Export-Transcript function to match the last letter in your prompt. </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/908/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/908/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/908/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=908&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/08/12/how-to-automatically-convert-windows-powershell-transcripts-into-script-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/08/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/08/image_thumb1.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/08/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/08/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting starting with Cisco UCS PowerShell Toolkit</title>
		<link>http://blog.powershell.no/2011/07/23/getting-starting-with-cisco-ucs-powershell-toolkit/</link>
		<comments>http://blog.powershell.no/2011/07/23/getting-starting-with-cisco-ucs-powershell-toolkit/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 18:03:05 +0000</pubDate>
		<dc:creator>Jan Egil Ring</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Windows PowerShell]]></category>
		<category><![CDATA[Cisco UCS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[XML API]]></category>

		<guid isPermaLink="false">https://janegilring.wordpress.com/2011/07/23/getting-starting-with-cisco-ucs-powershell-toolkit/</guid>
		<description><![CDATA[Cisco – widely known as a networking infrastructure vendor – entered the blade server market in 2009. Their offering is called Unified Computing System, described by Gartner as a fabric-enabled, enterprise-class platform with good integration of networking, virtualization, management tools and storage. On the 2011 Gartner Magic Quadrant for Blade Servers they`re defined as a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=891&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Cisco – widely known as a networking infrastructure vendor – entered the blade server market in 2009. Their offering is called Unified Computing System, described by Gartner as <em>a fabric-enabled, enterprise-class platform with good integration of networking, virtualization, management tools and storage</em>. On the 2011 Gartner <a href="http://www.gartner.com/technology/media-products/reprints/hp/vol3/article7/article7.html">Magic Quadrant for Blade Servers</a> they`re defined as a visionary vendor, and it will be interesting to see if they can challenge the 3 leaders Dell, IBM and HP.</p>
<p>The Cisco Unified Computing System is quite different from traditional blade systems, in that the server profiles (so called service profiles) is independent from the physical blade servers. An example to describe what this means is that a physical blade server might fail and be replaced, while the server profile keeps unique ID`s like MAC addresses, World Wide Names (WWN`s) and so on. If using boot from SAN rather than local disk drives, physical interaction is not required to get the system back online if a spare blade server is available.</p>
<p>&#160;</p>
<p><strong>The UCS core components</strong></p>
<ul>
<li>Blade Chassis – Blade server enclosure </li>
<li>Cisco UCS Manager – Embedded into the Fabric Interconnect. Provides management capabilities </li>
<li>Cisco UCS fabric interconnect – Provides networking (Ethernet/Fibre Channel) and management for connected blades and chassis` </li>
<li>Fabric Extenders – Provides connection between the interconnect fabric and the blade enclosures </li>
</ul>
<p>A photo showing the Cisco Unified Computing System architecture is available <a href="http://www.cisco.com/assets/cdc_content_elements/images/products/data_center/ucs_component_large_photo.html">here</a> (cisco.com). In regards of management, all aspects of Cisco UCS can be managed through an XML API. This makes it possible for 3rd parties to offer management solutions, and integration with other products. An example of a 3rd party product is the Cisco UCS Iphone/Ipad application for managing and monitoring the system. Links for more information on the management model and the XML API is available in the resources section in the bottom of this article.</p>
<p>&#160;</p>
<p><strong><font size="2">Cisco UCS PowerShell Toolkit</font></strong></p>
<p>Based on a customer request from an early adaptor, Cisco provided PowerShell support for managing their UCS product through the XMP API. With the Microsoft automation strategy in mind, this was an excellent choice. It will make integration into products like System Center Orchestrator (formerly Opalis) very easy, and the also make the product attractive for enterprises. The PowerShell administration tool is available as a module part of the Cisco UCS PowerShell Toolkit.</p>
<p>A great way to learn using the Cisco UCS PowerShell Toolkit is downloading the <a href="http://developer.cisco.com/web/unifiedcomputing/ucsemulatordownload">Cisco UCS Emulator</a>. This is a virtual machine image which can be imported into VMware Player or VirtualBox. When the VM is up and running you can access both the UCS Manager (http URL is shown when the VM has started) and the XML API. A great feature is that you can import the configuration from a production UCS to simulate administration changes in a lab environment.</p>
<p>Next, you can download the latest versions of both the Cisco UCS PowerShell Toolkit (aka UCSMPowerTool) and the PowerShell Toolkit User Guide from <a href="http://developer.cisco.com/web/unifiedcomputing/pshell-download">this</a> website.</p>
<p>The installer will by default put the files in %programfiles%\Cisco\UCSMPowerToolkit:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image3.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb3.png?w=404&#038;h=196" width="404" height="196" /></a></p>
<p>CiscoUCSPS.dll is the assembly which can be imported as a module in Windows PowerShell 2.0 and later. You can either double-click LaunchUCSPS.bat or invoke StartUCSPS.ps1 from an existing PowerShell session to get started. Alternatively you can use Import-Module from an existing PowerShell session like this:    <br />Import-Module “C:\Program Files (x86)\Cisco\UCSMPowerToolkit\CiscoUCSPS.dll”</p>
<p>I would suggest rather than installing to the Program Files folder (which requires administrative privileges), that Cisco generates a <a href="http://msdn.microsoft.com/en-us/library/dd878337(v=vs.85).aspx">module manifest</a> and install the module to the default PowerShell module directory (C:\Users\&lt;username&gt;\Documents\WindowsPowerShell\Modules).</p>
<p>When the module is imported we can use Get-Command with the –Module parameter to list all command inside the CiscoUCSPS module:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image4.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb4.png?w=530&#038;h=484" width="530" height="484" /></a></p>
<p>The current version of the module contains 149 cmdlets, so all commands are not shown in the above screenshot.</p>
<p>The first thing we need to do is connect to an instance of the UCS Manager. If using the Cisco UCS Emulator you can view the management&#160; IP address when the virtual machine has started:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image5.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb5.png?w=480&#038;h=236" width="480" height="236" /></a></p>
<p>We then use the Connect-UCSM cmdlet to connect to the UCS Manager:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image6.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb6.png?w=573&#038;h=355" width="573" height="355" /></a></p>
<p>The default credentials for the UCS Emulator is config/config.</p>
<p>Next we can start exploring cmdlets like Get-Blade and Get-Vlan. Note that by default the cmdlets outputs a lot of information for each object, so I`ve picked out a few properties to show using Format-Table:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image7.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb7.png?w=580&#038;h=284" width="580" height="284" /></a></p>
<p>Going further it`s easy to automate things like adding VLAN and assigning it to a vNIC template:</p>
<p><a href="http://janegilring.files.wordpress.com/2011/07/image8.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://janegilring.files.wordpress.com/2011/07/image_thumb8.png?w=583&#038;h=465" width="583" height="465" /></a></p>
<p>&#160;</p>
<p>Although the PowerShell coverage isn`t 100% yet, it`s possible to administer all aspect of the UCS directly through the XML API from PowerShell using the Invoke-XmlCommand cmdlet.</p>
<p>&#160;</p>
<p><strong><font size="3">Resources</font></strong></p>
<p><a href="http://www.cisco.com/en/US/netsol/ns944/index.html">Cisco Unified Computing</a></p>
<p><a href="http://www.cisco.com/en/US/prod/collateral/ps10265/ps10276/white_paper_c11-555663_ps10280_Products_White_Paper.html">A Platform Built for Server Virtualization: Cisco Unified Computing System</a></p>
<p><a href="http://developer.cisco.com/web/unifiedcomputing/forums">Cisco Unified Computing Forums</a></p>
<p><a href="http://blogs.cisco.com/datacenter/automating-cisco-ucs-management-with-windows-powershell/">Automating Cisco UCS Management with Windows PowerShell</a></p>
<p><a href="http://powerscripting.wordpress.com/2011/07/18/episode-154-josh-heller-from-cisco-on-ucs-and-powershell/">PowerScripting Podcast &#8211; Josh Heller from Cisco on UCS and PowerShell</a></p>
<p><a href="http://developer.cisco.com/documents/2048839/2049143/Cisco+UCS+Manager+XML+API+Programmer's+Guide.pdf?redirect=http%3a%2f%2fdeveloper.cisco.com%2fweb%2funifiedcomputing%2fdocs%3fp_p_id%3ddoc_library_summary_portlet_WAR_doclibrarysummaryportlet_INSTANCE_DXka%26p_p_lifecycle%3d0%26p_p_state%3dnormal%26p_p_mode%3dview%26p_p_col_id%3dcolumn-1%26p_p_col_count%3d2">Cisco UCS Manager XML API Programmer’s Guide</a></p>
<p><a href="http://developer.cisco.com/documents/2048839/2049143/Cisco+UCS+Manager+API+Management+Information+Model+Guide.pdf">Cisco UCS Manager API Management Information Model</a></p>
<p><a href="http://developer.cisco.com/web/cdc/tech/unifiedcomputing">Cisco Developer Network: Unified Computing</a></p>
<p><a href="http://blogs.cisco.com/datacenter/managing_your_cisco_ucs_from_an_iphone_or_ipad/">Managing your Cisco UCS from an iPhone or iPad</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/janegilring.wordpress.com/891/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/janegilring.wordpress.com/891/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/janegilring.wordpress.com/891/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.powershell.no&amp;blog=5892504&amp;post=891&amp;subd=janegilring&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.powershell.no/2011/07/23/getting-starting-with-cisco-ucs-powershell-toolkit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed08d635415486b87539a6e5a81982b7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">janegilring</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb5.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb6.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb7.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://janegilring.files.wordpress.com/2011/07/image_thumb8.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
