<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dalle &#38; DXter &#187; function</title>
	<atom:link href="http://poweradmin.se/blog/tag/function/feed/" rel="self" type="application/rss+xml" />
	<link>http://poweradmin.se/blog</link>
	<description>The Power Administrators</description>
	<lastBuildDate>Sat, 03 Mar 2012 21:54:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Get-SNames</title>
		<link>http://poweradmin.se/blog/2012/01/04/get-snames/</link>
		<comments>http://poweradmin.se/blog/2012/01/04/get-snames/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 18:06:17 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/?p=2816</guid>
		<description><![CDATA[This is the updated version of my old LName function. I changed the name to Get-SNames instead of Get-LNames because ofthat I know that the correct name is not Last Name and It should be Surname instead. I use It &#8230; <a href="http://poweradmin.se/blog/2012/01/04/get-snames/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2012%252F01%252F04%252Fget-snames%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2Fwu3bjq%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Get-SNames%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://poweradmin.se/blog/wp-content/uploads/Groups-Meeting-Light-icon1.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Groups-Meeting-Light-icon" border="0" alt="Groups-Meeting-Light-icon" src="http://poweradmin.se/blog/wp-content/uploads/Groups-Meeting-Light-icon_thumb1.png" width="128" height="128"></a></p>
<p><font face="Arial">This is the updated version of my old LName function.</font></p>
<p><font face="Arial">I changed the name to Get-SNames instead of Get-LNames because of<br />that I know that the correct name is not Last Name and It should be Surname instead.</font></p>
<p><font face="Arial">I use It in my create AD lab script and in a couple of other scripts when I <br />need “real” peoples name.</font>
<p><font face="Arial">My thought have been to update It so that I can use names from other countries <br />as well.</font>
<p><font face="Arial">So I came up with an updated version of the function that can create <br />a list from USA and It can also create a list from Sweden, as It could <br />before.</font>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/snamessweden.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="snamessweden" border="0" alt="snamessweden" src="http://poweradmin.se/blog/wp-content/uploads/snamessweden_thumb.png" width="316" height="165"></a><br /><font size="2" face="Arial">The Swedish list is taken from The Gothenburg University</font></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/snamesusa.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="snamesusa" border="0" alt="snamesusa" src="http://poweradmin.se/blog/wp-content/uploads/snamesusa_thumb.png" width="319" height="165"></a><br /><font size="2" face="Arial">The US list is taken from mongabay.com’s name site</font></p>
<p><font face="Arial">I have done some changes to the Swedish list as well.<br />The list is now sorted and saved as UTF-8. The UTF-8 part is for viewing and using names that contains Swedish letters å ä and ö.</font></p>
<p><font face="Arial">The function can be downloaded from </font><a href="http://gallery.technet.microsoft.com/Get-SNames-0b792cc6"><font face="Arial">here</font></a><font face="Arial">.</font></p>
<div class="shr-publisher-2816"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F04%2Fget-snames%2F' data-shr_title='Get-SNames'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F04%2Fget-snames%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F04%2Fget-snames%2F' data-shr_title='Get-SNames'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2012/01/04/get-snames/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get-FNames</title>
		<link>http://poweradmin.se/blog/2012/01/03/get-fnames/</link>
		<comments>http://poweradmin.se/blog/2012/01/03/get-fnames/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 17:28:18 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/?p=2807</guid>
		<description><![CDATA[Back in 2009 I wrote a Function that took peoples first names from a source in Sweden.It was top 1000 names here in Sweden. I use It in my create AD lab script and in a couple of other scripts &#8230; <a href="http://poweradmin.se/blog/2012/01/03/get-fnames/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2012%252F01%252F03%252Fget-fnames%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Get-FNames%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://poweradmin.se/blog/wp-content/uploads/Groups-Meeting-Light-icon.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Groups-Meeting-Light-icon" border="0" alt="Groups-Meeting-Light-icon" src="http://poweradmin.se/blog/wp-content/uploads/Groups-Meeting-Light-icon_thumb.png" width="128" height="128"></a></p>
<p><font face="Arial">Back in 2009 I wrote a Function that took peoples first names from a source in Sweden.<br />It was top 1000 names here in Sweden.</font></p>
<p><font face="Arial">I use It in my create AD lab script and in a couple of other scripts when I need “real” peoples name.</font></p>
<p><font face="Arial">My thought have been to update It so that I can use names from other countries as well.<br />So I came up with an updated version of the function that can create a list from USA and It can also create a list from Sweden, as I could before.</font></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image568.png"><font face="Arial"><a href="http://poweradmin.se/blog/wp-content/uploads/image569.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb499.png" width="287" height="150"></a></font></a><br /><font size="2" face="Arial">The names from USA comes from Social Security Online.<br /></font></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image570.png"><font face="Arial"><a href="http://poweradmin.se/blog/wp-content/uploads/image571.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb500.png" width="289" height="150"></a></font></a><br /><font size="2" face="Arial">The Swedish names come from the Gothenburg University.</font></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/notfnamesswe.png"><font face="Arial"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="notfnamesswe" border="0" alt="notfnamesswe" src="http://poweradmin.se/blog/wp-content/uploads/notfnamesswe_thumb.png" width="109" height="244"></font></a><font face="Arial">&nbsp;</font><a href="http://poweradmin.se/blog/wp-content/uploads/notfnamesusa.png"><font face="Arial"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="notfnamesusa" border="0" alt="notfnamesusa" src="http://poweradmin.se/blog/wp-content/uploads/notfnamesusa_thumb.png" width="91" height="244"></font></a></p>
<p><font face="Arial">When you run the function you need to have internet access!</font></p>
<p><font face="Arial">The function can be downloaded from </font><a href="http://gallery.technet.microsoft.com/Get-FNames-8dfde11d"><font face="Arial">here</font></a><font face="Arial">.</font></p>
<div class="shr-publisher-2807"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F03%2Fget-fnames%2F' data-shr_title='Get-FNames'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F03%2Fget-fnames%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2012%2F01%2F03%2Fget-fnames%2F' data-shr_title='Get-FNames'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2012/01/03/get-fnames/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Get-PingStatus</title>
		<link>http://poweradmin.se/blog/2011/12/31/get-pingstatus/</link>
		<comments>http://poweradmin.se/blog/2011/12/31/get-pingstatus/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 19:31:00 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Ping-Status]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/?p=2783</guid>
		<description><![CDATA[Over at 2009 I wrote a ping status function. The function can now be downloaded from the Script Center Repository at Microsoft.http://gallery.technet.microsoft.com/Get-PingStatus-Function-e375fec3 I use It in my own scripts and just updated It so I hope others can use It &#8230; <a href="http://poweradmin.se/blog/2011/12/31/get-pingstatus/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2011%252F12%252F31%252Fget-pingstatus%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FvbukCR%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Get-PingStatus%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><a href="http://poweradmin.se/blog/wp-content/uploads/Status-battery-100-icon.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Status-battery-100-icon" border="0" alt="Status-battery-100-icon" src="http://poweradmin.se/blog/wp-content/uploads/Status-battery-100-icon_thumb.png" width="67" height="67"></a></p>
<p>Over at 2009 I wrote a ping status function. <br />The function can now be downloaded from the Script Center Repository at Microsoft.<br /><a title="http://gallery.technet.microsoft.com/Get-PingStatus-Function-e375fec3" href="http://gallery.technet.microsoft.com/Get-PingStatus-Function-e375fec3">http://gallery.technet.microsoft.com/Get-PingStatus-Function-e375fec3</a></p>
<p>I use It in my own scripts and just updated It so I hope others can use It too.</p>
<p><font size="1">.EXAMPLE<br />&nbsp;&nbsp;&nbsp; Get-PingStatus server01<br />.EXAMPLE<br />&nbsp;&nbsp;&nbsp; if (Get-PingStatus server01) { Write-Host &#8220;I&#8217;m up!&#8221; }<br />.EXAMPLE<br />&nbsp;&nbsp;&nbsp; if (!(Get-PingStatus server01)) { Write-Host &#8220;I&#8217;m not up!&#8221; }</font></p>
<div class="shr-publisher-2783"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F12%2F31%2Fget-pingstatus%2F' data-shr_title='Get-PingStatus'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F12%2F31%2Fget-pingstatus%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F12%2F31%2Fget-pingstatus%2F' data-shr_title='Get-PingStatus'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2011/12/31/get-pingstatus/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get-ComputerType</title>
		<link>http://poweradmin.se/blog/2010/01/03/get-computertype/</link>
		<comments>http://poweradmin.se/blog/2010/01/03/get-computertype/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 23:36:54 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Get-ComputerType]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2010/01/03/get-computertype/</guid>
		<description><![CDATA[I’m working on lots of Active Directory functions at the moment.For a larger Active Directory script. And one of the functions will get the computer type in clear text. What does this have to do with Active Directory management doask &#8230; <a href="http://poweradmin.se/blog/2010/01/03/get-computertype/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2010%252F01%252F03%252Fget-computertype%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Get-ComputerType%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I’m working on lots of Active Directory functions at the moment.<br />For a larger Active Directory script.</p>
<p>And one of the functions will get the computer type in clear text.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image268.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb202.png" width="373" height="170"></a> </p>
<p>What does this have to do with Active Directory management do<br />ask your self right now <img src='http://poweradmin.se/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Lots of, do I say!</p>
<p>If you need your computers to be named like sitenamecomputertype0001<br />then this function will do a lot for you.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image269.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb203.png" width="381" height="178"></a></p>
<p>Just do like this:</p>
<pre><span style="color: #000000"> </span><span style="color: #800080">$compType</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Get-ComputerType</span><span style="color: #000000"> -computerName </span><span style="color: #800080">$computerName</span><span style="color: #000000">
 </span><span style="color: #800080">$compType</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$compType</span><span style="color: #000000">.substring(</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #000000">1</span><span style="color: #000000">)</span></pre>
<pre><span style="color: #000000">And you got an D a M or a W.</span></pre>
<pre>&nbsp;</pre>
<pre>The function can be found <a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/727708f2-e2ca-4e89-8d7b-54c7409aa918" target="_blank">here</a>.</pre>
<pre>&nbsp;</pre>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c08c45e3-a2a7-4bc4-9438-aa83d8070adb" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/WMI" rel="tag">WMI</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a>,<a href="http://technorati.com/tags/Get-ComputerType" rel="tag">Get-ComputerType</a></div>
<div class="shr-publisher-1296"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F01%2F03%2Fget-computertype%2F' data-shr_title='Get-ComputerType'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F01%2F03%2Fget-computertype%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F01%2F03%2Fget-computertype%2F' data-shr_title='Get-ComputerType'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2010/01/03/get-computertype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated functions</title>
		<link>http://poweradmin.se/blog/2009/12/26/updated-functions/</link>
		<comments>http://poweradmin.se/blog/2009/12/26/updated-functions/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 20:38:16 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/26/updated-functions/</guid>
		<description><![CDATA[I have been away from my computer for a couple of days. And I have been thinking about my code and now are these functions updated. Clean-Temp I have tweaked the code. No need for the same code twice And &#8230; <a href="http://poweradmin.se/blog/2009/12/26/updated-functions/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F26%252Fupdated-functions%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Updated%20functions%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I have been away from my computer for a couple of days.   <br />And I have been thinking about my code and now are    <br />these functions updated.</p>
<p><a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/9b198835-8d25-4bdb-a92c-cb210ebd3269" target="_blank">Clean-Temp</a></p>
<p>I have tweaked the code.   <br />No need for the same code twice <img src='http://poweradmin.se/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And I have added help for PowerShell 2.0.</p>
<p>When the function are loaded.   <br />Try to write <strong>Get-Help Clean-Temp –detailed</strong></p>
<p><a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663" target="_blank">Get-DotNetInfo</a></p>
<p>Uses the default browser instead of Internet Explorer.</p>
<p>And I have added help for PowerShell 2.0.</p>
<p>When the function are loaded.   <br />Try to write <strong>Get-Help Get-DotNetInfo –detailed</strong></p>
<p><strong></strong></p>
<p>More updates will be posted soon…</p>
<p></p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:08ce6613-03b8-48b8-85fe-ea4122f0852b" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a>,<a href="http://technorati.com/tags/Updates" rel="tag">Updates</a></div>
<div class="shr-publisher-1266"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F26%2Fupdated-functions%2F' data-shr_title='Updated+functions'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F26%2Fupdated-functions%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F26%2Fupdated-functions%2F' data-shr_title='Updated+functions'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/26/updated-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I uploaded my first script to Script Center</title>
		<link>http://poweradmin.se/blog/2009/12/22/i-uploaded-my-first-script-to-script-center/</link>
		<comments>http://poweradmin.se/blog/2009/12/22/i-uploaded-my-first-script-to-script-center/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 19:42:41 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Script Center]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/22/i-uploaded-my-first-script-to-script-center/</guid>
		<description><![CDATA[I uploaded my first script to Microsoft&#8217;s Script Center. http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663 It was my Get-DotNetInfo function. I like the repository and that you can add comments. Please rate my function and write a comment. Good or bad! Technorati Tags: PowerShell,Function,Script Center &#8230; <a href="http://poweradmin.se/blog/2009/12/22/i-uploaded-my-first-script-to-script-center/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F22%252Fi-uploaded-my-first-script-to-script-center%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22I%20uploaded%20my%20first%20script%20to%20Script%20Center%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I uploaded my first script to Microsoft&#8217;s Script Center.</p>
<p><a title="http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663" href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663">http://gallery.technet.microsoft.com/ScriptCenter/en-us/c5158ed5-5b82-4243-9654-9106f7ca6663</a></p>
<p>It was my Get-DotNetInfo function.</p>
<p>I like the repository and that you can add comments.</p>
<p>Please rate my function and write a comment.   <br />Good or bad!</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c3a78dd1-2d13-4826-85ac-1db4fdfeea1a" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a>,<a href="http://technorati.com/tags/Script+Center" rel="tag">Script Center</a></div>
<div class="shr-publisher-1247"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F22%2Fi-uploaded-my-first-script-to-script-center%2F' data-shr_title='I+uploaded+my+first+script+to+Script+Center'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F22%2Fi-uploaded-my-first-script-to-script-center%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F22%2Fi-uploaded-my-first-script-to-script-center%2F' data-shr_title='I+uploaded+my+first+script+to+Script+Center'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/22/i-uploaded-my-first-script-to-script-center/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get-DotNetInfo function</title>
		<link>http://poweradmin.se/blog/2009/12/19/get-dotnetinfo-function/</link>
		<comments>http://poweradmin.se/blog/2009/12/19/get-dotnetinfo-function/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 08:04:08 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[dot net]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/19/get-dotnetinfo-function/</guid>
		<description><![CDATA[I made this function back in 2007. But I did only published It in Swedish then. This function helps me a lot when I’m working with PowerShell and Dot Net classes. When I have the Dot Net Class that I &#8230; <a href="http://poweradmin.se/blog/2009/12/19/get-dotnetinfo-function/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F19%252Fget-dotnetinfo-function%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Get-DotNetInfo%20function%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><font color="#000000"><font color="#000000">I made this function back in 2007.       <br />But I did only published It in Swedish then.</font></font>  <span style="color: #008000"><font color="#000000">This function helps me a lot when I’m working       <br /></font></span><span style="color: #008000"><span style="color: #008000"><font color="#000000">with PowerShell and Dot Net classes.          </p>
<p></font></span></span><span style="color: #008000"><font color="#000000">When I have the Dot Net Class that I want       <br /></font></span><span style="color: #008000"><font color="#000000">to use but not much information. Then I just        <br />call this function with the Dot Net Class         <br />and IE opens with the information.        </p>
<p></font></span><span style="color: #008000">#</span><span style="color: #008000"> Get-DotNetInfo Function</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> By Fredrik Wall, fredrik@poweradmin.se</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> http://www.poweradmin.se/blog</span><span style="color: #008000">     <br />#      <br />#</span><span style="color: #008000"> Created: 2007-09-13</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Last modified: 2009-12-18</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Tested on: Windows XP, Windows Vista,</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Windows 7, Windows Server 2008 R2</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Revision history:</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> 2009-12-18 ADD: Function information</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Example of calling the function:</span><span style="color: #008000">     <br />#</span><span style="color: #008000"> Get-DotNetInfo System.Net.Webclient</span><span style="color: #008000">     <br /></span><span style="color: #000000">     <br /></span><span style="color: #0000ff">Function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Get-DotNetInfo</span><span style="color: #000000"> {     <br />&#160; </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">$dotnet</span><span style="color: #ff0000">=</span><span style="color: #800000">&quot;&quot;</span><span style="color: #000000">)     <br />&#160; </span><span style="color: #800080">$objIE</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="font-style: italic; color: #5f9ea0">-Com</span><span style="color: #000000"> </span><span style="color: #800000">Internetexplorer.Application</span><span style="color: #000000">     <br />&#160; </span><span style="color: #800080">$url</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">&quot;</span><span style="color: #800000">http://msdn2.microsoft.com/en-us/library/</span><span style="color: #800000">&quot;</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$dotnet</span><span style="color: #000000">     <br />&#160; </span><span style="color: #800080">$objIE</span><span style="color: #000000">.Navigate(</span><span style="color: #800080">$url</span><span style="color: #000000">)     <br />&#160; </span><span style="color: #800080">$objIE</span><span style="color: #000000">.Visible</span><span style="color: #ff0000">=</span><span style="color: #800080">$true</span><span style="color: #000000">     <br />}</span></p>
<pre><span style="color: #000000">
</span></pre>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a37d6b21-c578-4224-9e62-ba737e738ab1" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/.net" rel="tag">.net</a>,<a href="http://technorati.com/tags/dot+net" rel="tag">dot net</a>,<a href="http://technorati.com/tags/Internet+Explorer" rel="tag">Internet Explorer</a>,<a href="http://technorati.com/tags/function" rel="tag">function</a></div>
<ul>
<li></li>
</ul>
<div class="shr-publisher-1225"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F19%2Fget-dotnetinfo-function%2F' data-shr_title='Get-DotNetInfo+function'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F19%2Fget-dotnetinfo-function%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F19%2Fget-dotnetinfo-function%2F' data-shr_title='Get-DotNetInfo+function'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/19/get-dotnetinfo-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Lab AD Functions (Updated)</title>
		<link>http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/</link>
		<comments>http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 15:30:25 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/</guid>
		<description><![CDATA[I wrote a script some years back in VBScript that madeActive Directory Users with “Real Swedish” names. It’s took Firstname from one text file and Lastname fromanother text file, randomly. And made random Passwords as well. So instead of getting &#8230; <a href="http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F15%252Fcreate-lab-ad-functions-updated%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Create%20Lab%20AD%20Functions%20%28Updated%29%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I wrote a script some years back in VBScript that made<br />Active Directory Users with “Real Swedish” names.</p>
<p>It’s took Firstname from one text file and Lastname from<br />another text file, randomly. And made random Passwords as well.</p>
<p>So instead of getting users like “user0001” and “user998” I got<br />”Anders Svensson” and “Lena Persson”. Prettys nice.</p>
<p>The bad part about the VBScript was that It took 10-15 min to clean<br />the textfiles first. </p>
<p>I’m a computer geek and I do lots of labs with AD so I wanted to<br />make a similar thing with PowerShell.</p>
<p>After some work I have made 2 functions that will get two<br />lists of common First and Last names from The Gothenburg University.</p>
<p>The first function are:</p>
<pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">getFNames</span><span style="color: #000000"> {
</span><span style="color: #008000">#</span><span style="color: #008000"> Get a list of Swedish Firstnames from Gothenburg University</span><span style="color: #008000">
</span><span style="color: #0000ff">param</span><span style="color: #000000"> (</span><span style="color: #800080">$fNameFile</span><span style="color: #000000">)
</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #ff0000">!</span><span style="color: #000000">(test-path -path </span><span style="color: #800080">$fNameFile</span><span style="color: #000000">)){
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$WebClient</span><span style="color: #000000"> </span><span style="color: #ff0000">-eq</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">) {</span><span style="color: #800080">$Global:WebClient</span><span style="color: #000000">=new-object System.Net.WebClient  }
    </span><span style="color: #800080">$url</span><span style="color: #ff0000">=</span><span style="color: #800000">"</span><span style="color: #800000">http://spraakbanken.gu.se/statistik/lbfnamn.phtml</span><span style="color: #800000">"</span><span style="color: #000000">

    </span><span style="color: #800080">$fNames</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: #800080">$url</span><span style="color: #000000">)  </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">[0-9]</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;tr&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/td&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/tr&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;b&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/b&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td class=</span><span style="color: #800000">""</span><span style="color: #800000">le</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;table&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/table&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;br /&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;hr /&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;body&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/body&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;html&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/html&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;table width=</span><span style="color: #800000">""</span><span style="color: #800000">%</span><span style="color: #800000">""</span><span style="color: #800000">&gt;&lt;td width=</span><span style="color: #800000">""</span><span style="color: #800000">%</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td class=</span><span style="color: #800000">""</span><span style="color: #800000">lastupd</span><span style="color: #800000">""</span><span style="color: #800000">&gt;Senaste ändring &lt;b class=</span><span style="color: #800000">""</span><span style="color: #800000">date</span><span style="color: #800000">""</span><span style="color: #800000">&gt;  okt  av lbtekn@svenska.gu.se&lt;/a&gt;.</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;!doctype html public </span><span style="color: #800000">""</span><span style="color: #800000">-//wc//dtd html . transitional//en</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;head&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/head&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #8
00000">"</span><span style="color: #800000">&lt;h&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/h&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;title&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/title&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;tr class=</span><span style="color: #800000">""</span><span style="color: #800000">headrow</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">   &lt;meta http-equiv=</span><span style="color: #800000">""</span><span style="color: #800000">Content-Type</span><span style="color: #800000">""</span><span style="color: #800000"> content=</span><span style="color: #800000">""</span><span style="color: #800000">text/html; charset=iso—</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">   &lt;link rel=</span><span style="color: #800000">""</span><span style="color: #800000">STYLESHEET</span><span style="color: #800000">""</span><span style="color: #800000"> href=</span><span style="color: #800000">""</span><span style="color: #800000">/css/statistik.css</span><span style="color: #800000">""</span><span style="color: #800000"> type=</span><span style="color: #800000">""</span><span style="color: #800000">text/css</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">Vanliga förnamn, ordnade efter frekvens.</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">       Rang   Pojknamn           Frekvens   Rang   Flicknamn          Frekvens</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">\s{3,}</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000"> </span><span style="color: #800000">"</span><span style="color: #000000">
</span></pre>
<pre><span style="color: #000000">    </span><span style="color: #800080">$fNames</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$fNames</span><span style="color: #000000"> </span><span style="color: #ff0000">-split</span><span style="color: #000000"> (</span><span style="color: #800000">"</span><span style="color: #800000"> </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">$fName</span><span style="color: #000000"> </span><span style="color: #0000ff">in</span><span style="color: #000000"> </span><span style="color: #800080">$fNames</span><span style="color: #000000">) {
        </span><span style="color: #800080">$fName</span><span style="color: #000000"> | Out-File </span><span style="color: #800080">$fNameFile</span><span style="color: #000000"> -append
    }
    }
}</span></pre>
<pre><span style="color: #000000">You will call It like this:</span><span style="color: #800080">$fNameFile</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">c:\scripts\fname.txt</span><span style="color: #800000">"</span><span style="color: #5f9ea0">getFNames</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span></pre>
<p><span style="color: #800080"><font color="#000000">or simply</font></span></p>
<pre><span style="color: #800080"><span style="color: #5f9ea0">getFNames</span><span style="color: #000000"> 'c:\scripts\fname.txt'</span></span><span style="color: #000000"></pre>
<p></span></p>
<p>First of all It will look for the file with all the first names.<br />If It can’t find It, It will download It from the server at<br />Gothenburg University and clean It.</p>
<p>Now You Got a text file with lots of names (1000).</p>
<p>And the other function are:</p>
<pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">getLNames</span><span style="color: #000000"> {
</span><span style="color: #008000">#</span><span style="color: #008000"> Get a list of Swedish Lastnames from Gothenburg University</span><span style="color: #008000">
</span><span style="color: #0000ff">param</span><span style="color: #000000"> (</span><span style="color: #800080">$lNameFile</span><span style="color: #000000">)
</span><span style="color: #0000ff">if</span><span style="color: #000000">(</span><span style="color: #ff0000">!</span><span style="color: #000000">(test-path -path </span><span style="color: #800080">$lNameFile</span><span style="color: #000000">)){
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$WebClient</span><span style="color: #000000"> </span><span style="color: #ff0000">-eq</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">) {</span><span style="color: #800080">$Global:WebClient</span><span style="color: #000000">=new-object System.Net.WebClient  }
    </span><span style="color: #800080">$url</span><span style="color: #ff0000">=</span><span style="color: #800000">"</span><span style="color: #800000">http://spraakbanken.gu.se/statistik/lbenamn.phtml</span><span style="color: #800000">"</span><span style="color: #000000">

    </span><span style="color: #800080">$lNames</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: #800080">$url</span><span style="color: #000000">)  </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">[0-9]</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;tr&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/td&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/tr&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;b&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/b&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td class=</span><span style="color: #800000">""</span><span style="color: #800000">le</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;table&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/table&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;br /&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;hr /&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;body&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/body&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;html&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/html&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;table width=</span><span style="color: #800000">""</span><span style="color: #800000">%</span><span style="color: #800000">""</span><span style="color: #800000">&gt;&lt;td width=</span><span style="color: #800000">""</span><span style="color: #800000">%</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;td class=</span><span style="color: #800000">""</span><span style="color: #800000">lastupd</span><span style="color: #800000">""</span><span style="color: #800000">&gt;Senaste ändring &lt;b class=</span><span style="color: #800000">""</span><span style="color: #800000">date</span><span style="color: #800000">""</span><span style="color: #800000">&gt;  okt  av lbtekn@svenska.gu.se&lt;/a&gt;.</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;!doctype html public </span><span style="color: #800000">""</span><span style="color: #800000">-//wc//dtd html . transitional//en</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;head&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/head&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #8
00000">"</span><span style="color: #800000">&lt;h&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/h&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;title&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;/title&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000"> </span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">&lt;tr class=</span><span style="color: #800000">""</span><span style="color: #800000">headrow</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">   &lt;meta http-equiv=</span><span style="color: #800000">""</span><span style="color: #800000">Content-Type</span><span style="color: #800000">""</span><span style="color: #800000"> content=</span><span style="color: #800000">""</span><span style="color: #800000">text/html; charset=iso—</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">   &lt;link rel=</span><span style="color: #800000">""</span><span style="color: #800000">STYLESHEET</span><span style="color: #800000">""</span><span style="color: #800000"> href=</span><span style="color: #800000">""</span><span style="color: #800000">/css/statistik.css</span><span style="color: #800000">""</span><span style="color: #800000"> type=</span><span style="color: #800000">""</span><span style="color: #800000">text/css</span><span style="color: #800000">""</span><span style="color: #800000">&gt;</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">Vanliga förnamn, ordnade efter frekvens.</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">       Rang   Pojknamn           Frekvens   Rang   Flicknamn          Frekvens</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">\s{3,}</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000"> </span><span style="color: #800000">"</span></pre>
<pre><span style="color: #800000"></span><span style="color: #ff0000">-replace</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000"> efternamn,frekvensordning Vanliga efternamn, i frekvensordning Rang Namn Frekvens </span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">""</span><span style="color: #000000">
</span></pre>
<pre><span style="color: #000000">    </span><span style="color: #800080">$lNames</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$lNames</span><span style="color: #000000"> </span><span style="color: #ff0000">-split</span><span style="color: #000000"> (</span><span style="color: #800000">"</span><span style="color: #800000"> </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">$lName</span><span style="color: #000000"> </span><span style="color: #0000ff">in</span><span style="color: #000000"> </span><span style="color: #800080">$lNames</span><span style="color: #000000">) {
        </span><span style="color: #800080">$lName</span><span style="color: #000000"> | Out-File </span><span style="color: #800080">$lNameFile</span><span style="color: #000000"> -append
    }
    }
}
</span></pre>
<p>&nbsp;</p>
<p>And this one will give you the same as the other function.</p>
<pre><span style="color: #000000">You will call It like this:</span><span style="color: #800080">$lNameFile</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">c:\scripts\lname.txt</span><span style="color: #800000">"</span><span style="color: #5f9ea0">getLNames</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span></pre>
<p><span style="color: #800080"><font color="#000000">or simply</font></span></p>
<pre><span style="color: #800080"><span style="color: #5f9ea0">getLNames</span><span style="color: #000000"> 'c:\scripts\lname.txt'</span></span></pre>
<p><span style="color: #000000">Now you got 1000 first names and 1000 last names to make random names of.</span></p>
<pre><span style="color: #000000">    </span><span style="color: #800080">$firstName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> Get-Content </span><span style="color: #800080">$fNameFile</span><span style="color: #000000"> | Get-Random -ErrorAction SilentlyContinue
    </span><span style="color: #800080">$lastName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> Get-Content </span><span style="color: #800080">$lNameFile</span><span style="color: #000000"> | Get-Random -ErrorAction SilentlyContinue
</span></pre>
<blockquote>
<p><span style="color: #800080">$firstName</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800000">&#8220;</span><span style="color: #800000"> </span><span style="color: #800000">&#8220;</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$lastName</span></p>
</blockquote>
<p><span style="color: #800080"><font color="#000000">I will post more of my script tommorow. This was todays function gift from me <img src='http://poweradmin.se/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </font></span></p>
<p><span style="color: #800080"><font color="#000000"></font></span>&nbsp;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c415491b-0929-4f59-a109-a595ac66f4b3" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Active+Directory" rel="tag">Active Directory</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a></div>
<p><span style="color: #800080"></span></p>
<div class="shr-publisher-1202"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fcreate-lab-ad-functions-updated%2F' data-shr_title='Create+Lab+AD+Functions+%28Updated%29'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fcreate-lab-ad-functions-updated%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fcreate-lab-ad-functions-updated%2F' data-shr_title='Create+Lab+AD+Functions+%28Updated%29'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Christmas special</title>
		<link>http://poweradmin.se/blog/2009/12/15/a-christmas-special/</link>
		<comments>http://poweradmin.se/blog/2009/12/15/a-christmas-special/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 06:33:13 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/15/a-christmas-special/</guid>
		<description><![CDATA[It’s soon Christmas and the first snow has landed here in Stockholm. &#160; So I have decided to do a Christmas special. I know, my friend DXter does a Geek special for Christmas. My Christmas special will be a PowerShell &#8230; <a href="http://poweradmin.se/blog/2009/12/15/a-christmas-special/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F15%252Fa-christmas-special%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22A%20Christmas%20special%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>It’s soon Christmas and the first snow has landed   <br />here in Stockholm.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/snowmanicon.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="snowman-icon" border="0" alt="snowman-icon" src="http://poweradmin.se/blog/wp-content/uploads/snowmanicon_thumb.png" width="96" height="96" /></a>&#160; </p>
<p>So I have decided to do a Christmas special.   <br />I know, my friend DXter does a Geek special    <br />for Christmas. My Christmas special will be a    <br />PowerShell function special.    </p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/presentblueicon.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="presentblue-icon" border="0" alt="presentblue-icon" src="http://poweradmin.se/blog/wp-content/uploads/presentblueicon_thumb.png" width="96" height="96" /></a> </p>
</p>
<p>I will post a function/day until Christmas eve.   <br />And I will also give all of my readers a special gift    <br />on Christmas eve…</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:56cf208d-8e5e-46c0-9cc4-687111d0a969" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Christmas" rel="tag">Christmas</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a></div>
<div class="shr-publisher-1180"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fa-christmas-special%2F' data-shr_title='A+Christmas+special'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fa-christmas-special%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F15%2Fa-christmas-special%2F' data-shr_title='A+Christmas+special'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/15/a-christmas-special/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clean Temp Function (Updated)</title>
		<link>http://poweradmin.se/blog/2009/12/14/clean-temp-function-updated/</link>
		<comments>http://poweradmin.se/blog/2009/12/14/clean-temp-function-updated/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 22:55:51 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[Clean-Temp]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2009/12/14/clean-temp-function-updated/</guid>
		<description><![CDATA[This is a small but effective function. It will delete most of the stuff in your temp dir. &#160; Use with close option to close all open programs before you clean the temp dir. It will not delete open/locked files. &#8230; <a href="http://poweradmin.se/blog/2009/12/14/clean-temp-function-updated/">Continue reading <span class="meta-nav">&#8594;</span></a>
No related posts.]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fpoweradmin.se%252Fblog%252F2009%252F12%252F14%252Fclean-temp-function-updated%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Clean%20Temp%20Function%20%28Updated%29%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --></p>
<pre><font size="2"><font face="Arial"><font color="#000000">This is a small but eff</span>ective function.</font></font></font></pre>
<pre><font size="2"><font face="Arial"><font color="#000000">It will delete most of the stuff in your temp dir.</font></font></font></pre>
<pre><font size="2"><font face="Arial"><font color="#000000">&nbsp;</pre>
<p></font></font></font>
<pre><font size="2"><font face="Arial"><font color="#000000">Use with close option to close all open programs</font></font></font></pre>
<pre><font size="2"><font face="Arial"><font color="#000000">before you clean the temp dir. It will not delete</font></font></font></pre>
<pre><font size="2"><font face="Arial"><font color="#000000">open/locked files.</font></font></font></pre>
<pre><span style="color: #008000"><a href="http://poweradmin.se/blog/wp-content/uploads/driveslimdosicon.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="drive-slim-dos-icon" border="0" alt="drive-slim-dos-icon" src="http://poweradmin.se/blog/wp-content/uploads/driveslimdosicon_thumb.png" width="116" height="116"></a> </span></pre>
<p><span style="color: #008000"><font color="#000000">The function can also be downloaded from the Download section.<br /></font></span><span style="color: #008000"><span style="color: #008000"><a href="http://poweradmin.se/blog/download"><font color="#000000">http://poweradmin.se/blog/download</font></a></span></p>
<p></span>
<pre><span style="color: #008000"></span>&nbsp;</pre>
<pre><span style="color: #008000">#</span><span style="color: #008000"> Clean Temp Function</span><span style="color: #008000">
#</span><span style="color: #008000"> By Fredrik Wall, fredrik@poweradmin.se</span><span style="color: #008000">
#</span><span style="color: #008000"> http://www.poweradmin.se/blog</span><span style="color: #008000">
#
#</span><span style="color: #008000"> Last modified: 2009-12-14</span><span style="color: #008000">
#</span><span style="color: #008000"> Tested on: Windows 7, Windows Server 2008 R2</span><span style="color: #008000">
#</span><span style="color: #008000"> Revision history:</span><span style="color: #008000">
#</span><span style="color: #008000"> 2009-12-14    ADD: -ErrorAction SilentlyContinue</span><span style="color: #008000">
#</span><span style="color: #008000">                ADD: Close option</span><span style="color: #008000">
#</span><span style="color: #008000"> Example of calling the function:</span><span style="color: #008000">
#</span><span style="color: #008000"> Clean-Temp</span><span style="color: #008000">
#</span><span style="color: #008000"> Clean-Temp 'Close'</span><span style="color: #008000">
#
</span><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Clean-Temp</span><span style="color: #000000"> {
    </span><span style="color: #0000ff">param</span><span style="color: #000000">(</span><span style="color: #800080">$status</span><span style="color: #000000">)
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$status</span><span style="color: #000000"> </span><span style="color: #ff0000">-eq</span><span style="color: #000000"> </span><span style="color: #800000">'</span><span style="color: #800000">close</span><span style="color: #800000">'</span><span style="color: #000000">) {
        </span><span style="color: #008000">#</span><span style="color: #008000"> Some programs that often uses temp dir for temp files</span><span style="color: #008000">
</span><span style="color: #000000">        </span><span style="color: #0000ff">process</span><span style="color: #000000"> iexplore</span><span style="color: #ff0000">*</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">kill</span><span style="color: #000000">
        </span><span style="color: #0000ff">process</span><span style="color: #000000"> outlook</span><span style="color: #ff0000">*</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">kill</span><span style="color: #000000">
        </span><span style="color: #0000ff">process</span><span style="color: #000000"> word</span><span style="color: #ff0000">*</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">kill</span><span style="color: #000000">
        </span><span style="color: #0000ff">process</span><span style="color: #000000"> excel</span><span style="color: #ff0000">*</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">kill</span><span style="color: #000000">
        </span><span style="color: #0000ff">process</span><span style="color: #000000"> msn</span><span style="color: #ff0000">*</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">kill</span><span style="color: #000000">

        </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">$Env:temp</span><span style="color: #800000">"</span><span style="color: #000000">
        </span><span style="color: #5f9ea0; font-weight: bold">Get-Childitem</span><span style="color: #000000"> </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Remove-Item</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Recurse</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Force</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
        </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">
    }
    </span><span style="color: #0000ff">else</span><span style="color: #000000">  {
        </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">$Env:temp</span><span style="color: #800000">"</span><span style="color: #000000">
        </span><span style="color: #5f9ea0; font-weight: bold">Get-Childitem</span><span style="color: #000000"> </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Remove-Item</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Recurse</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Force</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
        </span><span style="color: #800080">$myTemp</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">
    }
}</span></pre>
<p>&nbsp;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6ee4db75-47fa-4674-b593-8c9658b3cffa" class="wlWriterEditableSmartContent">Technorati Tags: <a href="http://technorati.com/tags/PowerShell" rel="tag">PowerShell</a>,<a href="http://technorati.com/tags/Function" rel="tag">Function</a>,<a href="http://technorati.com/tags/Clean-Temp" rel="tag">Clean-Temp</a></div>
<div class="shr-publisher-1172"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:60px;'><a class='shareaholic-fblike' data-shr_layout='box_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F14%2Fclean-temp-function-updated%2F' data-shr_title='Clean+Temp+Function+%28Updated%29'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F14%2Fclean-temp-function-updated%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2009%2F12%2F14%2Fclean-temp-function-updated%2F' data-shr_title='Clean+Temp+Function+%28Updated%29'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://poweradmin.se/blog/2009/12/14/clean-temp-function-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

