<?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>Mario&#039;s Blog</title>
	<atom:link href="http://danvers72.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://danvers72.wordpress.com</link>
	<description>Get-Info -Subject IIS, PowerShell, SQL, Windows</description>
	<lastBuildDate>Thu, 23 Feb 2012 17:15:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='danvers72.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mario&#039;s Blog</title>
		<link>http://danvers72.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://danvers72.wordpress.com/osd.xml" title="Mario&#039;s Blog" />
	<atom:link rel='hub' href='http://danvers72.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Turn your Windows 7 laptop in a hotspot.</title>
		<link>http://danvers72.wordpress.com/2012/02/23/turn-your-windows-7-laptop-in-a-hotspot/</link>
		<comments>http://danvers72.wordpress.com/2012/02/23/turn-your-windows-7-laptop-in-a-hotspot/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 17:11:33 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Hotspot]]></category>
		<category><![CDATA[Netsh]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://danvers72.wordpress.com/?p=238</guid>
		<description><![CDATA[In a few easy steps you can turn your Windows 7 laptop in a wireless hotspot without installing extra software. There is special software that do the same and that have many more features. But if you just need quickly a wireless hotspot for your mobile phone or tablet this is a good alternative. You [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=238&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a few easy steps you can turn your Windows 7 laptop in a wireless hotspot without installing extra software. There is special software that do the same and that have many more features. But if you just need quickly a wireless hotspot for your mobile phone or tablet this is a good alternative.</p>
<p>You need to follow the steps below:</p>
<ul>
<li>Start a <strong>command prompt</strong> with <strong>administrator privileges</strong>.</li>
<li>Execute the following command to create the hotspot.<br />
<strong>netsh wlan set hostednetwork mode=allow ssid=myssid key=mypassword<br />
</strong>Do not close the command prompt yet!</li>
<li>Open the <strong>Network and Sharing center</strong> and go to <strong>Change Adapter Settings</strong>.</li>
<li>Right click on your internet connection and choose <strong>Properties</strong>.</li>
<li>Select the tab <strong>Sharing</strong>.</li>
<li>Check the option &#8216;<strong>Allow other network users to connect through this computer&#8217;s Internet connection</strong>&#8216; .</li>
<li>Under &#8216;<strong>Home networking connection</strong>&#8216; select the hotspot that was created earlier. It is probably called &#8216;<strong>Wireless Network Connection 2</strong>&#8216;.</li>
<li>Click <strong>OK</strong>.</li>
<li>If you are using a dial-up connection then you need to stop and start the connection.</li>
<li>Go back to the command prompt.</li>
<li>Execute the following command to start the hotspot.<br />
<strong>netsh wlan start hostednetwork</strong> (use netsh wlan stop hostednetwork to stop the hotspot).</li>
</ul>
<p>Now the hotspot on the laptop is ready to be used. You only need to configure you mobile phone or tablet.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=238&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2012/02/23/turn-your-windows-7-laptop-in-a-hotspot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a Virtual Exchange 2010 Datacenter</title>
		<link>http://danvers72.wordpress.com/2011/12/08/create-a-virtual-exchange-2010-datacenter/</link>
		<comments>http://danvers72.wordpress.com/2011/12/08/create-a-virtual-exchange-2010-datacenter/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 22:44:55 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[Exchange 2010]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://danvers72.wordpress.com/?p=235</guid>
		<description><![CDATA[Technet Magazine published an interesting article about best practices for creating a virtual Exchange 201 Datacenter. You find the article here: http://technet.microsoft.com/en-us/magazine/hh641416.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=235&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Technet Magazine published an interesting article about best practices for creating a virtual Exchange 201 Datacenter.</p>
<p>You find the article here: <a href="http://technet.microsoft.com/en-us/magazine/hh641416.aspx">http://technet.microsoft.com/en-us/magazine/hh641416.aspx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/235/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=235&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/12/08/create-a-virtual-exchange-2010-datacenter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Management Framework 3.0 Community Technology Preview (CTP) #2 Available for Download</title>
		<link>http://danvers72.wordpress.com/2011/12/03/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download/</link>
		<comments>http://danvers72.wordpress.com/2011/12/03/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 19:00:00 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://danvers72.wordpress.com/?p=231</guid>
		<description><![CDATA[The PowerShell team released CTP2 of the Windows Management Framework 3.0. It contains PowerShell 3.0, WMI and WinRM. It is available voor download at http://blogs.msdn.com/b/powershell/archive/2011/12/02/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download.aspx.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=231&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The PowerShell team released CTP2 of the Windows Management Framework 3.0. It contains PowerShell 3.0, WMI and WinRM.</p>
<p>It is available voor download at <a href="http://blogs.msdn.com/b/powershell/archive/2011/12/02/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download.aspx">http://blogs.msdn.com/b/powershell/archive/2011/12/02/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download.aspx</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=231&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/12/03/windows-management-framework-3-0-community-technology-preview-ctp-2-available-for-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: Get stream statistics from Wowza Media Server</title>
		<link>http://danvers72.wordpress.com/2011/12/02/update-get-stream-statistics-from-wowza-media-server/</link>
		<comments>http://danvers72.wordpress.com/2011/12/02/update-get-stream-statistics-from-wowza-media-server/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 22:28:48 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Wowza]]></category>

		<guid isPermaLink="false">https://danvers72.wordpress.com/?p=229</guid>
		<description><![CDATA[Yesterday I discovered that the function in the article ‘Get stream statistics from Wowza Media Server’ was not working properly. It goes wrong when more Applications are loaded in Wowza. So I have changed the function and used ForEach loops instead of For loops. The For loop would also go wrong when there is only [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=229&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yesterday I discovered that the function in the article ‘<a href="http://wp.me/pCd2h-3E" target="_blank">Get stream statistics from Wowza Media Server</a>’ was not working properly. It goes wrong when more Applications are loaded in Wowza. So I have changed the function and used ForEach loops instead of For loops. The For loop would also go wrong when there is only one stream in an Application. Because there is no count property in the XML object then.</p>
<pre><span style="color:#0000ff;">Function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-WowzaStreamStats</span><span style="color:#000000;">{
    </span><span style="color:#800080;">$webclient</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">System.Net.WebClient</span><span style="color:#000000;">
    </span><span style="color:#800080;">$webclient</span><span style="color:#000000;">.credentials </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">system.Net.NetworkCredential</span><span style="color:#000000;">(</span><span style="color:#800000;">"</span><span style="color:#800000;">user</span><span style="color:#800000;">"</span><span style="color:#000000;">, </span><span style="color:#800000;">"</span><span style="color:#800000;">password</span><span style="color:#800000;">"</span><span style="color:#000000;">, </span><span style="color:#800000;">""</span><span style="color:#000000;">)
    [</span><span style="color:#008080;">xml</span><span style="color:#000000;">]</span><span style="color:#800080;">$xml</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$webclient</span><span style="color:#000000;">.DownloadString(</span><span style="color:#800000;">"</span><span style="color:#800000;">http://wowza-ip:8086/connectioncounts</span><span style="color:#800000;">"</span><span style="color:#000000;">)

    </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$vhost</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost) {

        </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$Application</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application) {

            </span><span style="color:#0000ff;">foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$Stream</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$Application</span><span style="color:#000000;">.ApplicationInstance.Stream) {
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> @{}

                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.TotalConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.SessionsTotal
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.StreamName </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.Name
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.FlashConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.SessionsFlash
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.SilverlightConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.SessionsSmooth
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.RTSPConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.SessionsRTSP
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.iOSConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Stream</span><span style="color:#000000;">.SessionsCupertino
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.Application </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Application</span><span style="color:#000000;">.name
                </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.Vhost </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$vhost</span><span style="color:#000000;">.name

                </span><span style="color:#800080;">$StreamStats</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">PSObject</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Property</span><span style="color:#000000;"> </span><span style="color:#800080;">$Node</span><span style="color:#000000;">
                </span><span style="color:#5f9ea0;font-weight:bold;">Write-Output</span><span style="color:#000000;"> </span><span style="color:#800080;">$StreamStats</span><span style="color:#000000;">
            }
        }
    }
}</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=229&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/12/02/update-get-stream-statistics-from-wowza-media-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Get stream statistics from Wowza Media Server</title>
		<link>http://danvers72.wordpress.com/2011/11/29/get-stream-statistics-from-wowza-media-server-2/</link>
		<comments>http://danvers72.wordpress.com/2011/11/29/get-stream-statistics-from-wowza-media-server-2/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 15:49:20 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Wowza]]></category>

		<guid isPermaLink="false">https://danvers72.wordpress.com/?p=226</guid>
		<description><![CDATA[Recently I needed to know how many connections were made to a stream on our Wowza server, as real time as possible. For Windows Media Services you can use performance counters for that. And you can read these counters with PowerShell. I made a script for that in the past. For Wowza I wanted something [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=226&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to know how many connections were made to a stream on our Wowza server, as real time as possible. For Windows Media Services you can use performance counters for that. And you can read these counters with PowerShell. I made a script for that in the past.</p>
<p>For Wowza I wanted something similar for that. The good thing is that Wowza has an xml interface that outputs the current connections. In default configuration you find the interface at <a href="http://wowza-ip:8086/connectioncounts">http://wowza-ip:8086/connectioncounts</a>. For humans the output is not very readable. So I made a function to parse the output.</p>
<pre><span style="color:#0000ff;">Function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Get-WowzaStreamStats</span><span style="color:#000000;">{
    </span><span style="color:#800080;">$webclient</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">System.Net.WebClient</span><span style="color:#000000;">
    </span><span style="color:#800080;">$webclient</span><span style="color:#000000;">.credentials </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">system.Net.NetworkCredential</span><span style="color:#000000;">(</span><span style="color:#800000;">"</span><span style="color:#800000;">user</span><span style="color:#800000;">"</span><span style="color:#000000;">, </span><span style="color:#800000;">"</span><span style="color:#800000;">password</span><span style="color:#800000;">"</span><span style="color:#000000;">, </span><span style="color:#800000;">""</span><span style="color:#000000;">)
    [</span><span style="color:#008080;">xml</span><span style="color:#000000;">]</span><span style="color:#800080;">$xml</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$webclient</span><span style="color:#000000;">.DownloadString(</span><span style="color:#800000;">"</span><span style="color:#800000;">http://wowza-ip:8086/connectioncounts</span><span style="color:#800000;">"</span><span style="color:#000000;">)

    </span><span style="color:#0000ff;">for</span><span style="color:#000000;"> (</span><span style="color:#800080;">$i</span><span style="color:#ff0000;">=</span><span style="color:#000000;">0</span><span style="color:#000000;">; </span><span style="color:#800080;">$i</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-lt</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream.Count; </span><span style="color:#800080;">$i</span><span style="color:#000000;">++) {
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> @{}

    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.TotalConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].SessionsTotal
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.StreamName </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].Name
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.FlashConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].SessionsFlash
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.SilverlightConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].SessionsSmooth
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.RTSPConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].SessionsRTSP
    </span><span style="color:#800080;">$Node</span><span style="color:#000000;">.iPadConnections </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$xml</span><span style="color:#000000;">.WowzaMediaServer.VHost.Application.ApplicationInstance.Stream[</span><span style="color:#800080;">$i</span><span style="color:#000000;">].SessionsCupertino

    </span><span style="color:#800080;">$StreamStats</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">new-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">PSObject</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Property</span><span style="color:#000000;"> </span><span style="color:#800080;">$Node</span><span style="color:#000000;">
    </span><span style="color:#5f9ea0;font-weight:bold;">Write-Output</span><span style="color:#000000;"> </span><span style="color:#800080;">$StreamStats</span><span style="color:#000000;">
    }
}</span></pre>
<p>The output of the function is an object. So you can use it in the pipeline. For example you can type:<br /><strong>Get-WowzaStreamStats | Where-Object {$_.StreamName –eq ‘name.stream’}</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/226/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=226&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/11/29/get-stream-statistics-from-wowza-media-server-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Add hundreds of hostheaders to one website with PowerShell</title>
		<link>http://danvers72.wordpress.com/2011/11/11/add-hundreds-of-hostheaders-to-one-website-with-powershell/</link>
		<comments>http://danvers72.wordpress.com/2011/11/11/add-hundreds-of-hostheaders-to-one-website-with-powershell/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 11:28:08 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Hostheader]]></category>

		<guid isPermaLink="false">http://danvers72.wordpress.com/?p=211</guid>
		<description><![CDATA[At the moment I am busy with replacing an old server with a new server running Windows Server 2008 R2. This old server has a few websites. Migrating a website is normally not difficult to do. Have done these migrations many times already. But one of the websites has hundreds of hostheaders attached to it. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=211&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At the moment I am busy with replacing an old server with a new server running Windows Server 2008 R2. This old server has a few websites. Migrating a website is normally not difficult to do. Have done these migrations many times already. But one of the websites has hundreds of hostheaders attached to it. So this is not something you want to do by hand.</p>
<p>The good thing was that I had all these hostheaders already in a textfile. With the help of PowerShell it was easy to add these hostheaders to the website on the new server. I used this one-liner.</p>
<p><strong>Get-Content c:\urls.txt | Foreach-Object {New-webbinding -name &#8220;Default Website&#8221; -IPAddress &#8220;*&#8221; -Port 80 -HostHeader $_}</strong></p>
<p>Before you do this make sure you have added the WebAdministration module to your PowerShell console with <strong>Import-Module -Name WebAdministration</strong>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=211&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/11/11/add-hundreds-of-hostheaders-to-one-website-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Upload a file with ftp using PowerShell</title>
		<link>http://danvers72.wordpress.com/2011/08/24/upload-a-file-with-ftp-using-powershell-3/</link>
		<comments>http://danvers72.wordpress.com/2011/08/24/upload-a-file-with-ftp-using-powershell-3/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 20:53:51 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://fiorano.net/2011/08/upload-a-file-with-ftp-using-powershell-3/</guid>
		<description><![CDATA[Recently I needed a script to upload log files from one server to another server. The servers were in separate networks so I could not use a simple copy command like xcopy or robocopy. For this I had to use FTP. I had already a simple old batch file that uses the built-in ftp command. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=146&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I needed a script to upload log files from one server to another server. The servers were in separate networks so I could not use a simple copy command like xcopy or robocopy. For this I had to use FTP. I had already a simple old batch file that uses the built-in ftp command. But I wanted to use PowerShell so that I could make it more advanced. After some searching on PowerShell websites I found some examples. I used these as a start for my function. </p>
<pre><span style="color:#0000ff;">function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Send-FileToFtp</span><span style="color:#000000;"> {</span><span style="color:#000000;">
    [CmdletBinding()]
    [OutputType([</span><span style="color:#008080;">System.Int32</span><span style="color:#000000;">])]
    </span><span style="color:#0000ff;">param</span><span style="color:#000000;">(
        [Parameter(Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">0</span><span style="color:#000000;">, Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.Object</span><span style="color:#000000;">]</span><span style="color:#800080;">$SourceFile</span><span style="color:#000000;">,

        [Parameter(Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">1</span><span style="color:#000000;">, Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">]</span><span style="color:#800080;">$Destination</span><span style="color:#000000;">,

        [Parameter(Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">2</span><span style="color:#000000;">, Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">]</span><span style="color:#800080;">$UserName</span><span style="color:#000000;">,

        [Parameter(Position</span><span style="color:#ff0000;">=</span><span style="color:#000000;">3</span><span style="color:#000000;">, Mandatory</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$true</span><span style="color:#000000;">)]
        [ValidateNotNullOrEmpty()]
        [</span><span style="color:#008080;">System.String</span><span style="color:#000000;">]</span><span style="color:#800080;">$Password</span><span style="color:#000000;">
    )

    </span><span style="color:#0000ff;">Process</span><span style="color:#000000;"> {
        </span><span style="color:#0000ff;">try</span><span style="color:#000000;"> {
            </span><span style="color:#008000;">#</span><span style="color:#008000;"> Get the object used to communicate with the server. </span><span style="color:#008000;">
</span><span style="color:#000000;">            </span><span style="color:#800080;">$Request</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> [</span><span style="color:#008080;">System.Net.FtpWebRequest</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">Create</span><span style="color:#000000;">(</span><span style="color:#800000;">&quot;</span><span style="color:#800000;">ftp://$Destination/$($SourceFile.Name)</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">)
            </span><span style="color:#800080;">$Request</span><span style="color:#000000;">.Method </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Request</span><span style="color:#000000;">.Method </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> [</span><span style="color:#008080;">System.Net.WebRequestMethods</span><span style="color:#000000;">+ftp]::UploadFile 

            </span><span style="color:#008000;">#</span><span style="color:#008000;"> This example assumes the FTP site uses anonymous logon. </span><span style="color:#008000;">
</span><span style="color:#000000;">            </span><span style="color:#800080;">$Request</span><span style="color:#000000;">.Credentials </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">New-Object</span><span style="color:#000000;"> </span><span style="color:#800000;">System.Net.NetworkCredential</span><span style="color:#000000;"> </span><span style="color:#800080;">$UserName</span><span style="color:#000000;">,</span><span style="color:#800080;">$Password</span><span style="color:#000000;"> 

            </span><span style="color:#008000;">#</span><span style="color:#008000;"> Copy the contents of the file to the request stream. </span><span style="color:#008000;">
</span><span style="color:#000000;">            </span><span style="color:#800080;">$FileContents</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> [</span><span style="color:#008080;">System.IO.File</span><span style="color:#000000;">]::</span><span style="color:#8b4513;">ReadAllBytes</span><span style="color:#000000;">(</span><span style="color:#800080;">$SourceFile</span><span style="color:#000000;">.FullName)
            </span><span style="color:#800080;">$Request</span><span style="color:#000000;">.ContentLength </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$fileContents</span><span style="color:#000000;">.Length
            </span><span style="color:#800080;">$RequestStream</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$request</span><span style="color:#000000;">.GetRequestStream()
            </span><span style="color:#800080;">$RequestStream</span><span style="color:#000000;">.Write(</span><span style="color:#800080;">$FileContents</span><span style="color:#000000;">, </span><span style="color:#000000;">0</span><span style="color:#000000;">, </span><span style="color:#800080;">$FileContents</span><span style="color:#000000;">.Length)
            </span><span style="color:#800080;">$RequestStream</span><span style="color:#000000;">.Close()
            </span><span style="color:#800080;">$Response</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$Request</span><span style="color:#000000;">.GetResponse()
            </span><span style="color:#800080;">$Response</span><span style="color:#000000;">.StatusDescription
        }
        </span><span style="color:#0000ff;">catch</span><span style="color:#000000;"> {
            </span><span style="color:#0000ff;">throw</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">ERROR: Unable to upload file $($SourceFile.name), status {0}</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        }
        </span><span style="color:#800080;">$Response</span><span style="color:#000000;">.StatusDescription
        }
    }</span></pre>
<p>The function takes 4 parameters as you can see in the script. Most of them will be self explaining. But the parameter $SourceFile will need some explanation. Instead of using a string I decided to use an object. I did this so I can use the object to construct the filename of the source and also use it to construct the ftp request. To use the function you can write something like this. </p>
<pre><span style="color:#800080;">$files</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;font-weight:bold;">Get-ChildItem</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Path</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">c:\windows\system32\logfiles\</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-Filter</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">*.log</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
</span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$files</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-ne</span><span style="color:#000000;"> </span><span style="color:#800080;">$null</span><span style="color:#000000;">) {
    </span><span style="color:#0000ff;">Foreach</span><span style="color:#000000;"> (</span><span style="color:#800080;">$file</span><span style="color:#000000;"> </span><span style="color:#0000ff;">in</span><span style="color:#000000;"> </span><span style="color:#800080;">$files</span><span style="color:#000000;">) {
        </span><span style="color:#800080;">$result</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Send-FileToFtp</span><span style="color:#000000;"> -SourceFile </span><span style="color:#800080;">$file</span><span style="color:#000000;"> -Destination </span><span style="color:#800000;">&quot;ftp.domain.com</span><span style="color:#800000;">/folder</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> -UserName </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">user</span><span style="color:#800000;">&quot;</span><span style="color:#000000;"> -Password </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">password</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        </span><span style="color:#0000ff;">if</span><span style="color:#000000;"> (</span><span style="color:#800080;">$Result</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-match</span><span style="color:#000000;"> </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">226*</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">){
            </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Upload completed, now deleting source file: $($File.Name)</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        } </span><span style="color:#0000ff;">else</span><span style="color:#000000;"> {
            </span><span style="color:#800000;">&quot;</span><span style="color:#800000;">Upload failed!</span><span style="color:#800000;">&quot;</span><span style="color:#000000;">
        }
    }
}</span></pre>
<p>It gets all the log files from the c:\windows\system32logfiles directory and places them in the variable $files. For every file object in the variable $files it runs the function Send-FileToFtp. If the upload succeeds, the function returns a StatusDescription with the code 226, you can delete the original file or do something else. When the upload fails you can output a message or do somethings else.</p>
<p>For what I wanted to do this works perfect. But for other things it possibly needs to get changed a bit.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=146&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/08/24/upload-a-file-with-ftp-using-powershell-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Free Microsoft iSCSI Software Target</title>
		<link>http://danvers72.wordpress.com/2011/04/22/free-microsoft-iscsi-software-target/</link>
		<comments>http://danvers72.wordpress.com/2011/04/22/free-microsoft-iscsi-software-target/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 14:31:05 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[iSCSI]]></category>

		<guid isPermaLink="false">http://fiorano.net/?p=133</guid>
		<description><![CDATA[Today I saw a Twitter message about an iSCSI Software Target from Microsoft. With this you can turn any Windows Server 2008 R2 in an iSCSI device. The software target is the same that is being used in the Windows Storage Server product. So you can say that it is a proven technology. At the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=133&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I saw a Twitter message about an <a href="http://blogs.technet.com/b/josebda/archive/2011/04/04/microsoft-iscsi-software-target-3-3-for-windows-server-2008-r2-available-for-public-download.aspx" target="_blank">iSCSI Software Target</a> from Microsoft. With this you can turn any Windows Server 2008 R2 in an iSCSI device. The software target is the same that is being used in the <a href="http://www.microsoft.com/Windowsserver2008/en/us/wss08.aspx" target="_blank">Windows Storage Server</a> product. So you can say that it is a proven technology.</p>
<p>At the office we will not make much use of it i think because we have Equallogic iSCSI devices in our datacenters. But I am going to use it for my test environment at home. This makes it easier for me to try and test iSCSI related stuff.</p>
<p>And maybe there will be a use for this in the office.</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=133&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/04/22/free-microsoft-iscsi-software-target/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>How to change the primary group of an AD user?</title>
		<link>http://danvers72.wordpress.com/2011/04/01/how-to-change-the-primary-group-of-an-ad-user/</link>
		<comments>http://danvers72.wordpress.com/2011/04/01/how-to-change-the-primary-group-of-an-ad-user/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 09:51:00 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Groups]]></category>

		<guid isPermaLink="false">http://fiorano.net/2011/04/how-to-change-the-primary-group-of-a-ad-user/</guid>
		<description><![CDATA[In the past I have made a PowerShell script that did some cleanup in the Active Directory on accounts of former employees. Like disable their account, move to a different OU and archive home and profile directory. In that script I use the Quest AD Cmdlets for all the AD actions. Although I like these [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=125&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the past I have made a PowerShell script that did some cleanup in the Active Directory on accounts of former employees. Like disable their account, move to a different OU and archive home and profile directory. In that script I use the <a title="Quest AD Cmdlets" href="http://www.quest.com/powershell/activeroles-server.aspx" target="_blank">Quest AD Cmdlets</a> for all the AD actions. Although I like these cmdlets, I wanted to modify the script so that it uses the built-in AD cmdlets that are built in Windows Server 2008 R2.</p>
<p>Replacing the Quest AD Cmdlets with the built in cmdlets was not very difficult. But I had one little problem. We prefer to remove old accounts from all the groups they belong to. This way you will not find disabled or not existing accounts in the groups. But one group is assigned as the Primary Group and you cannot remove a user from this group. Default this is the ‘Domain Users’ group.</p>
<p>In the old script we added the user account to a special group called ‘Former Employees’, make this the Primary Group and remove all the other groups including ‘Domain Users’. With the Quest AD Cmdlets is fairly easy to do with the cmdlet Set-QADuser. Unfortunately this was not possible with the cmdlet Set-ADuser.</p>
<p>I tried to find a solution with Google but was not very successful. All the answers I found refer to ADSI or the Quest AD Cmdlets. So I have made my own function for this using the built-in AD Cmdlets from Windows Server 2008 R2. The user has to be a member of the group before you can make it the Primary Group!</p>
<pre><span style="color:#0000ff;">Function</span><span style="color:#000000;"> </span><span style="color:#5f9ea0;">Set-PrimaryGroup</span><span style="color:#000000;"> {
    </span><span style="color:#0000ff;">Param</span><span style="color:#000000;"> (
        [</span><span style="color:#008080;">string</span><span style="color:#000000;">]</span><span style="color:#800080;">$username</span><span style="color:#ff0000;">=</span><span style="color:#000000;">$(</span><span style="color:#0000ff;">Throw</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Error: Please enter a username!</span><span style="color:#800000;">"</span><span style="color:#000000;">),
        [</span><span style="color:#008080;">string</span><span style="color:#000000;">]</span><span style="color:#800080;">$groupname</span><span style="color:#ff0000;">=</span><span style="color:#800000;">"</span><span style="color:#800000;">Domain Users</span><span style="color:#800000;">"</span><span style="color:#000000;">)

</span><span style="color:#0000ff;">Process</span><span style="color:#000000;"> {
    </span><span style="color:#0000ff;">Try</span><span style="color:#000000;"> {
        </span><span style="color:#008000;">#</span><span style="color:#008000;">Get the DistinguishedName of the user for you want to change the primary group</span><span style="color:#008000;">
</span><span style="color:#000000;">        </span><span style="color:#800080;">$UserDistinguishedName</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> (get-aduser -Identity </span><span style="color:#800080;">$username</span><span style="color:#000000;"> -ErrorAction Stop).DistinguishedName
        </span><span style="color:#0000ff;">Try</span><span style="color:#000000;"> {
            </span><span style="color:#008000;">#</span><span style="color:#008000;">Get SID of the Group that will become the primary group</span><span style="color:#008000;">
</span><span style="color:#000000;">            </span><span style="color:#800080;">$GroupSid</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> (Get-ADGroup -Identity </span><span style="color:#800080;">$groupname</span><span style="color:#000000;"> -Properties PrimaryGroupID -ErrorAction Stop).SID

            </span><span style="color:#008000;">#</span><span style="color:#008000;">Get the last 4 digits of the SID to become te PrimaryGroupID</span><span style="color:#008000;">
</span><span style="color:#000000;">            </span><span style="color:#800080;">$PrimaryGroupID</span><span style="color:#000000;"> </span><span style="color:#ff0000;">=</span><span style="color:#000000;"> </span><span style="color:#800080;">$GroupSid</span><span style="color:#000000;">.Value.Substring(</span><span style="color:#800080;">$groupsid</span><span style="color:#000000;">.Value.LastIndexOf(</span><span style="color:#800000;">'</span><span style="color:#800000;">-</span><span style="color:#800000;">'</span><span style="color:#000000;">)</span><span style="color:#ff0000;">+</span><span style="color:#000000;">1</span><span style="color:#000000;">)

            </span><span style="color:#008000;">#</span><span style="color:#008000;">Replace the PrimaryGroupID of the user with its new value. The user has to be already a member of this group.</span><span style="color:#008000;">
</span><span style="color:#000000;">            Set-ADObject -Identity </span><span style="color:#800000;">"</span><span style="color:#800000;">$UserDistinguishedName</span><span style="color:#800000;">"</span><span style="color:#000000;"> </span><span style="color:#ff0000;">-replace</span><span style="color:#000000;"> @{PrimaryGroupID</span><span style="color:#ff0000;">=</span><span style="color:#800080;">$PrimaryGroupID</span><span style="color:#000000;">}
            </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">$groupname set as primary group for user $username</span><span style="color:#800000;">"</span><span style="color:#000000;">
        } </span><span style="color:#0000ff;">Catch</span><span style="color:#000000;"> {
            </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Error: Unable to find the PrimaryGroupID for group $GroupName! Maybe the group does not exist.</span><span style="color:#800000;">"</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-ForegroundColor</span><span style="color:#000000;"> </span><span style="color:#800000;">red</span><span style="color:#000000;">
        }
    } </span><span style="color:#0000ff;">Catch</span><span style="color:#000000;"> {
        </span><span style="color:#5f9ea0;font-weight:bold;">Write-Host</span><span style="color:#000000;"> </span><span style="color:#800000;">"</span><span style="color:#800000;">Error: Unable to find user $username!</span><span style="color:#800000;">"</span><span style="color:#000000;"> </span><span style="font-style:italic;color:#5f9ea0;">-ForegroundColor</span><span style="color:#000000;"> </span><span style="color:#800000;">red</span><span style="color:#000000;">
    }
  }
}</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=125&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/04/01/how-to-change-the-primary-group-of-an-ad-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to PowerShell Modules</title>
		<link>http://danvers72.wordpress.com/2011/03/22/introduction-to-powershell-modules/</link>
		<comments>http://danvers72.wordpress.com/2011/03/22/introduction-to-powershell-modules/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 10:37:31 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[modules]]></category>

		<guid isPermaLink="false">http://fiorano.net/?p=119</guid>
		<description><![CDATA[A new feature in PowerShell 2.0 are modules. A module is a collection of PowerShell cmdlets and are an easier way to distribute cmdlets. For PowerShell snapins were used for this. But you needed developer skills to create snapins. But most system adminstrators are not developers. Jonathan Medd wrote an interesting article about how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=119&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A new feature in <a title="PowerShell" href="http://technet.microsoft.com/en-us/scriptcenter/dd742419.aspx" target="_blank">PowerShell</a> 2.0 are modules. A module is a collection of PowerShell cmdlets and are an easier way to distribute cmdlets. For PowerShell snapins were used for this. But you needed developer skills to create snapins. But most system adminstrators are not developers.</p>
<p><a title="Jonathan Medd" href="http://www.jonathanmedd.net/" target="_blank">Jonathan Medd</a> wrote an interesting article about how to create your own modules, yu can find it on <a href="http://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/" target="_blank">http://www.simple-talk.com/sysadmin/powershell/an-introduction-to-powershell-modules/</a>. After reading this article it sounded much simpler to do then I thought.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/danvers72.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/danvers72.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/danvers72.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=danvers72.wordpress.com&amp;blog=9106577&amp;post=119&amp;subd=danvers72&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://danvers72.wordpress.com/2011/03/22/introduction-to-powershell-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/80870123e7b639d41f4a62e98fd135f7?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">danvers72</media:title>
		</media:content>
	</item>
	</channel>
</rss>
