<?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; Active Directory</title>
	<atom:link href="http://poweradmin.se/blog/tag/active-directory/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>PowerShell + AD + QUEST</title>
		<link>http://poweradmin.se/blog/2011/03/15/powershell-ad-quest/</link>
		<comments>http://poweradmin.se/blog/2011/03/15/powershell-ad-quest/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 19:34:02 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[cmdlets]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2011/03/15/powershell-ad-quest/</guid>
		<description><![CDATA[I have been working with Quest AD cmdlets.Here are my stuff about It… Get it here:http://www.questsoftware.de/powershell/activeroles-server.aspx Install it! Now we need to add the snapin.To find out the name we just write (Get-PSSnapin –Registered).name And then we add it by &#8230; <a href="http://poweradmin.se/blog/2011/03/15/powershell-ad-quest/">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%252F03%252F15%252Fpowershell-ad-quest%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22PowerShell%20%2B%20AD%20%2B%20QUEST%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I have been working with Quest AD cmdlets.<br />Here are my stuff about It…</p>
<p>Get it here:<br /><a title="http://www.questsoftware.de/powershell/activeroles-server.aspx" href="http://www.questsoftware.de/powershell/activeroles-server.aspx">http://www.questsoftware.de/powershell/activeroles-server.aspx</a></p>
<p>Install it!</p>
<p>Now we need to add the snapin.<br />To find out the name we just write<strong> (Get-PSSnapin –Registered).name</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image486.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_thumb419.png" width="494" height="121"></a></p>
<p>And then we add it by writing <strong>Add-PSSnapin Quest.ActiveRoles.ADManagement</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image487.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_thumb420.png" width="499" height="122"></a></p>
<p>To list the cmdlets we can write <strong>Get-Command *qad*</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image488.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_thumb421.png" width="501" height="366"></a></p>
<p>To count the cmdlets associated with Quests AD cmdlets we can write<br /><strong>(Get-Command *qad*).count </strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image489.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_thumb422.png" width="503" height="62"></a></p>
<p>This means that we now have 81 new cmdlets loaded <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile8.png"></p>
<p>&nbsp;</p>
<p>In just a oneliner we now can get all users in the AD and export It to a csv file.</p>
<p><strong>Get-QADUser -sizelimit 5000 | select SamAccountName, UserPrincipalName, Name, DN<br />| export-csv C:\scripts\users.txt</strong></p>
<p>&nbsp;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image490.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_thumb423.png" width="505" height="269"></a></p>
<p>And now we can open the csv file in excel and see all the information.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image491.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_thumb424.png" width="505" height="338"></a></p>
<p>And this in under 10 min <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile8.png"></p>
<div class="shr-publisher-2481"></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%2F03%2F15%2Fpowershell-ad-quest%2F' data-shr_title='PowerShell+%2B+AD+%2B+QUEST'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F03%2F15%2Fpowershell-ad-quest%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F03%2F15%2Fpowershell-ad-quest%2F' data-shr_title='PowerShell+%2B+AD+%2B+QUEST'></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/03/15/powershell-ad-quest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move users the GUI way</title>
		<link>http://poweradmin.se/blog/2011/03/07/move-users-the-gui-way/</link>
		<comments>http://poweradmin.se/blog/2011/03/07/move-users-the-gui-way/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 13:02:00 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[Move Users]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2011/03/07/move-users-the-gui-way/</guid>
		<description><![CDATA[I got an Excel sheet with Users thatI should move from OUs to an inactive OU. I’m not a fan of manual work and I like to make toolsfor others. So I made a Move Users tool. The script populates &#8230; <a href="http://poweradmin.se/blog/2011/03/07/move-users-the-gui-way/">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%252F03%252F07%252Fmove-users-the-gui-way%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2FfvfyLe%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Move%20users%20the%20GUI%20way%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I got an Excel sheet with Users that<br />I should move from OUs to an inactive OU.</p>
<p>I’m not a fan of manual work and I like to make tools<br />for others.</p>
<p>So I made a Move Users tool.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image484.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_thumb417.png" width="156" height="244"></a></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image485.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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_thumb418.png" width="156" height="244"></a></p>
<p>The script populates the drop down lists with all OUs in the current domain.<br />Then It’s just to paste all users in the Users box and then hit Move.</p>
<p>If you want to test this script, mail me at fredrik(at)poweradmin(dot)se.</p>
<div class="shr-publisher-2467"></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%2F03%2F07%2Fmove-users-the-gui-way%2F' data-shr_title='Move+users+the+GUI+way'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F03%2F07%2Fmove-users-the-gui-way%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F03%2F07%2Fmove-users-the-gui-way%2F' data-shr_title='Move+users+the+GUI+way'></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/03/07/move-users-the-gui-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add Users to a Group&#8211;The GUI way</title>
		<link>http://poweradmin.se/blog/2011/02/01/add-users-to-a-groupthe-gui-way/</link>
		<comments>http://poweradmin.se/blog/2011/02/01/add-users-to-a-groupthe-gui-way/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 15:04:18 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[gui]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2011/02/01/add-users-to-a-groupthe-gui-way/</guid>
		<description><![CDATA[I wrote an little GUI app that will help Service desk add users to a group. No users in the group: The Application: The users: In this way they can take usernames from a Excel file and justpaste them into &#8230; <a href="http://poweradmin.se/blog/2011/02/01/add-users-to-a-groupthe-gui-way/">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%252F02%252F01%252Fadd-users-to-a-groupthe-gui-way%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Add%20Users%20to%20a%20Group%26ndash%3BThe%20GUI%20way%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I wrote an little GUI app that will help Service desk add user<font color="#ff0000">s</font><font color="#000000"> to a group.</font></p>
<p>No users in the group:<br /><a href="http://poweradmin.se/blog/wp-content/uploads/image471.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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_thumb404.png" width="221" height="244"></a></p>
<p>The Application:<br /><a href="http://poweradmin.se/blog/wp-content/uploads/image472.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_thumb405.png" width="209" height="244"></a></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image474.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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_thumb407.png" width="207" height="244"></a></p>
<p>The users:<br /><a href="http://poweradmin.se/blog/wp-content/uploads/image473.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_thumb406.png" width="220" height="244"></a></p>
<p>In this way they can take usernames from a Excel file and just<br />paste them into the application, chose Group from the drop down list, that have been populated with groups from the current Active Directory. And then press Add.</p>
<p>If you want this script, please e-mail me at fredrik(!at!)poweradmin(!dot!)se.</p>
<div class="shr-publisher-2389"></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%2F02%2F01%2Fadd-users-to-a-groupthe-gui-way%2F' data-shr_title='Add+Users+to+a+Group%26ndash%3BThe+GUI+way'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F02%2F01%2Fadd-users-to-a-groupthe-gui-way%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F02%2F01%2Fadd-users-to-a-groupthe-gui-way%2F' data-shr_title='Add+Users+to+a+Group%26ndash%3BThe+GUI+way'></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/02/01/add-users-to-a-groupthe-gui-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create Lab AD &#8211; Updated version</title>
		<link>http://poweradmin.se/blog/2011/01/31/create-lab-ad-updated-version/</link>
		<comments>http://poweradmin.se/blog/2011/01/31/create-lab-ad-updated-version/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 19:07:51 +0000</pubDate>
		<dc:creator>Dalle</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2011/01/31/create-lab-ad-updated-version/</guid>
		<description><![CDATA[I created a Create Lab AD script a while back.The script is now updated with some fixes. The script got error messages sometimes, but created usersanyway. With wrong samaccountnames, but created users I looked at the text files with names &#8230; <a href="http://poweradmin.se/blog/2011/01/31/create-lab-ad-updated-version/">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%252F01%252F31%252Fcreate-lab-ad-updated-version%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Create%20Lab%20AD%20%26ndash%3B%20Updated%20version%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p><img src="http://www.iconarchive.com/icons/iconshock/real-vista-mail/128/robot-icon.png" width="84" height="84"><img src="http://www.iconarchive.com/icons/aha-soft/people/128/people-icon.png" width="86" height="86"></p>
<p>I created a Create Lab AD script a while back.<br />The script is now updated with some fixes.</p>
<p>The script got error messages sometimes, but created users<br />anyway. With wrong samaccountnames, but created users <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile6.png"></p>
<p>I looked at the text files with names and thought at the first that It was empty lines<br />that was the bad thing. So I did a easy fix for that, but got the errors anyway.</p>
<p>After some tests and looking to the files I understood that the problem was when the names<br />was shorter then 3, so I did a fix for that too.</p>
<p>I have been posted the script in pieces before.</p>
<p><a title="http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/" href="http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/">http://poweradmin.se/blog/2009/12/15/create-lab-ad-functions-updated/</a><br /><a title="http://poweradmin.se/blog/2009/12/16/create-lab-ad-continue/" href="http://poweradmin.se/blog/2009/12/16/create-lab-ad-continue/">http://poweradmin.se/blog/2009/12/16/create-lab-ad-continue/</a><br /><a title="http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-3/" href="http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-3/">http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-3/</a><br /><a title="http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-4/" href="http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-4/">http://poweradmin.se/blog/2009/12/17/create-lab-ad-part-4/</a><br /><a title="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5/" href="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5/">http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5/</a><br /><a title="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5-changed/" href="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5-changed/">http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-5-changed/</a><br /><a title="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-6/" href="http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-6/">http://poweradmin.se/blog/2009/12/21/create-lab-ad-part-6/</a><br /><a title="http://poweradmin.se/blog/2009/12/22/lab-ad-with-5000-users/" href="http://poweradmin.se/blog/2009/12/22/lab-ad-with-5000-users/">http://poweradmin.se/blog/2009/12/22/lab-ad-with-5000-users/</a><br /><a title="http://poweradmin.se/blog/2009/12/22/the-story-continues/" href="http://poweradmin.se/blog/2009/12/22/the-story-continues/">http://poweradmin.se/blog/2009/12/22/the-story-continues/</a></p>
<p>I thought that I had posted the whole script, but It seems like I did not…<br />…the first half of last year was not good in my private life, so I have missed a lot in my PowerShelling <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Ledsen" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-sadsmile1.png"></p>
<p>BUT this year will be a really good one instead <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Ler" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile6.png"></p>
<p><strong>The Story, short version</strong></p>
<p>The script will download first names (1000) and last names (1000) from a site in Sweden.<br />Then It will clean up the file, use it to create 1-5000 AD users with random names in a Lab OU with the choice of OUs, number of<br />letters from first name and last name for the samaccountname and more.</p>
<p>&nbsp;<a href="http://poweradmin.se/blog/wp-content/uploads/image468.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 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_thumb401.png" width="193" height="117"></a></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image469.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_thumb402.png" width="571" height="528"></a></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image470.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_thumb403.png" width="341" height="430"></a></p>
<p>&nbsp;</p>
<p>The whole script:</p>
<pre><span style="color: #5f9ea0; font-weight: bold"><font size="2">cls</font></span><span style="color: #000000">
</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Populate LAB AD with "Real" users and OUs</span></font><span style="color: #008000">
</span><span style="color: #000000">
</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Number Of Users to create</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$nrOfUsers</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">5000</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Number of Letters from Firstname in User Name</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$lettersUNamefName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">3</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Number of Letters from Lastname in User Name</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$lettersUNamelName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">3</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Name of the AD</span></font><span style="color: #008000">
<font size="2">#</font></span><span style="color: #008000"><font size="2"> Default is the domain where your user are.</font></span><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$activeLabDomain</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">DirectoryServices.DirectoryEntry</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #800080">$labDomain</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$activeLabDomain</span></font><font size="2"><span style="color: #000000">.distinguishedName

</span><span style="color: #008000">#</span><span style="color: #008000"> LAB OU</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$labOU</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">Lab OU</span><span style="color: #800000">"</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> OUs to create</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$labOUs</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">Finance</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">IT</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Marketing</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Operations</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Service</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Customer Support</span><span style="color: #800000">"</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> OU structure under each OU</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$OUStructure</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">Users</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Groups</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Computers</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">"</span><span style="color: #800000">Service Accounts</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Admins</span><span style="color: #800000">"</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Country</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$userCountry</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">Sweden</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Norway</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Denmark</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">Finland</span><span style="color: #800000">"</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Path to the file with Firstnames</span></font><span style="color: #008000">
</span><font size="2"><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.tmp</span><span style="color: #800000">"</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #800080">$fNameFileFixed</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></font><span style="color: #000000">
</span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Path to the file with Lastnames</span></font><span style="color: #008000">
</span><font size="2"><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.tmp</span><span style="color: #800000">"</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #800080">$lNameFileFixed</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></font><span style="color: #000000">

</span><font size="2"><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">getFNames</span></font><font size="2"><span style="color: #000000"> {
</span><span style="color: #008000">#</span><span style="color: #008000"> Get a list of Swedish Firstnames from Gothenburg University</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #0000ff">param</span><span style="color: #000000"> (</span><span style="color: #800080">$fNameFile</span></font><font size="2"><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">(</span><span style="color: #5f9ea0; font-weight: bold">test-path</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-path</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span></font><font size="2"><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">=</span><span style="color: #5f9ea0; font-weight: bold">new-object</span><span style="color: #000000"> </span><span style="color: #800000">System.Net.WebClient</span></font><font size="2"><span style="color: #000000">  }
    </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></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><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><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;/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><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><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><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><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><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><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;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><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">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><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;!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><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: #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;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><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;/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><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;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><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;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><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">Vanliga förnamn, ordnade efter frekvens.</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">       Rang   Pojknamn           Frekvens   Rang   Flicknamn          Frekvens</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">\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></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><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></font><font size="2"><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></font><font size="2"><span style="color: #000000">) {
        </span><span style="color: #800080">$fName</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Out-File</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-append</span></font><span style="color: #000000">
<font size="2">    }
    }
}

</font></span><font size="2"><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">getLNames</span></font><font size="2"><span style="color: #000000"> {
</span><span style="color: #008000">#</span><span style="color: #008000"> Get a list of Swedish Lastnames from Gothenburg University</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #0000ff">param</span><span style="color: #000000"> (</span><span style="color: #800080">$lNameFile</span></font><font size="2"><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">(</span><span style="color: #5f9ea0; font-weight: bold">test-path</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-path</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span></font><font size="2"><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">=</span><span style="color: #5f9ea0; font-weight: bold">new-object</span><span style="color: #000000"> </span><span style="color: #800000">System.Net.WebClient</span></font><font size="2"><span style="color: #000000">  }
    </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></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><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><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;/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><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><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><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><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><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><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;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><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">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><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;!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><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: #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;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><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;/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><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;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><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;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><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">Vanliga förnamn, ordnade efter frekvens.</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">       Rang   Pojknamn           Frekvens   Rang   Flicknamn          Frekvens</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">\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><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></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><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></font><font size="2"><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></font><font size="2"><span style="color: #000000">) {

        </span><span style="color: #800080">$lName</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">where</span><span style="color: #000000"> {</span><span style="color: #800080">$_</span><span style="color: #000000">.length </span><span style="color: #ff0000">-gt</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">2</span><span style="color: #800000">"</span><span style="color: #000000">} | </span><span style="color: #5f9ea0; font-weight: bold">Out-File</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-append</span></font><span style="color: #000000">
<font size="2">    }
    }
} 

</font></span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Creating the "root" Lab OU</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$search</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> [</span><span style="color: #008080">System.DirectoryServices.DirectorySearcher</span><span style="color: #000000">]</span><span style="color: #800000">"</span><span style="color: #800000">[ADSI]LDAP://$labDomain</span><span style="color: #800000">"</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #800080">$search</span><span style="color: #000000">.Filter </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">(&amp;(name=$labOU)(objectCategory=organizationalunit))</span><span style="color: #800000">"</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #800080">$result</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$search</span></font><font size="2"><span style="color: #000000">.FindOne()

</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">-eq</span><span style="color: #000000"> </span><span style="color: #800080">$null</span></font><font size="2"><span style="color: #000000">) {
    </span><span style="color: #800080">$labADSIDomain</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> [</span><span style="color: #008080">ADSI</span><span style="color: #000000">]</span><span style="color: #800000">"</span><span style="color: #800000">LDAP://$labDomain</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><span style="color: #800080">$objOU</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$labADSIDomain</span><span style="color: #000000">.Create(</span><span style="color: #800000">"</span><span style="color: #800000">OrganizationalUnit</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">ou=</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$labOU</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objOU</span></font><font size="2"><span style="color: #000000">.SetInfo()
    </span><span style="color: #5f9ea0; font-weight: bold">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$labOU</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">created</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">}
</font></span><span style="color: #0000ff"><font size="2">else</font></span><span style="color: #000000">
<font size="2">{
    </font></span><font size="2"><span style="color: #5f9ea0; font-weight: bold">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$labOU</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">exists</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">}

</font></span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Creating all OUs in the Lab OU</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #800080">$labDomainOU</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> [</span><span style="color: #008080">ADSI</span><span style="color: #000000">]</span><span style="color: #800000">"</span><span style="color: #800000">LDAP://ou=$labOU,$labDomain</span><span style="color: #800000">"</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #0000ff">foreach</span><span style="color: #000000"> (</span><span style="color: #800080">$labUnit</span><span style="color: #000000"> </span><span style="color: #0000ff">in</span><span style="color: #000000"> </span><span style="color: #800080">$labOUs</span></font><font size="2"><span style="color: #000000">) {
    </span><span style="color: #800080">$search</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> [</span><span style="color: #008080">System.DirectoryServices.DirectorySearcher</span><span style="color: #000000">]</span><span style="color: #800080">$labDomainOU</span></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><span style="color: #800080">$search</span><span style="color: #000000">.Filter </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">(&amp;(name=$labUnit)(objectCategory=organizationalunit))</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><span style="color: #800080">$result</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$search</span></font><font size="2"><span style="color: #000000">.FindOne()
    </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">-eq</span><span style="color: #000000"> </span><span style="color: #800080">$null</span></font><font size="2"><span style="color: #000000">) {
        </span><span style="color: #800080">$objOU</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$labDomainOU</span><span style="color: #000000">.Create(</span><span style="color: #800000">"</span><span style="color: #800000">OrganizationalUnit</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">ou=</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$labUnit</span></font><font size="2"><span style="color: #000000">)
        </span><span style="color: #800080">$objOU</span></font><font size="2"><span style="color: #000000">.SetInfo()

        </span><span style="color: #5f9ea0; font-weight: bold">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$labUnit</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">created</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">    }
    </font></span><span style="color: #0000ff"><font size="2">else</font></span><span style="color: #000000">
<font size="2">    {
        </font></span><font size="2"><span style="color: #5f9ea0; font-weight: bold">Write-Host</span><span style="color: #000000"> </span><span style="color: #800080">$labUnit</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">exists</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">    }

}

</font></span><font size="2"><span style="color: #5f9ea0">getFNames</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #5f9ea0">getLNames</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #5f9ea0; font-weight: bold">gc</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">where</span><span style="color: #000000"> {</span><span style="color: #800080">$_</span><span style="color: #000000"> </span><span style="color: #ff0000">-ne</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">} &gt; </span><span style="color: #800080">$fNameFileFixed</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #5f9ea0; font-weight: bold">gc</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">where</span><span style="color: #000000"> {</span><span style="color: #800080">$_</span><span style="color: #000000"> </span><span style="color: #ff0000">-ne</span><span style="color: #000000"> </span><span style="color: #800000">""</span><span style="color: #000000">} &gt; </span><span style="color: #800080">$lNameFileFixed</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #5f9ea0; font-weight: bold">del</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFile</span></font><span style="color: #000000">
</span><font size="2"><span style="color: #5f9ea0; font-weight: bold">del</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFile</span></font><span style="color: #000000">

</span><font size="2"><span style="color: #0000ff">for</span><span style="color: #000000">(</span><span style="color: #800080">$i</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </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">$nrOfUsers</span><span style="color: #000000"> ;</span><span style="color: #800080">$i</span></font><font size="2"><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"> </span><span style="color: #5f9ea0; font-weight: bold">Get-Content</span><span style="color: #000000"> </span><span style="color: #800080">$fNameFileFixed</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</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></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><span style="color: #800080">$lastName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">Get-Content</span><span style="color: #000000"> </span><span style="color: #800080">$lNameFileFixed</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</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></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$mylabOUs</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$labOUs</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$userFirstName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$firstName</span><span style="color: #000000"> </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">a</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">a</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">o</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">A</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">A</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">O</span><span style="color: #800000">'</span><span style="color: #000000">)  </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">u</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">U</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">e</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">E</span><span style="color: #800000">'</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$userFirstName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userFirstName</span></font><font size="2"><span style="color: #000000">.ToLower()
    </span><span style="color: #800080">$userShortFirstName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userFirstName</span><span style="color: #000000">.Substring(</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #800080">$lettersUNamefName</span></font><font size="2"><span style="color: #000000">)

    </span><span style="color: #800080">$userLastName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$lastName</span><span style="color: #000000"> </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">a</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">a</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">o</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">A</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">A</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">O</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">u</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">U</span><span style="color: #800000">'</span><span style="color: #000000">)  </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">e</span><span style="color: #800000">'</span><span style="color: #000000">) </span><span style="color: #ff0000">-creplace</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: #800000">'</span><span style="color: #800000">E</span><span style="color: #800000">'</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$userLastName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userLastName</span></font><font size="2"><span style="color: #000000">.ToLower()
    </span><span style="color: #800080">$userShortLastName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userLastName</span><span style="color: #000000">.Substring(</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #800080">$lettersUNamelName</span></font><font size="2"><span style="color: #000000">)

        </span><span style="color: #800080">$userNumber</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Minimum</span><span style="color: #000000"> </span><span style="color: #000000">10000</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Maximum</span><span style="color: #000000"> </span><span style="color: #000000">99999</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$userSAM</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userShortFirstName</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userShortLastName</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userNumber</span></font><span style="color: #000000">
<font size="2">    

    </font></span><font size="2"><span style="color: #800080">$userLastTele</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Minimum</span><span style="color: #000000"> </span><span style="color: #000000">1000</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Maximum</span><span style="color: #000000"> </span><span style="color: #000000">9999</span></font><span style="color: #000000">
<font size="2">    </font></span><font size="2"><span style="color: #800080">$userTele</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">+468-440 </span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userLastTele</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$myUserCountry</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userCountry</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-Random</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #0000ff">switch</span><span style="color: #000000"> (</span><span style="color: #800080">$myUserCountry</span></font><font size="2"><span style="color: #000000">)
    {
        </span><span style="color: #800000">'</span><span style="color: #800000">Sweden</span><span style="color: #800000">'</span><span style="color: #000000"> {</span><span style="color: #800080">$userCoutryCode</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">se</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">}
        </span><span style="color: #800000">'</span><span style="color: #800000">Denmark</span><span style="color: #800000">'</span><span style="color: #000000"> {</span><span style="color: #800080">$userCoutryCode</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">dk</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">}
        </span><span style="color: #800000">'</span><span style="color: #800000">Finland</span><span style="color: #800000">'</span><span style="color: #000000"> {</span><span style="color: #800080">$userCoutryCode</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">fi</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">}
        </span><span style="color: #800000">'</span><span style="color: #800000">Norway</span><span style="color: #800000">'</span><span style="color: #000000"> {</span><span style="color: #800080">$userCoutryCode</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">no</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">}
        </span><span style="color: #0000ff">default</span><span style="color: #000000"> {</span><span style="color: #800080">$userCoutryCode</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">local</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">}
    }

    </span><span style="color: #800080">$userEmail</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userFirstName</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">.</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userLastName</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">@poweradmin.</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userCoutryCode</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$userDescription</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><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"> </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"> </span><span style="color: #800080">$lastName</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"> at </span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$mylabOUs</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"> in </span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$myUserCountry</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$userPrincipalName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$userFirstName</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">.</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$userLastName</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">@poweradmin.local</span><span style="color: #800000">"</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #800080">$displayName</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$LastName</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">, </span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$FirstName</span></font><span style="color: #000000">
<font size="2">
    </font></span><font size="2"><span style="color: #008000">#</span><span style="color: #008000"> Creating the User</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #000000">    </span><span style="color: #800080">$objOU</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">DirectoryServices.DirectoryEntry</span><span style="color: #000000">(</span><span style="color: #800000">"</span><span style="color: #800000">LDAP://OU=$myLabOUs,OU=$labOU,</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #ff0000">+</span><span style="color: #000000"> </span><span style="color: #800080">$labDomain</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$objOU</span><span style="color: #000000">.Create(</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">cn=$FirstName $LastName</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">sAMAccountName</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$userSAM</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">userPrincipalName</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800080">$userPrincipalName</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">displayName</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800080">$displayName</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">mail</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$userEmail</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">department</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$myLabOUs</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">company</span><span style="color: #800000">"</span><span style="color: #000000">,</span><span style="color: #800000">"</span><span style="color: #800000">Power Admin Corp</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">employeeNumber</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$userNumber</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">telephoneNumber</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$userTele</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.put(</span><span style="color: #800000">"</span><span style="color: #800000">wWWHomePage</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">http://www.poweradmin.se/blog</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">)

    </span><span style="color: #800080">$objUser</span></font><font size="2"><span style="color: #000000">.SetInfo()
    </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">Created - </span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #800080">$firstName</span><span style="color: #000000"> </span><span style="color: #800080">$lastName</span><span style="color: #000000"> </span><span style="color: #800000">"</span><span style="color: #800000">($userSAM) in</span><span style="color: #800000">"</span><span style="color: #000000"> </span><span style="color: #800080">$mylabOUs</span></font><font size="2"><span style="color: #000000"> 

    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">givenName</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$firstName</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">sn</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$lastName</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.Put(</span><span style="color: #800000">"</span><span style="color: #800000">description</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800080">$userDescription</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span></font><font size="2"><span style="color: #000000">.SetInfo()

    </span><span style="color: #008000">#</span><span style="color: #008000"> Password</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #000000">    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.psbase.invoke(</span><span style="color: #800000">"</span><span style="color: #800000">setpassword</span><span style="color: #800000">"</span><span style="color: #000000">, </span><span style="color: #800000">"</span><span style="color: #800000">myH@rdP@ssw0rd99!</span><span style="color: #800000">"</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span></font><font size="2"><span style="color: #000000">.SetInfo()

    </span><span style="color: #008000">#</span><span style="color: #008000"> Enable the account</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #000000">    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.psbase.invokeset(</span><span style="color: #800000">'</span><span style="color: #800000">accountdisabled</span><span style="color: #800000">'</span><span style="color: #000000">, </span><span style="color: #800080">$false</span></font><font size="2"><span style="color: #000000">)
    </span><span style="color: #800080">$objUser</span></font><font size="2"><span style="color: #000000">.SetInfo()

    </span><span style="color: #008000">#</span><span style="color: #008000"> Change password at next login</span></font><span style="color: #008000">
</span><font size="2"><span style="color: #000000">    </span><span style="color: #800080">$objUser</span><span style="color: #000000">.PwdLastSet </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #000000">0</span></font><span style="color: #000000">
<font size="2">    </font></span><span style="color: #800080"><font size="2">$objUser</font></span><span style="color: #000000"><font size="2">.Setinfo()

}

</font></span></pre>
<p><font color="#ff0000" size="3"><strong> The script is as allways provided as is and you should test this in a lab environment…</strong></font></p>
<p><font size="2"></font>&nbsp;</p>
<p><font size="2"></font></p>
<p><font size="2"></font></p>
<p><font size="2"></font></p>
<p><font size="2"></font></p>
<div class="shr-publisher-2382"></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%2F01%2F31%2Fcreate-lab-ad-updated-version%2F' data-shr_title='Create+Lab+AD+%26ndash%3B+Updated+version'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F01%2F31%2Fcreate-lab-ad-updated-version%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2011%2F01%2F31%2Fcreate-lab-ad-updated-version%2F' data-shr_title='Create+Lab+AD+%26ndash%3B+Updated+version'></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/01/31/create-lab-ad-updated-version/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Some fun with the Public Key Services container and the ADCS wizard</title>
		<link>http://poweradmin.se/blog/2010/11/18/some-fun-with-the-public-key-services-container-and-the-adcs-wizard/</link>
		<comments>http://poweradmin.se/blog/2010/11/18/some-fun-with-the-public-key-services-container-and-the-adcs-wizard/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 08:24:33 +0000</pubDate>
		<dc:creator>DXter</dc:creator>
				<category><![CDATA[PKI]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[DXter]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2010/11/18/some-fun-with-the-public-key-services-container-and-the-adcs-wizard/</guid>
		<description><![CDATA[Recently, I did an experiment of how well the ADCS wizard handles an administrator who “destroys” the Public Key Services container were ADCS and ADDS stores all PKI related information. I did many different tests and one of the was &#8230; <a href="http://poweradmin.se/blog/2010/11/18/some-fun-with-the-public-key-services-container-and-the-adcs-wizard/">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%252F11%252F18%252Fsome-fun-with-the-public-key-services-container-and-the-adcs-wizard%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Some%20fun%20with%20the%20Public%20Key%20Services%20container%20and%20the%20ADCS%20wizard%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Recently, I did an experiment of how well the ADCS wizard handles an administrator who “destroys” the Public Key Services container were ADCS and ADDS stores all PKI related information. I did many different tests and one of the was how the install wizards handles a damaged or even missing Public Key Services container! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-openmouthedsmile1.png" /></p>
<p>&#160;</p>
<p>People who knows me, knows that I am a fan of the extreme, so I started by simply deleting the entire Public Key Services container from Active Directory using ADSI Edit.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image449.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb383.png" width="644" height="288" /></a></p>
<p><strong>Note that the entire Public Key Services container is missing.</strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p>Now we can start the ADCS wizard and try to install an Enterprise Root.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image450.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb384.png" width="644" height="476" /></a></p>
<p><strong>Now things starts to get interesting! The ADCS wizard can not create a Enterprise CA even though the test machine is joined to the domain. (Well, technically the test machine is a domain controller <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile3.png" />.) </strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p>Now, lets create the Public Key Services container manually using ADSI Edit then!</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image451.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb385.png" width="644" height="289" /></a></p>
<p><strong>We create a empty container (with no child containers) under Services with the exact name “Public Key Services”.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>Now, lets try the wizard again<a href="http://poweradmin.se/blog/wp-content/uploads/image452.png">!<img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb386.png" width="644" height="476" /></a></p>
<p><strong>Now we can clearly install an Enterprise Root again.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>But the quite soon we face a problem.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image453.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb387.png" width="644" height="476" /></a></p>
<p><strong>The wizard does not complete successfully!</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>Of course, I had to find out what was wrong! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile3.png" /></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image454.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb388.png" width="644" height="356" /></a></p>
<p><strong>A quick investigation of the&#160; container revealed that the ADCS wizard had very nicely recreated all child containers in the Public Key Services container and all objects within them such as Certificate Templates, etc., except the pKIEnrollmentService object for the CA in the Enrollment Services container! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-sadsmile.png" /></strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>Now lets try this one more time. We uninstall the ADCS role and remove the Public Key Services container again. But this time, we do not only create the Public Key Services&#160; but also the Enrollment Services container as a child container as well.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image455.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb389.png" width="644" height="356" /></a></p>
<p><strong>We just create two containers this time, Public Key Services and the Enrollment Services container.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>Lets try to install the CA a final time!</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image456.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb390.png" width="644" height="476" /></a></p>
<p><strong>Looks good! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile2.png" /></strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>Lets confirm the installation with ADSI Edit.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image457.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb391.png" width="644" height="356" /></a>     <br /><strong>And a quick view in ADSI Edit confirms this time that the CA was correctly installed in all containers (and the NTAuth Certificate object), including the Enrollment Services container! <img style="border-bottom-style: none; border-left-sty<br />
le: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile3.png" /></strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p>I am a little bit sad about that the ADCS wizard could not populate the Enrollment Services container if it was not previously created. The installation wizard can create both create the container and populate it, but it can not do the both things at the same time!</p>
<p>However, it does manage to both recreate and populate all the other containers, including the CDP container which even have a child container that is holding the cRLDistributionPoint objects!</p>
<p>Lets just call this a bug that has a workaround! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile3.png" /></p>
<p>&#160;</p>
<p>&#160;</p>
<p>// Fredrik “DXter” Jonsson</p>
<div class="shr-publisher-2242"></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%2F11%2F18%2Fsome-fun-with-the-public-key-services-container-and-the-adcs-wizard%2F' data-shr_title='Some+fun+with+the+Public+Key+Services+container+and+the+ADCS+wizard'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F11%2F18%2Fsome-fun-with-the-public-key-services-container-and-the-adcs-wizard%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F11%2F18%2Fsome-fun-with-the-public-key-services-container-and-the-adcs-wizard%2F' data-shr_title='Some+fun+with+the+Public+Key+Services+container+and+the+ADCS+wizard'></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/11/18/some-fun-with-the-public-key-services-container-and-the-adcs-wizard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CADCT &#8211; CA Decommission Tool</title>
		<link>http://poweradmin.se/blog/2010/11/13/cadct-ca-decommission-tool/</link>
		<comments>http://poweradmin.se/blog/2010/11/13/cadct-ca-decommission-tool/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 18:23:36 +0000</pubDate>
		<dc:creator>DXter</dc:creator>
				<category><![CDATA[PKI]]></category>
		<category><![CDATA[PowerShell Blogs]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[DXter]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2010/11/13/cadct-ca-decommission-tool/</guid>
		<description><![CDATA[Have you ever wonder how­ to remove, uninstall or delete a specific CA from Active Directory in an easy way? Well, for some time now, I have been playing with a little PowerShell script I have created for easy decommission &#8230; <a href="http://poweradmin.se/blog/2010/11/13/cadct-ca-decommission-tool/">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%252F11%252F13%252Fcadct-ca-decommission-tool%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22CADCT%20-%20CA%20Decommission%20Tool%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Have you ever wonder how­ to remove, uninstall or delete a specific CA from Active Directory in an easy way? Well, for some time now, I have been playing with a little PowerShell script I have created for easy decommission of CA’s in Active Directory.</p>
<p>&#160;</p>
<p>I started first by creating a wrapper around certutil and the ADDS cmd-lets that comes with Windows Server 2008 R2. However, quite fast I decided to write my own mechanisms for removal in native .NET&#160; since all the CA and PKI information are simply just objects in Active Directory. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile2.png" /> (The only thing in the script that calls certutil is the removal of the CA from NTAuth Certificates).</p>
<p>&#160;</p>
<p>The tool does a complete removal of a specific CA from AD in a single command, including the specific CA’s LDAP CDP in Active Directory and it’s certificate in NTAuth Certificates. The tool is a simple PowerShell script that expects two parameters.</p>
<p><strong>-caname: </strong>The common name of the certificate of the CA you want to decommission.</p>
<p><strong>-caserver:</strong> The server name parameter is the name of the computer object hosing the CA.</p>
<p>&#160;</p>
<p>When the script is executed with the two necessary parameters (it won’t execute without them), it will delete all the PKI related objects for the CA in Active Directory immediately. <strong>If you want to remove/uninstall/delete a CA (completely) from Active Directory, this script does everything you want! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-openmouthedsmile.png" /></strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image445.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb379.png" width="644" height="211" /></a></p>
<p><strong>When executed, the script reveals what objects that are being deleted.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image446.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb380.png" width="644" height="218" /></a></p>
<p><strong>The script can be run multiple times for confirmation reasons. If the CA objects are already deleted, the script will say so.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p>The most common situation is that a CA decommission is being done after the uninstallation of the ADCS role from the CA. When this is being done, the ADCS wizard removes the CA’s object in the Enrollment Services container so clients does not to request certificates from it and so PKI View does not monitor that CA/PKI structure anymore. If you run the script to remove a CA that has been correctly uninstalled it will delete all remaining objects except the object in Enrollment Services since it is already deleted.</p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image447.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb381.png" width="644" height="211" /></a></p>
<p><strong>In this case, the script removes everything except the object in Enrollment Services since it is already deleted.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p><strong></strong></p>
<p><strong></strong></p>
<p><strong>EDIT: I want to give many thanks to my very intelligent colleague/developer Kerim! He brought it to my attention that the script had NO verification check if certutil was installed or not. I added that now! Thanks a lot buddy! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-openmouthedsmile.png" /> (When I get enough time, I will replace the NTAuthCertificates removal part with my own code instead of having a dependency on certutil only for that small part.)</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p><strong></strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image448.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb382.png" width="644" height="218" /></a></p>
<p><strong>Now the script prompts a warning if certutil can not be found on the machine.</strong></p>
<p>&#160;</p>
<p>The script can be found in the <a href="http://poweradmin.se/blog/download/?did=7">download section</a>.</p>
<p>Enjoy! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile2.png" /></p>
<p>&#160;</p>
<p>// Fredrik “DXter” Jonsson</p>
<div class="shr-publisher-2197"></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%2F11%2F13%2Fcadct-ca-decommission-tool%2F' data-shr_title='CADCT+-+CA+Decommission+Tool'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F11%2F13%2Fcadct-ca-decommission-tool%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F11%2F13%2Fcadct-ca-decommission-tool%2F' data-shr_title='CADCT+-+CA+Decommission+Tool'></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/11/13/cadct-ca-decommission-tool/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>certutil&#8211;dsdel does not clean up completely</title>
		<link>http://poweradmin.se/blog/2010/10/12/certutildsdel-does-not-clean-up-completely/</link>
		<comments>http://poweradmin.se/blog/2010/10/12/certutildsdel-does-not-clean-up-completely/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 18:44:22 +0000</pubDate>
		<dc:creator>DXter</dc:creator>
				<category><![CDATA[PKI]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[certutil]]></category>
		<category><![CDATA[DXter]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2010/10/12/certutildsdel-does-not-clean-up-completely/</guid>
		<description><![CDATA[I have noticed that some people have tried to do a CA decommission with the dsdel option in certutil. However, there is just a little, little problem with it: it does not remove everything! &#160; Now, what is wrong with &#8230; <a href="http://poweradmin.se/blog/2010/10/12/certutildsdel-does-not-clean-up-completely/">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%252F10%252F12%252Fcertutildsdel-does-not-clean-up-completely%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22certutil%26%238211%3Bdsdel%20does%20not%20clean%20up%20completely%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><blockquote><p>I have noticed that some people have tried to do a CA decommission with the dsdel option in certutil.</p>
<p>However, there is just a little, little problem with it: it does not remove everything! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile1.png" /></p>
<p>&#160;</p>
<p><strong>Now, what is wrong with this picture?</strong></p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image420.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb354.png" width="644" height="321" /></a></p>
<p><strong>Is someone forgetting the NTAuthCertificates store? <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile1.png" /></strong></p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image421.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb355.png" width="644" height="386" /></a></p>
<p><strong>The NTAuthCertificates store is different from the other containers in Public Key Services.</strong></p>
<p>First of all, is is not a container unlike the rest of the stuff in Public Key Services, it is an container object. Secondly, it is an object that stores the certificates in the multivalued attribute <strong>cACertificate</strong>, which stores octet strings of ASN-encoded certificates.</p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image422.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb356.png" width="475" height="484" /></a></p>
<p><strong>This means that CA still exists in the NTAuth store in Active Directory!</strong></p>
<p>&#160;</p>
<p>However, we can solve this problem very easy. One way is to remove it using pkiview.msc according to the screenshot above. Another way is to simply delete the entire container object <strong>NTAuthCertificates</strong> if it is not needed anymore, which might be the case if we have decommissioned our very last CA and for example, are not using any third party PKI’s for smartcard logon.</p>
<p>Worried about deleting the object? Don’t be! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-winkingsmile1.png" /></p>
<p>The object is automatically updated by the Active Directory Certificate Services wizard when an Enterprise CA is installed and if it does not exist, it will be created during the installation of the CA.</p>
<p>Another way to “force” a creation of the object again is to publish a CA certificate to the NTAuthCertificates store using certutil.</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/image423.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://poweradmin.se/blog/wp-content/uploads/image_thumb357.png" width="644" height="321" /></a></p>
<p><strong>As I have said before – certutil is my best friend! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticon-smile.png" /></strong></p>
<p>&#160;</p>
<p>// Fredrik “DXter” Jonsson</p>
</blockquote>
<div class="shr-publisher-2133"></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%2F10%2F12%2Fcertutildsdel-does-not-clean-up-completely%2F' data-shr_title='certutil%26%238211%3Bdsdel+does+not+clean+up+completely'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F10%2F12%2Fcertutildsdel-does-not-clean-up-completely%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F10%2F12%2Fcertutildsdel-does-not-clean-up-completely%2F' data-shr_title='certutil%26%238211%3Bdsdel+does+not+clean+up+completely'></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/10/12/certutildsdel-does-not-clean-up-completely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PKI cleanup in AD with PS</title>
		<link>http://poweradmin.se/blog/2010/07/10/pki-cleanup-in-ad-with-ps/</link>
		<comments>http://poweradmin.se/blog/2010/07/10/pki-cleanup-in-ad-with-ps/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 12:42:43 +0000</pubDate>
		<dc:creator>DXter</dc:creator>
				<category><![CDATA[PKI]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[DXter]]></category>
		<category><![CDATA[PowerShell Blogs]]></category>

		<guid isPermaLink="false">http://poweradmin.se/blog/2010/07/10/pki-cleanup-in-ad-with-ps/</guid>
		<description><![CDATA[Yesterday I created this little script and I wanted to share it with you guys. Now that PKI View is removed from KB889250, some people has asked me how to remove all references to old PKI structures in Active Directory &#8230; <a href="http://poweradmin.se/blog/2010/07/10/pki-cleanup-in-ad-with-ps/">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%252F07%252F10%252Fpki-cleanup-in-ad-with-ps%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22PKI%20cleanup%20in%20AD%20with%20PS%22%20%7D);"></div>
<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Yesterday I created this little script and I wanted to share it with you guys.</p>
<p>Now that PKI View is removed from <a title="http://support.microsoft.com/kb/889250" href="http://support.microsoft.com/kb/889250">KB889250</a>, some people has asked me how to remove all references to old PKI structures in Active Directory in a easier way than just LDAP. Even though AD cleanup is a standard procedure regarding CA decommission, many people are not aware of that and some people seems to just remove the ADCS role and think “that’s it!”. <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticonsadsmile.png" /></p>
<p>&#160;</p>
<p>So yesterday I created a little script to do this AD cleanup automatically. It is using the Active Directory PS-Drive and the Remove-ADObject cmd-let that is provided by the Active Directory PowerShell Module that comes with Windows Server 2008 R2. Since the Active Directory PowerShell Module is using the Active Directory Management Gateway Service, make sure that at least one of your DC’s have it installed or is running on Windows Server 2008 R2. The idea of the script is to use it after a decommission of a single Enterprise Root or if you want to make sure that no old PKI stuff exists in Active Directory before you install a new PKI structure.&#160; This script removes ALL existing references to internal PKI’s and CA’s, so use it very carefully! I think that people should use it only after you have decommissioned your last CA or before you install your first.</p>
<p>&#160;</p>
<p>&#160; <br /><a href="http://poweradmin.se/blog/wp-content/uploads/1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="1" border="0" alt="1" src="http://poweradmin.se/blog/wp-content/uploads/1_thumb.png" width="644" height="321" /></a></p>
<p><strong>The first screen is presenting what the script will do.</strong></p>
<p><strong>&#160;</strong></p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="2" border="0" alt="2" src="http://poweradmin.se/blog/wp-content/uploads/2_thumb.png" width="644" height="321" /></a></p>
<p><strong>A final warning before continuing to delete stuff. <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticonwinkingsmile.png" /></strong>&#160; <br />&#160;</p>
<p>&#160; </p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="3" border="0" alt="3" src="http://poweradmin.se/blog/wp-content/uploads/3_thumb.png" width="244" height="191" /></a></p>
<p><strong>The script is prompting for credentials using the Get-Credential cmd-let.</strong></p>
<p><strong>&#160;</strong></p>
<p><strong>&#160;</strong></p>
<p><strong><a href="http://poweradmin.se/blog/wp-content/uploads/4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="4" border="0" alt="4" src="http://poweradmin.se/blog/wp-content/uploads/4_thumb.png" width="644" height="321" /></a></strong></p>
<p><strong>The script is searching the Public Key Services container in the Configuration partition (for the current domain) for specific PKI related objects that has object classes such as “certificationAuthority”, “pKIEnrollmentService”, “msPKI-PrivateKeyRecoveryAgent”, etc…</strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/5.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="5" border="0" alt="5" src="http://poweradmin.se/blog/wp-content/uploads/5_thumb.png" width="644" height="321" /></a>&#160; <br /><strong>All objects that are found are presented and the person that is executing the script has a option to remove the objects that are being presented. The Remove-ADObject cmd-let is doing the deletion of the objects with the credentials that was provided earlier to the credential prompt in the beginning of the script. <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticonsmile.png" /></strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://poweradmin.se/blog/wp-content/uploads/6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="6" border="0" alt="6" src="http://poweradmin.se/blog/wp-content/uploads/6_thumb.png" width="644" height="321" /></a></p>
<p><strong>A simple way to verify that everything is deleted correctly is simply to run the script again. If all PKI related objects are gone, the script will say so. <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://poweradmin.se/blog/wp-content/uploads/wlEmoticonsmile.png" /></strong></p>
<p>&#160;&#160;&#160;&#160;&#160; <br />If you think this sounds cool and want to test this in your test environment, the script is available from the download section on <a title="http://poweradmin.se/blog/download/?did=4" href="http://poweradmin.se/blog/download/?did=4">http://poweradmin.se/blog/download/?did=4</a>   <br />&#160; <br /> 
<p>// Fredrik “DXter” Jonsson</p>
<div class="shr-publisher-2058"></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%2F07%2F10%2Fpki-cleanup-in-ad-with-ps%2F' data-shr_title='PKI+cleanup+in+AD+with+PS'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F07%2F10%2Fpki-cleanup-in-ad-with-ps%2F'></a><a class='shareaholic-googleplusone' data-shr_size='tall' data-shr_count='true' data-shr_href='http%3A%2F%2Fpoweradmin.se%2Fblog%2F2010%2F07%2F10%2Fpki-cleanup-in-ad-with-ps%2F' data-shr_title='PKI+cleanup+in+AD+with+PS'></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/07/10/pki-cleanup-in-ad-with-ps/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

