﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:ng="http://newsgator.com/schema/extensions"><channel><title>Powershell on NewsGator Online</title><link>http://www.newsgator.com</link><description>Powershell on NewsGator Online</description><lastBuildDate>Tue, 29 Sep 2009 15:57:21 GMT</lastBuildDate><ttl>60</ttl><item><title>How to Create an Object in PowerShell</title><link>http://blogs.msdn.com/powershell/archive/2009/03/11/how-to-create-an-object-in-powershell.aspx</link><description>&lt;p&gt;Today someone in Xbox Live Operations (the folks that keep xBox Live alive and well) pinged me with a simple question about PowerShell with a complicated answer: &amp;#8220;How do I create a class in PowerShell?&amp;#8221;&lt;/p&gt; &lt;p&gt;There&amp;#8217;s two scenarios I find where people want classes.&amp;#160; The first (and most common) is familiarity: the person wants to make a class in PowerShell because they think of problems in terms of classes.&amp;#160; The second is practical: the person wants to make a collection of properties and methods, because that&amp;#8217;s what the pipeline in PowerShell plays nicely with (for instance, you can Group, Sort, or Select easily on properties on an object, but not as easily on a hashtable).&lt;/p&gt; &lt;p&gt;There are three ways you can do this with PowerShell V2 that I know of.&amp;#160; You can using Add-Type to compile C# or other .NET languages directly, and this is the only way you can make a real class definition in PowerShell V2.&amp;#160; You can also use New-Module with -asCustomObject to export the functions and variables within a dynamic module as a custom object, but you should be aware that complicated parameter sets do not work well as script methods.&amp;#160; Finally, you can do things the old V1 way, which is by tacking properties and methods onto an object with the Add-Member cmdlet.&amp;#160; Here's the same object, built in 3 different ways:&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;pre class="PowerShellColorizedScript"&gt;&lt;span style="color:#006400;"&gt;# You can compile a class with C# or other .NET languages in PowerShell v2&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Add-Type&lt;/span&gt; &lt;span style="color:#8b0000;"&gt;@'
public class MyObject
{ public int MyField = 5; public int xTimesMyField(int x) { return x * MyField; }
}
'@&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;New-Object&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;MyObject&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;.&lt;/span&gt;&lt;span style="color:#000000;"&gt;XTimesMyField&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#800080;"&gt;10&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt; &lt;span style="color:#006400;"&gt;# You can also use -asCustomObject with the New-Module cmdlet to export a module as a class&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;New-Module&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt; &lt;span style="color:#008080;"&gt;[int]&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$myField&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#800080;"&gt;5&lt;/span&gt; &lt;span style="color:#00008b;"&gt;function&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;XTimesMyField&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$x&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$x&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;*&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$myField&lt;/span&gt; &lt;span style="color:#000000;"&gt;}&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Export-ModuleMember&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Variable&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;*&lt;/span&gt; &lt;span style="color:#000080;"&gt;-Function&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;*&lt;/span&gt; &lt;span style="color:#000000;"&gt;}&lt;/span&gt; &lt;span style="color:#000080;"&gt;-asCustomObject&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;.&lt;/span&gt;&lt;span style="color:#000000;"&gt;xTimesMyField&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#800080;"&gt;10&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt; &lt;span style="color:#006400;"&gt;# You can also simply declare an object and start tacking on properties and methods with the&lt;/span&gt; &lt;span style="color:#006400;"&gt;# Add-Member cmdlet. If you use -passThru you can make one giant pipeline that adds all of the&lt;/span&gt; &lt;span style="color:#006400;"&gt;# members and assign it to a variable&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;New-Object&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;Object&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;|&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Add-Member&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;NoteProperty&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;MyField&lt;/span&gt; &lt;span style="color:#800080;"&gt;5&lt;/span&gt; &lt;span style="color:#000080;"&gt;-PassThru&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;|&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;Add-Member&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;ScriptMethod&lt;/span&gt; &lt;span style="color:#8a2be2;"&gt;xTimesMyField&lt;/span&gt; &lt;span style="color:#000000;"&gt;{&lt;/span&gt; &lt;span style="color:#00008b;"&gt;param&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#ff4500;"&gt;$x&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$x&lt;/span&gt; &lt;span style="color:#a9a9a9;"&gt;*&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$this&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;.&lt;/span&gt;&lt;span style="color:#000000;"&gt;MyField&lt;/span&gt; &lt;span style="color:#000000;"&gt;}&lt;/span&gt; &lt;span style="color:#000080;"&gt;-PassThru&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt; &lt;span style="color:#ff4500;"&gt;$object&lt;/span&gt;&lt;span style="color:#a9a9a9;"&gt;.&lt;/span&gt;&lt;span style="color:#000000;"&gt;xTimesMyField&lt;/span&gt;&lt;span style="color:#000000;"&gt;(&lt;/span&gt;&lt;span style="color:#800080;"&gt;10&lt;/span&gt;&lt;span style="color:#000000;"&gt;)&lt;/span&gt; &lt;/pre&gt; &lt;p&gt;Hope this Helps &lt;/p&gt; &lt;p&gt;James Brundage [MSFT] &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9470009" width="1" height="1"&gt;</description><pubDate>Wed, 11 Mar 2009 02:43:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470009</guid><author>PowerShellTeam</author><source url="http://pipes.yahoo.com/pipes/pipe.run?_id=uAmYy9xq3BGHcV361fC6Jw&amp;_render=rss">PowerShell Bloggers</source><ng:postId>7272372115</ng:postId><ng:feedId>1735180</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Custom PowerShell Cmdlets</title><link>http://blogs.claritycon.com/blogs/abhang_rane/archive/2007/11/11/3464.aspx</link><description /><pubDate>Sun, 08 Mar 2009 04:05:30 GMT</pubDate><guid isPermaLink="false" /><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>3970894799</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Explore Your [Environment]</title><link>http://blogs.msdn.com/powershell/archive/2008/12/13/explore-your-environment.aspx</link><description>&lt;p&gt;This topic is a little long but I strongly encourage you to walk through it and master the techniques it illustrates.&amp;#160; I can assure you that you'll will use them a couple thousand times in the next couple of years.&lt;/p&gt; &lt;p&gt;.Net provides a wonderful class called System.Environment that tells you all about your environment.&amp;#160; It is well worth taking a few minutes to stop what you are doing and explore this class so that you understand its capabilities.&amp;#160; That way when a relevant issue comes up, you'll know that there is very simple way to get the answer.&amp;#160; &lt;/p&gt; &lt;p&gt;First thing to remember is that they way you specify a type in PowerShell is with square brackets:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; [System.Environment]&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;IsPublic IsSerial Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BaseType &lt;br /&gt;-------- -------- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- &lt;br /&gt;True&amp;#160;&amp;#160;&amp;#160;&amp;#160; False&amp;#160;&amp;#160;&amp;#160; Environment&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Object&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;The next thing to remember is that PowerShell allows you to drop the "SYSTEM" from types:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[System.Diagnostics.Process]&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;IsPublic IsSerial Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BaseType &lt;br /&gt;-------- -------- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- &lt;br /&gt;True&amp;#160;&amp;#160;&amp;#160;&amp;#160; False&amp;#160;&amp;#160;&amp;#160; Process&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.ComponentModel.Component &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; [Diagnostics.Process]&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;IsPublic IsSerial Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BaseType &lt;br /&gt;-------- -------- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- &lt;br /&gt;True&amp;#160;&amp;#160;&amp;#160;&amp;#160; False&amp;#160;&amp;#160;&amp;#160; Process&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.ComponentModel.Component &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; [Environment]&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;IsPublic IsSerial Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BaseType &lt;br /&gt;-------- -------- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- &lt;br /&gt;True&amp;#160;&amp;#160;&amp;#160;&amp;#160; False&amp;#160;&amp;#160;&amp;#160; Environment&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Object&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;The next thing to remember is that types can have STATIC properties and methods.&amp;#160; What are a "static properties and methods"?&amp;#160; Most properties are methods that you deal with are OBJECT properties and methods which is to say that they are the "properties of THAT object" or the "methods that can be invoked on THAT object".&amp;#160; Static properties and methods do not require an object to be invoked.&amp;#160; There are lots of reasons why programmers use statics but the thing you need to know is that it is well worth exploring static properties and methods because they often contain gems of functionality.&amp;#160; Not all types have statics in fact most don't but those that do are often super useful so it is worth the explore. &lt;/p&gt; &lt;p&gt;So how do you explore?&amp;#160; Well with PowerShell of course.&amp;#160; Remember that PowerShell is designed to allow you to explore the system.&amp;#160; We want to to cultivate a strong sense of curiosity about your system and want to make it easy and safe (where possible) for you to go splunking around.&amp;#160; So the tool to explore Statics is Get-Member.&amp;#160;&amp;#160; Here is what you need to know:&lt;/p&gt; &lt;p&gt;1) Get-Member has a -STATIC parameter. &lt;br /&gt;2) You can pipe INSTANCES or TYPES to get-member &lt;br /&gt;3) "Get-Member -Static" can be invoked as "gm -s"&lt;/p&gt; &lt;p&gt;Let's explore:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; Get-Date |Get-Member -Static&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160; TypeName: System.DateTime &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MemberType Definition &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ---------- ---------- &lt;br /&gt;Compare&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int Compare(System.DateTime t1, System.DateTime t2) &lt;br /&gt;DaysInMonth&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int DaysInMonth(int year, int month) &lt;br /&gt;Equals&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq &lt;br /&gt;FromBinary&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromBinary(long dateData) &lt;br /&gt;FromFileTime&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTime(long fileTime) &lt;br /&gt;FromFileTimeUtc Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTimeUtc(long fileTime) &lt;br /&gt;FromOADate&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromOADate(double d) &lt;br /&gt;IsLeapYear&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool IsLeapYear(int year) &lt;br /&gt;Parse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin &lt;br /&gt;ParseExact&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime ParseExact(string s, string format, System.IFormatP &lt;br /&gt;ReferenceEquals Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool ReferenceEquals(System.Object objA, System.Object objB) &lt;br /&gt;SpecifyKind&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK &lt;br /&gt;TryParse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParse(string s, System.DateTime&amp;amp;, mscorlib, Version=2.0.0.0 &lt;br /&gt;TryParseExact&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParseExact(string s, string format, System.IFormatProvider &lt;br /&gt;MaxValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MaxValue {get;} &lt;br /&gt;MinValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MinValue {get;} &lt;br /&gt;Now&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Now {get;} &lt;br /&gt;Today&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Today {get;} &lt;br /&gt;UtcNow&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime UtcNow {get;} &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;Get-Date |gm -s&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160; TypeName: System.DateTime &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MemberType Definition &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ---------- ---------- &lt;br /&gt;Compare&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int Compare(System.DateTime t1, System.DateTime t2) &lt;br /&gt;DaysInMonth&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int DaysInMonth(int year, int month) &lt;br /&gt;Equals&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq &lt;br /&gt;FromBinary&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromBinary(long dateData) &lt;br /&gt;FromFileTime&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTime(long fileTime) &lt;br /&gt;FromFileTimeUtc Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTimeUtc(long fileTime) &lt;br /&gt;FromOADate&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromOADate(double d) &lt;br /&gt;IsLeapYear&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool IsLeapYear(int year) &lt;br /&gt;Parse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin &lt;br /&gt;ParseExact&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime ParseExact(string s, string format, System.IFormatP &lt;br /&gt;ReferenceEquals Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool ReferenceEquals(System.Object objA, System.Object objB) &lt;br /&gt;SpecifyKind&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK &lt;br /&gt;TryParse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParse(string s, System.DateTime&amp;amp;, mscorlib, Version=2.0.0.0 &lt;br /&gt;TryParseExact&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParseExact(string s, string format, System.IFormatProvider &lt;br /&gt;MaxValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MaxValue {get;} &lt;br /&gt;MinValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MinValue {get;} &lt;br /&gt;Now&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Now {get;} &lt;br /&gt;Today&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Today {get;} &lt;br /&gt;UtcNow&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime UtcNow {get;} &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[DateTime] |gm -s&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160; TypeName: System.DateTime &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MemberType Definition &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ---------- ---------- &lt;br /&gt;Compare&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int Compare(System.DateTime t1, System.DateTime t2) &lt;br /&gt;DaysInMonth&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static int DaysInMonth(int year, int month) &lt;br /&gt;Equals&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq &lt;br /&gt;FromBinary&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromBinary(long dateData) &lt;br /&gt;FromFileTime&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTime(long fileTime) &lt;br /&gt;FromFileTimeUtc Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromFileTimeUtc(long fileTime) &lt;br /&gt;FromOADate&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime FromOADate(double d) &lt;br /&gt;IsLeapYear&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool IsLeapYear(int year) &lt;br /&gt;Parse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin &lt;br /&gt;ParseExact&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime ParseExact(string s, string format, System.IFormatP &lt;br /&gt;ReferenceEquals Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool ReferenceEquals(System.Object objA, System.Object objB) &lt;br /&gt;SpecifyKind&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK &lt;br /&gt;TryParse&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParse(string s, System.DateTime&amp;amp;, mscorlib, Version=2.0.0.0 &lt;br /&gt;TryParseExact&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool TryParseExact(string s, string format, System.IFormatProvider &lt;br /&gt;MaxValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MaxValue {get;} &lt;br /&gt;MinValue&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.DateTime MinValue {get;} &lt;br /&gt;Now&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Now {get;} &lt;br /&gt;Today&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime Today {get;} &lt;br /&gt;UtcNow&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; System.DateTime UtcNow {get;}&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;Now lets explore&amp;#160; how you access these.&amp;#160; You use "::" on types to invoke statics:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[Datetime]::Today&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Saturday, December 13, 2008 12:00:00 AM &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[Datetime]::IsLeapYear(2008)&lt;/strong&gt; &lt;br /&gt;True&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;So with that background, let's explore some of SYSTEM.ENVIRONMENT properties:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; [Environment] |gm -s&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160; TypeName: System.Environment &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MemberType Definition &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ---------- ---------- &lt;br /&gt;Equals&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool Equals(System.Object o... &lt;br /&gt;Exit&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.Void Exit(int exitCode) &lt;br /&gt;ExpandEnvironmentVariables Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static string ExpandEnvironmentVar... &lt;br /&gt;FailFast&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.Void FailFast(string... &lt;br /&gt;GetCommandLineArgs&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.String[] GetCommandL... &lt;br /&gt;GetEnvironmentVariable&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static string GetEnvironmentVariab... &lt;br /&gt;GetEnvironmentVariables&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.Collections.IDiction... &lt;br /&gt;GetFolderPath&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static string GetFolderPath(System... &lt;br /&gt;GetLogicalDrives&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.String[] GetLogicalD... &lt;br /&gt;ReferenceEquals&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static bool ReferenceEquals(System... &lt;br /&gt;SetEnvironmentVariable&amp;#160;&amp;#160;&amp;#160;&amp;#160; Method&amp;#160;&amp;#160;&amp;#160;&amp;#160; static System.Void SetEnvironmentV... &lt;br /&gt;CommandLine&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String CommandLine {... &lt;br /&gt;CurrentDirectory&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String CurrentDirect... &lt;br /&gt;ExitCode&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Int32 ExitCode {get;... &lt;br /&gt;HasShutdownStarted&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Boolean HasShutdownS... &lt;br /&gt;MachineName&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String MachineName {... &lt;br /&gt;NewLine&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String NewLine {get;} &lt;br /&gt;OSVersion&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.OperatingSystem OSVe... &lt;br /&gt;ProcessorCount&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Int32 ProcessorCount... &lt;br /&gt;StackTrace&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String StackTrace {g... &lt;br /&gt;SystemDirectory&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String SystemDirecto... &lt;br /&gt;TickCount&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Int32 TickCount {get;} &lt;br /&gt;UserDomainName&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String UserDomainNam... &lt;br /&gt;UserInteractive&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Boolean UserInteract... &lt;br /&gt;UserName&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.String UserName {get;} &lt;br /&gt;Version&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Version Version {get;} &lt;br /&gt;WorkingSet&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Property&amp;#160;&amp;#160; static System.Int64 WorkingSet {get;} &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[Environment]::MachineName &lt;br /&gt;&lt;/strong&gt;JPSW7-5 &lt;br /&gt;PS&lt;strong&gt;&amp;gt; [Environment]::OSVersion&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Platform ServicePack&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Version&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VersionString &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- -----------&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ------------- &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Win32NT&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6.1.7004.0&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Microsoft Windo... &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[Environment]::ProcessorCount&lt;/strong&gt; &lt;br /&gt;2 &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::UserInteractive&lt;/strong&gt; &lt;br /&gt;True &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::UserDomainName&lt;/strong&gt; &lt;br /&gt;NTDEV &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::UserName &lt;br /&gt;&lt;/strong&gt;jsnover &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::SystemDirectory&lt;/strong&gt; &lt;br /&gt;C:&amp;#92;Windows&amp;#92;system32 &lt;br /&gt;PS&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;Now let's explore some methods:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;strong&gt; [Environment]::GetLogicalDrives() &lt;br /&gt;&lt;/strong&gt;C:&amp;#92; &lt;br /&gt;D:&amp;#92; &lt;br /&gt;E:&amp;#92; &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::GetEnvironmentVariable("PATH")&lt;/strong&gt; &lt;br /&gt;%SystemRoot%&amp;#92;system32&amp;#92;WindowsPowerShell&amp;#92;v1.0&amp;#92;;C:&amp;#92;Windows&amp;#92;system32;C:&amp;#92;Window &lt;br /&gt;s;C:&amp;#92;Windows&amp;#92;System32&amp;#92;Wbem;C:&amp;#92;Windows&amp;#92;System32&amp;#92;WindowsPowerShell&amp;#92;v1.0&amp;#92;;C:&amp;#92;P &lt;br /&gt;rogram Files&amp;#92;WTT 2.2&amp;#92;Client&amp;#92;;C:&amp;#92;PROGRA~1&amp;#92;CA&amp;#92;SHARED~1&amp;#92;SCANEN~1;C:&amp;#92;Program Fi &lt;br /&gt;les&amp;#92;CA&amp;#92;eTrust Antivirus;c:&amp;#92;ps &lt;br /&gt;PS&amp;gt; &lt;strong&gt;[Environment]::GetFolderPath()&lt;/strong&gt; &lt;br /&gt;&lt;font color="#ff0000"&gt;Cannot find an overload for "GetFolderPath" and the argument count: "0". &lt;br /&gt;At line:1 char:29 &lt;br /&gt;+ [Environment]::GetFolderPath &amp;lt;&amp;lt;&amp;lt;&amp;lt; () &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : NotSpecified: (:) [], MethodException &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : MethodCountCouldNotFindBest&lt;/font&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;Notice the error I got for GetFolderPath() - it's complaining about the number of arguments it got.&amp;#160; So now let's learn the technique to discover method signatures.&amp;#160; If you specify a method and use "()", it invokes the method. If you don't provide the "()" and just specify the name, it give you information about the method:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[Environment]::GetFolderPath&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;MemberType&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : Method &lt;br /&gt;OverloadDefinitions :&lt;font color="#ff0000"&gt; {static string GetFolderPath(System.Environment+Speci &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; alFolder folder)} &lt;br /&gt;&lt;/font&gt;TypeNameOfValue&amp;#160;&amp;#160;&amp;#160;&amp;#160; : System.Management.Automation.PSMethod &lt;br /&gt;Value&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : static string GetFolderPath(System.Environment+Specia &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; lFolder folder) &lt;br /&gt;Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : GetFolderPath &lt;br /&gt;IsInstance&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : True&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;This tells you that the method takes one argument whose name is "folder" and whose type is System.Environment+SpecialFolder.&amp;#160; What the heck is that?&amp;#160; &lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;PS&amp;gt; &lt;strong&gt;[System.Environment+SpecialFolder]&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="Consolas"&gt;IsPublic IsSerial Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; BaseType &lt;br /&gt;-------- -------- ----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -------- &lt;br /&gt;False&amp;#160;&amp;#160;&amp;#160; True&amp;#160;&amp;#160;&amp;#160;&amp;#160; SpecialFolder&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color="#ff0000"&gt;System.Enum&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;Notice that it is an ENUM.&amp;#160; The great things about ENUMS is that when you specify an invalid value - it tells you what the valid values are:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font face="Consolas"&gt;PS&amp;gt; &lt;/font&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;[Environment]::GetFolderPath("burp") &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font color="#ff0000" face="Consolas"&gt;Cannot convert argument "0", with value: "burp", for "GetFolderPath" to typ &lt;br /&gt;e "System.Environment+SpecialFolder": "Cannot convert value "burp" to type &lt;br /&gt;"System.Environment+SpecialFolder" due to invalid enumeration values. Speci &lt;br /&gt;fy one of the following enumeration values and try again. The possible enum &lt;br /&gt;eration values are&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;&lt;em&gt;&lt;font size="3"&gt;&lt;u&gt; &lt;/u&gt;"Desktop, Programs, Personal, MyDocuments, Favorites, St &lt;br /&gt;artup, Recent, SendTo, StartMenu, MyMusic, DesktopDirectory, MyComputer, Te &lt;br /&gt;mplates, ApplicationData, LocalApplicationData, InternetCache, Cookies, His &lt;br /&gt;tory, CommonApplicationData, System, ProgramFiles, MyPictures, CommonProgra &lt;br /&gt;mFiles"."&lt;/font&gt;&lt;/em&gt;&lt;/strong&gt; &lt;br /&gt;At line:1 char:29 &lt;br /&gt;+ [Environment]::GetFolderPath &amp;lt;&amp;lt;&amp;lt;&amp;lt; ("burp") &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : NotSpecified: (:) [], MethodException &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;So let's try some of those values:&lt;/p&gt; &lt;p&gt;&lt;font color="#0000ff" size="2" face="con"&gt;PS&amp;gt;&lt;strong&gt; [Environment]::GetFolderPath("cookies")&lt;/strong&gt; &lt;br /&gt;C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;COOKIES &lt;br /&gt;PS&amp;GT; &lt;strong&gt;[ENVIRONMENT]::GETFOLDERPATH(&amp;QUOT;MYPICTURES&amp;QUOT;)&lt;/strong&gt; &lt;br /&gt;C:SERS&amp;#92;JSNOVER&amp;#92;PICTURES&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;BUT WAIT - IT'S GETS EVEN BETTER!&amp;#160; &lt;/p&gt; &lt;p&gt;NOW LET'S PULL IT ALL TOGETHER BY REALIZING THAT ENUM IS A TYPE AND THAT IT HAS STATICS AS WELL USE THAT TO FIND ALL THE FOLDERPATHS:&lt;/p&gt; &lt;p&gt;&lt;font COLOR="#0000FF" SIZE="2" FACE="CONSOLAS"&gt;PS&amp;GT;&lt;strong&gt; [ENUM] |GM -S&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font COLOR="#0000FF" SIZE="2" FACE="CONSOLAS"&gt;&amp;#160;&amp;#160; TYPENAME: SYSTEM.ENUM &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font COLOR="#0000FF" SIZE="2" FACE="CONSOLAS"&gt;NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; MEMBERTYPE DEFINITION &lt;br /&gt;----&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ---------- ---------- &lt;br /&gt;EQUALS&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC BOOL EQUALS(SYSTEM.OBJECT OBJA, SYST... &lt;br /&gt;FORMAT&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC STRING FORMAT(TYPE ENUMTYPE, SYSTEM.... &lt;br /&gt;GETNAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC STRING GETNAME(TYPE ENUMTYPE, SYSTEM... &lt;br /&gt;GETNAMES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC SYSTEM.STRING[] GETNAMES(TYPE ENUMTYPE) &lt;br /&gt;GETUNDERLYINGTYPE METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC TYPE GETUNDERLYINGTYPE(TYPE ENUMTYPE) &lt;br /&gt;GETVALUES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC ARRAY GETVALUES(TYPE ENUMTYPE) &lt;br /&gt;ISDEFINED&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC BOOL ISDEFINED(TYPE ENUMTYPE, SYSTEM... &lt;br /&gt;PARSE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC SYSTEM.OBJECT PARSE(TYPE ENUMTYPE, S... &lt;br /&gt;REFERENCEEQUALS&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC BOOL REFERENCEEQUALS(SYSTEM.OBJECT O... &lt;br /&gt;TOOBJECT&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; METHOD&amp;#160;&amp;#160;&amp;#160;&amp;#160; STATIC SYSTEM.OBJECT TOOBJECT(TYPE ENUMTYPE... &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font COLOR="#0000FF" SIZE="2" FACE="CONSOLAS"&gt;PS&amp;GT; &lt;strong&gt;[ENUM]::GETVALUES([SYSTEM.ENVIRONMENT+SPECIALFOLDER]) &lt;br /&gt;&lt;/strong&gt;DESKTOP &lt;br /&gt;PROGRAMS &lt;br /&gt;PERSONAL &lt;br /&gt;PERSONAL &lt;br /&gt;FAVORITES &lt;br /&gt;STARTUP &lt;br /&gt;RECENT &lt;br /&gt;SENDTO &lt;br /&gt;STARTMENU &lt;br /&gt;MYMUSIC &lt;br /&gt;DESKTOPDIRECTORY &lt;br /&gt;MYCOMPUTER &lt;br /&gt;TEMPLATES &lt;br /&gt;APPLICATIONDATA &lt;br /&gt;LOCALAPPLICATIONDATA &lt;br /&gt;INTERNETCACHE &lt;br /&gt;COOKIES &lt;br /&gt;HISTORY &lt;br /&gt;COMMONAPPLICATIONDATA &lt;br /&gt;SYSTEM &lt;br /&gt;PROGRAMFILES &lt;br /&gt;MYPICTURES &lt;br /&gt;COMMONPROGRAMFILES &lt;br /&gt; &lt;br /&gt;PS&amp;GT; &lt;strong&gt;FOREACH ($F IN [ENUM]::GETVALUES([SYSTEM.ENVIRONMENT+SPECIALFOLDER])) { &lt;br /&gt;&amp;GT;&amp;GT; &amp;QUOT;{0,-20} - {1}&amp;QUOT; -F $F, [ENVIRONMENT]::GETFOLDERPATH($F) } &lt;br /&gt;&lt;/strong&gt;&amp;GT;&amp;GT; &lt;br /&gt;DESKTOP&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;DESKTOP &lt;br /&gt;PROGRAMS&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;S &lt;br /&gt;TART MENU&amp;#92;PROGRAMS &lt;br /&gt;PERSONAL&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;DOCUMENTS &lt;br /&gt;PERSONAL&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;DOCUMENTS &lt;br /&gt;FAVORITES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;FAVORITES &lt;br /&gt;STARTUP&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;S &lt;br /&gt;TART MENU&amp;#92;PROGRAMS&amp;#92;STARTUP &lt;br /&gt;RECENT&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;R &lt;br /&gt;ECENT &lt;br /&gt;SENDTO&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;S &lt;br /&gt;ENDTO &lt;br /&gt;STARTMENU&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;S &lt;br /&gt;TART MENU &lt;br /&gt;MYMUSIC&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;MUSIC &lt;br /&gt;DESKTOPDIRECTORY&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;DESKTOP &lt;br /&gt;MYCOMPUTER&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - &lt;br /&gt;TEMPLATES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;T &lt;br /&gt;EMPLATES &lt;br /&gt;APPLICATIONDATA&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING &lt;br /&gt;LOCALAPPLICATIONDATA - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATAOCAL &lt;br /&gt;INTERNETCACHE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATAOCAL&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;TEM &lt;br /&gt;PORARY INTERNET FILES &lt;br /&gt;COOKIES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATA&amp;#92;ROAMING&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;C &lt;br /&gt;OOKIES &lt;br /&gt;HISTORY&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;APPDATAOCAL&amp;#92;MICROSOFT&amp;#92;WINDOWS&amp;#92;HIS &lt;br /&gt;TORY &lt;br /&gt;COMMONAPPLICATIONDATA - C:&amp;#92;PROGRAMDATA &lt;br /&gt;SYSTEM&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:&amp;#92;WINDOWS&amp;#92;SYSTEM32 &lt;br /&gt;PROGRAMFILES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:&amp;#92;PROGRAM FILES &lt;br /&gt;MYPICTURES&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; - C:SERS&amp;#92;JSNOVER&amp;#92;PICTURES &lt;br /&gt;COMMONPROGRAMFILES&amp;#160;&amp;#160; - C:&amp;#92;PROGRAM FILES&amp;#92;COMMON FILES&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;IS THAT COOL OR WHAT?&lt;/p&gt; &lt;p&gt;ENJOY!&lt;/p&gt; &lt;p&gt;&amp;#160;&lt;/p&gt; &lt;p&gt;JEFFREY SNOVER [MSFT] &lt;br /&gt;WINDOWS MANAGEMENT PARTNER ARCHITECT &lt;br /&gt;VISIT THE WINDOWS POWERSHELL TEAM BLOG AT:&amp;#160;&amp;#160;&amp;#160; &lt;a rel="nofollow" target="_blank" HREF="HTTP://BLOGS.MSDN.COM/POWERSHELL"&gt;HTTP://BLOGS.MSDN.COM/POWERSHELL&lt;/a&gt; &lt;br /&gt;VISIT THE WINDOWS POWERSHELL SCRIPTCENTER AT:&amp;#160; &lt;a rel="nofollow" target="_blank" HREF="HTTP://WWW.MICROSOFT.COM/TECHNET/SCRIPTCENTER/HUBS/MSH.MSPX"&gt;HTTP://WWW.MICROSOFT.COM/TECHNET/SCRIPTCENTER/HUBS/MSH.MSPX&lt;/a&gt;&lt;/p&gt;&lt;img SRC="HTTP://BLOGS.MSDN.COM/AGGBUG.ASPX?POSTID=9212240" WIDTH="1" HEIGHT="1"&gt;</description><pubDate>Sat, 13 Dec 2008 23:37:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9212240</guid><author>PowerShellTeam</author><source url="http://pipes.yahoo.com/pipes/pipe.run?_id=uAmYy9xq3BGHcV361fC6Jw&amp;_render=rss">PowerShell Bloggers</source><ng:postId>6609267749</ng:postId><ng:feedId>1735180</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>PowerShell ATE</title><link>http://RichardSiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!1855.entry</link><description>&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;First session on Ask the Experts this morning and what fascinated me was the number of people asking "what is PowerShell and what can I do with it?" Two years since version 1 shipped and the amount that has been written about PowerShell and this came as a bit of a surprise. So to answer the question:&lt;/font&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;PowerShell is Microsoft's automation engine. It is part of the Common Engineering Criteria which means that it will be built into all major Microsoft products. It is already in Exchange 2007, SQL Server 2008, Windows 2008 and large parts of the System Center family. Recent announcements regarding the new functionality in Windows 2008 R2 raise PowerShell's profile to a whole new level. It is installed and on by default in Windows 7&amp;#92;2008 R2 (except server core where it is optional)&lt;/font&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;PowerShell is usually exposed as a command shell and scripting language though it can be incorporated into applications.&lt;/font&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;PowerShell provides a method of increasing administrator productivity that hasn't existed before in the Windows environment. If you want to be regarded as a top techie in the Windows world - learn PowerShell. &lt;/font&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;To misquote. The future's here. The future's PowerShell.&lt;/font&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;&lt;/font&gt; &lt;span&gt; &lt;table cellspacing="1" cellpadding="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Share this post : &lt;td&gt;&lt;a rel="nofollow" title="post it to backflip" target="_blank" href="http://www.backflip.com/add_page_pop.ihtml?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/backflip4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to blinkbits!" target="_blank" href="http://www.blinkbits.com/bookmarklets/save.php?v=1&amp;amp;source_url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blinkbit4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to blogmemes" target="_blank" href="http://www.blogmemes.net/post.php?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/blogmemes4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to buddymark" target="_blank" href="http://buddymarks.com/s_add_bookmark.php?bookmark_url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;bookmark_title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/buddymar4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to complore" target="_blank" href="http://complore.com/?q=node/add/flexinode-5&amp;amp;url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/complore4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to del.icio.us" target="_blank" href="http://del.icio.us/post?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to del.iri.ous!" target="_blank" href="http://de.lirio.us/bookmarks/sbmtool?action=add&amp;amp;address=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliriou4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to digg" target="_blank" href="http://digg.com/submit?phase=2&amp;amp;url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to dotnetkicks" target="_blank" href="http://www.dotnetkicks.com/kick/?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to furl" target="_blank" href="http://www.furl.net/store?s=f&amp;amp;to=0&amp;amp;u=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;ti=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/furl4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to live" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;mkt=en-us&amp;amp;url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/live4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to magnolia!" target="_blank" href="http://ma.gnolia.com/bookmarklet/add?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/magnolia4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to netvouz!" target="_blank" href="http://netvouz.com/action/submitBookmark?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/netvouz4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to reddit!" target="_blank" href="http://reddit.com/submit?url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to shadow" target="_blank" href="http://www.shadows.com/bookmark/saveLink.rails?page=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/shadows6.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to spurl" target="_blank" href="http://www.spurl.net/spurl.php?v=3&amp;amp;url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/spurl8.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to technorati!" target="_blank" href="http://technorati.com/faves/?add=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/technora4.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to wists" target="_blank" href="http://www.wists.com/?action=add&amp;amp;url=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;title=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/wists9.png"&gt;&lt;/a&gt; &lt;td&gt;&lt;a rel="nofollow" title="post it to yahoo!" target="_blank" href="http://myweb.yahoo.com/myresults/bookmarklet?u=http://richardsiddaway.spaces.live.com/blog/cns!43CFA46A74CF3E96!1855.entry&amp;amp;t=PowerShell%20ATE"&gt;&lt;img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/yahoo9.png"&gt;&lt;/a&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;&lt;/font&gt; &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;padding-top:0px;"&gt;Technorati Tags: &lt;a rel="nofollow" target="_blank" href="http://technorati.com/tags/Powershell"&gt;Powershell&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;&lt;/font&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=4886304897853505174&amp;page=RSS%3a+PowerShell+ATE&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=richardsiddaway.spaces.live.com&amp;amp;GT1=RichardSiddaway"&gt;</description><pubDate>Tue, 04 Nov 2008 22:55:23 GMT</pubDate><guid isPermaLink="false">http://RichardSiddaway.spaces.live.com/Blog/cns!43CFA46A74CF3E96!1855.entry</guid><source url="http://pipes.yahoo.com/pipes/pipe.run?_id=uAmYy9xq3BGHcV361fC6Jw&amp;_render=rss">PowerShell Bloggers</source><ng:postId>6297232815</ng:postId><ng:feedId>1735180</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>PowerShell, WMI and formatting</title><link>http://blogs.technet.com/jamesone/archive/2008/10/21/powershell-wmi-and-formatting.aspx</link><description>&lt;P&gt;I’ve been doing a ton of PowerShell recently, in which is part of the reason why the number of blog posts I’ve made has been down. One of the jobs has been to go back to some of the code I wrote a while back and examine how I handle WMI objects. At the time I wrote my contribution to the OCS resource kit last year I was pretty new to PowerShell and I wish I knew what I know now before I started. &lt;/P&gt;
&lt;P&gt;Actually where I started with OCS and PowerShell was looking at someone else’s code where they had for loop with a bunch of write-host statements to output WMI objects to the screen. I said “don’t be daft, use | &lt;EM&gt;format-table&lt;/EM&gt;” and the next thing I knew I was being asked to bring my obvious expertise to bear on the project (A Polite form of “if you’re so clever you do it then” ). So I started with a Bunch of &lt;EM&gt;get-thing&lt;/EM&gt; functions. These would be in the form &lt;EM&gt;Get-WMIObject –Class Thing | format table. &lt;/EM&gt;I quickly realised that wasn’t right because once it is formatted as a table you can’t use the object. So for every class of “thing” I made the get-thing function&amp;nbsp; return the WMI object(s) and had a list-thing function. One of the testers didn’t like the unformatted WMI objects if he used get- instread of list and I told him that was just how things had to be.&lt;/P&gt;
&lt;P&gt;Lets move forward to recent history. I was looking at the Get-process function in PowerShell, when you run it it looks like this.&lt;/P&gt;&lt;PRE&gt;PS C:\Users\jamesone\Documents\windowsPowershell&amp;gt; get-process -Name winword &lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Handles&amp;nbsp; NPM(K)&amp;nbsp;&amp;nbsp;&amp;nbsp; PM(K)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WS(K) VM(M)&amp;nbsp;&amp;nbsp; CPU(s)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Id ProcessName  &lt;BR&gt;-------&amp;nbsp; ------&amp;nbsp;&amp;nbsp;&amp;nbsp; -----&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----- -----&amp;nbsp;&amp;nbsp; ------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- -----------  &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 931&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 123&amp;nbsp;&amp;nbsp;&amp;nbsp; 85380&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 149360&amp;nbsp;&amp;nbsp; 506 ...86.16&amp;nbsp;&amp;nbsp;&amp;nbsp; 264 WINWORD&lt;/P&gt;&lt;/PRE&gt;
&lt;P&gt;Only one thing wrong with that – if you send it to get-member you see it is a “System.Diagnostics.Process” object but those properties “NPM(K)” and the rest the don’t exist. Curious. &lt;A href="http://blogs.technet.com/jamesone/archive/2007/08/03/a-vb-class-for-exif-picture-properties-and-using-it-from-powershell.aspx" mce_href="http://blogs.technet.com/jamesone/archive/2007/08/03/a-vb-class-for-exif-picture-properties-and-using-it-from-powershell.aspx"&gt;I already knew&lt;/A&gt; PowerShell has some XML files which let me spot-weld properties onto objects, so I went for a little search using my favourite function Select-String. &lt;/P&gt;&lt;PRE&gt;PS C:\Users\jamesone\Documents\windowsPowershell&amp;gt; cd $pshome
&lt;BR&gt;PS C:\Windows\System32\WindowsPowerShell\v1.0&amp;gt; select-string -path *.ps1xml -simplematch "System.Diagnostics.Process" 
&lt;P&gt;DotNetTypes.format.ps1xml:370:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Diagnostics.ProcessModule&amp;lt;/TypeName&amp;gt; &lt;BR&gt;DotNetTypes.format.ps1xml:404:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Diagnostics.Process&amp;lt;/TypeName&amp;gt;&lt;BR&gt;DotNetTypes.format.ps1xml:405:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;Deserialized.System.Diagnostics.Process&amp;lt;/TypeName&amp;gt;
&lt;BR&gt;DotNetTypes.format.ps1xml:551:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Diagnostics.Process&amp;lt;/TypeName&amp;gt;
&lt;BR&gt;DotNetTypes.format.ps1xml:598:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Diagnostics.Process&amp;lt;/TypeName&amp;gt;
&lt;BR&gt;DotNetTypes.format.ps1xml:1090:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Diagnostics.Process&amp;lt;/TypeName&amp;gt;
&lt;BR&gt;types.ps1xml:133:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Name&amp;gt;System.Diagnostics.ProcessModule&amp;lt;/Name&amp;gt;
&lt;BR&gt;types.ps1xml:327:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Name&amp;gt;System.Diagnostics.Process&amp;lt;/Name&amp;gt;
&lt;BR&gt;types.ps1xml:430:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Name&amp;gt;Deserialized.System.Diagnostics.Process&amp;lt;/Name&amp;gt;&lt;/P&gt;&lt;/PRE&gt;
&lt;P&gt;The files themselves are signed so they shouldn’t be changed, but you can look at them. &lt;/P&gt;
&lt;P&gt;In Types.Ps1XML there is a section starting at line 327 which defines the “spot-welded” properties. Have a look at a process in you’ll see alias properties like “NPM” which aren’t part of the definition of the .NET object, that’s where &lt;EM&gt;they&lt;/EM&gt; come from. &lt;/P&gt;
&lt;P&gt;In DotNetTypes.format.ps1xml there is a section which describes how the object should be formatted, table or list, column widths and headings, and properties or code blocks. &lt;A href="http://msdn.microsoft.com/en-us/library/cc136137(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc136137(VS.85).aspx"&gt;It’s all written up on MSDN&lt;/A&gt;. So I could use this as the basis for my own XML file: load that using Update-FormatData and… job done.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The gist of the XML file is it looks like this&lt;/P&gt;&lt;PRE&gt;&amp;lt;Configuration&amp;gt;
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ViewDefinitions&amp;gt;  &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ViewDefinitions&amp;gt;  &lt;BR&gt;&amp;lt;/Configuration&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Inside viewDefinitions there are one or more &amp;lt;view&amp;gt; objects. Which look like this, the key piece is the name of the type, as you can see this one is for a virtual machine in Hyper-V, and this one is formatted using a table. &lt;/P&gt;&lt;PRE&gt;  &amp;lt;View&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Name&amp;gt;Msvm_ComputerSystem&amp;lt;/Name&amp;gt;
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ViewSelectedBy&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TypeName&amp;gt;System.Management.ManagementObject#root\Virtualization\Msvm_ComputerSystem&amp;lt;/TypeName&amp;gt;
    &amp;lt;/ViewSelectedBy&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TableControl&amp;gt;
       &amp;lt;TableHeaders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TableHeaders&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TableRowEntries&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TableRowEntry&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TableRowEntry&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TableRowEntries&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/TableControl&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/View&amp;gt;&lt;/PRE&gt;The Table headers section contains one entry for each column &lt;PRE&gt;  &amp;lt;TableColumnHeader&amp;gt;
    &amp;lt;Label&amp;gt;Up-Time (mS)&amp;lt;/Label&amp;gt;
    &amp;lt;Width&amp;gt;12&amp;lt;/Width&amp;gt;
    &amp;lt;Alignment&amp;gt;left&amp;lt;/Alignment&amp;gt;
  &amp;lt;/TableColumnHeader&amp;gt;&lt;/PRE&gt;
&lt;P&gt;And the TableRowEntry section contains a corresponding entry &lt;/P&gt;&lt;PRE&gt;  &amp;lt;TableColumnItem&amp;gt;
    &amp;lt;PropertyName&amp;gt;OnTimeInMilliseconds&amp;lt;/PropertyName&amp;gt;
  &amp;lt;/TableColumnItem&amp;gt; &lt;/PRE&gt;&lt;BR&gt;If I wanted to have the time in seconds here I could use a script block instead of a property name &lt;PRE&gt;  &amp;lt;TableColumnItem&amp;gt; &lt;BR&gt;    &amp;lt;ScriptBlock&amp;gt;$_.OnTimeInMilliseconds / 1000&amp;lt;ScriptBlock&amp;gt; 
  &amp;lt;/TableColumnItem&amp;gt; &lt;/PRE&gt;
&lt;P&gt;I’m not going pretend that putting the XML together is as quick as writing a list function – but it definitely seems worth it.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Technorati Tags: &lt;A href="http://technorati.com/tags/Microsoft" rel=tag mce_href="http://technorati.com/tags/Microsoft"&gt;Microsoft&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Windows" rel=tag mce_href="http://technorati.com/tags/Windows"&gt;Windows&lt;/A&gt;,&lt;A href="http://technorati.com/tags/PowerShell" rel=tag mce_href="http://technorati.com/tags/PowerShell"&gt;PowerShell&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Formatting" rel=tag mce_href="http://technorati.com/tags/Formatting"&gt;Formatting&lt;/A&gt;,&lt;A href="http://technorati.com/tags/XML" rel=tag mce_href="http://technorati.com/tags/XML"&gt;XML&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3139717" width="1" height="1"&gt;</description><pubDate>Tue, 21 Oct 2008 12:25:00 GMT</pubDate><guid isPermaLink="false">http://blogs.technet.com/jamesone/archive/2008/10/21/powershell-wmi-and-formatting.aspx</guid><author>jamesone</author><source url="http://blogs.technet.com/jamesone/atom.xml">James O'Neill's blog </source><ng:postId>6176051038</ng:postId><ng:feedId>665565</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Some advice on creating Powershell scripts</title><link>http://www.peetersonline.nl/index.php/powershell/some-advice-on-creating-powershell-scripts/</link><description>&lt;p&gt;Creating a Powershell script CAN be quite difficult. How to get the output you want? Where to start? Let me try to get you started by providing a structure you can follow. I&amp;#8217;m not saying this is THE way, but it&amp;#8217;s MY way. Hope it helps you and please do comment if you have additions or another way!&lt;/p&gt;
&lt;p&gt;First: Scripts for gathering information.&lt;/p&gt;
&lt;p&gt;1. What should my OUTPUT be?&lt;br /&gt;
It&amp;#8217;s easier to start with the end. Start by determining what you would like your output to look like.&lt;/p&gt;
&lt;p&gt;1.1 OBJECTS representing what?&lt;br /&gt;
It&amp;#8217;s good practise generating objects as output. It allows you to use the full power of Powershell to further manipulate your output. So don&amp;#8217;t use any Format-&amp;#8230; cmdlets in your scripts! That being said, what should the output objects represent?&lt;br /&gt;
Let&amp;#8217;s take a simple example, like generating an overview of server OS versions or free disk space or something similar. The output objects should represent the servers.&lt;/p&gt;
&lt;p&gt;1.2 What PROPERTIES?&lt;br /&gt;
You all know objects have properties. If not, read Get-Help About_Object. What properties of the server objects are we interested in? In the example it could be Server Name (obviously), OS Version, Service Pack, Free Disk Space on C-partition, and so on.&lt;/p&gt;
&lt;p&gt;2. WHERE to get the information?&lt;br /&gt;
Now that we know what objects to create and what properties to fill, let&amp;#8217;s examine where to get all this info.&lt;/p&gt;
&lt;p&gt;2.1 The EASY ones.&lt;br /&gt;
When the properties can all be found in one place, the script is simple. For example, the OS Version and Service Pack of a server, can all be found in Active Directory. The Quest AD cmdlet Get-QADComputer returns objects representing servers, which have properties including the ones we seek. All we have to do is FILTER the properties, like so:&lt;br /&gt;
Get-QADComputer | Select-Object Name, OSName, OSServicePack&lt;/p&gt;
&lt;p&gt;And we&amp;#8217;re all done!&lt;/p&gt;
&lt;p&gt;2.2 Getting HARDER:&lt;br /&gt;
What if most properties can be found in this way, but some require additional calculations or &amp;#8220;get-&amp;#8221;ting? Then we can use CALCULATED PROPERTIES. The syntax is as follows:&lt;br /&gt;
Get-Something | Select-Object Name, @{N=&amp;#8221;CalculatedPropertyName&amp;#8221;;E={EXPRESSION THAT RETURNS THE DESIRED VALUE}}&lt;br /&gt;
For example, you want to get several properties of a harddisk, but one value should be converted from bytes to GB:&lt;br /&gt;
Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, @{N=&amp;#8221;GBFreeSpace&amp;#8221;;E={$_.FreeSpace/1GB}}&lt;/p&gt;
&lt;p&gt;2.3 The CHALLENGE:&lt;br /&gt;
The most difficult scripts gather information from all over the place. But you&amp;#8217;d still like to present it in a simple and convenient manner. This is when you should build your own output objects and create the properties yourself. In order to get this done for multiple objects in a collection, it is vital you loop through a collection of objects representing the same thing as your output objects. Consider the following example:&lt;br /&gt;
Let&amp;#8217;s say you want to get some exotic characteristics for all your vm&amp;#8217;s. For instance which server it is running on, the last 5 events that occurred and the average memory usage. These aren&amp;#8217;t properties of any vm object you can get. So start by looping through all the vm objects you can get, but not before you create an empty collection to old your output objects:&lt;br /&gt;
$myCol = @()&lt;br /&gt;
$VC = Connect-VIServer MYVCSERVER&lt;br /&gt;
$vms = Get-VM&lt;br /&gt;
ForEach ($vm in $vms)&lt;br /&gt;
{&lt;br /&gt;
Then, inside the loop, create a custom output object along with the properties you&amp;#8217;d like to see:&lt;br /&gt;
$myObj = &amp;#8220;&amp;#8221; | Select Name, Host, LatestEvents, AvgMemUsage&lt;br /&gt;
Then you can start calculating or &amp;#8220;get-&amp;#8221;ting the proper values for each of these properties. For example:&lt;br /&gt;
$myObj.Name = $vm.Name&lt;br /&gt;
$myObj.Host = ($vm | Get-VMHost).Name&lt;br /&gt;
$myObj.LatestEvents = ($vm | Get-Event | Select-Object -Last 5)&lt;br /&gt;
$myObj.AvgMemUsage = ($vm | Get-Stat -Memory -MaxSamples 1).Value&lt;br /&gt;
(These examples are off the top of my head and untested.)&lt;br /&gt;
Finally, add your output object to the collection and close the loop:&lt;br /&gt;
$myCol += $myObj&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Next time: Scripts that actually change values or perform some other action. Stay tuned.&lt;br /&gt;
Hugo&lt;/p&gt;
</description><pubDate>Fri, 10 Oct 2008 09:51:17 GMT</pubDate><guid isPermaLink="false">http://www.peetersonline.nl/index.php/powershell/some-advice-on-creating-powershell-scripts/</guid><comments>http://www.peetersonline.nl/index.php/powershell/some-advice-on-creating-powershell-scripts/#comments</comments><author>admin</author><source url="http://www.peetersonline.nl/index.php/feed/">PeetersOnline.nl</source><ng:postId>6083436351</ng:postId><ng:feedId>3190560</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>BSonPoSH » Using Switch -RegEx to create Custom Object (Getting HBA Info)</title><link>http://bsonposh.com/archives/248</link><description /><pubDate>Wed, 27 Aug 2008 13:12:41 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/5713997017</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>5713997017</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>PowerShell Team Blog : Programmatic way to get valid string values for a parameter</title><link>http://blogs.msdn.com/powershell/archive/2006/05/10/594175.aspx</link><description>&lt;p&gt;The attributes provide a programmable way to discover the capabilities of the cmdlet.  This can be used in all sorts of wonderful ways - e.g. autogenerating GUI front end to the cmdlets.&lt;/p&gt;
    &lt;span&gt;
        &lt;a href="http://delicious.com/post?url=http%3A%2F%2Fblogs.msdn.com%2Fpowershell%2Farchive%2F2006%2F05%2F10%2F594175.aspx&amp;title=PowerShell%20Team%20Blog%20%3A%20Programmatic%20way%20to%20get%20valid%20string%20values%20for%20a%20parameter&amp;copyuser=halr9000&amp;copytags=powershell+scripting+advanced+powerscripting+todo+tips&amp;jump=yes&amp;partner=delrss&amp;src=feed_newsgator" rel="nofollow" title="add this bookmark to your collection at http://delicious.com"&gt;&lt;img src="http://l.yimg.com/hr/10317/img/delicious.small.gif" alt="http://delicious.com" width="10" height="10" border="0" /&gt;&amp;nbsp;Bookmark&amp;nbsp;this&amp;nbsp;on&amp;nbsp;Delicious&lt;/a&gt;
        - Saved by &lt;a title="visit halr9000's bookmarks at Delicious" href="http://delicious.com/halr9000"&gt;halr9000&lt;/a&gt;
                    to
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged powershell" href="http://delicious.com/halr9000/powershell"&gt;powershell&lt;/a&gt;
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged scripting" href="http://delicious.com/halr9000/scripting"&gt;scripting&lt;/a&gt;
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged advanced" href="http://delicious.com/halr9000/advanced"&gt;advanced&lt;/a&gt;
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged powerscripting" href="http://delicious.com/halr9000/powerscripting"&gt;powerscripting&lt;/a&gt;
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged todo" href="http://delicious.com/halr9000/todo"&gt;todo&lt;/a&gt;
                                                &lt;a rel="tag" title="view halr9000's bookmarks tagged tips" href="http://delicious.com/halr9000/tips"&gt;tips&lt;/a&gt;
                                                        - &lt;a rel="self" title="view more details on this bookmark at Delicious" href="http://delicious.com/url/160bce2036be36b58acf58607e2bc379"&gt;More about this bookmark&lt;/a&gt;
                        &lt;/span&gt;</description><pubDate>Wed, 20 Aug 2008 01:36:02 GMT</pubDate><guid isPermaLink="false">http://blogs.msdn.com/powershell/archive/2006/05/10/594175.aspx</guid><author>halr9000</author><source url="http://feeds.delicious.com/rss/tag/powershell">Delicious/tag/powershell</source><ng:postId>5650121132</ng:postId><ng:feedId>645561</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Microcode: PowerShell Scripting Trick - Writing functions that use the pipeline or take arguments</title><link>http://blogs.msdn.com/mediaandmicrocode/archive/2008/07/26/microcode-powershell-scripting-trick-writing-functions-that-use-the-pipeline-or-take-arguments.aspx</link><description>&lt;p&gt;I was cleaning up some scripts for posting when I happened upon this minor trick. I had a function that was using $input, a PowerShell v1 feature that allows you to use pipelined values within a function.&amp;#160; This enables you to do basic pipelining with PowerShell v1, but it can make code more complex if you want to handle the same item as one or more positional parameters.&lt;/p&gt;  &lt;p&gt;Here's a simplified example:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;function Add-Number() {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; begin { $total = 0 }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; process {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; foreach ($in in $input + $args) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Expand once more to handle lists of lists      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; foreach ($i in $in) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $total+=$i      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; end { $total }      &lt;br /&gt;}&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This snippet of code allows your V1 functions to act significantly more like cmdlets will, without needing to use PowerShell CTP2.&lt;/p&gt;  &lt;p&gt;It makes&lt;/p&gt;  &lt;p&gt;1..5&amp;#160; | Add-Number&lt;/p&gt;  &lt;p&gt;work the same as:&lt;/p&gt;  &lt;p&gt;Add-Number (1..5)&lt;/p&gt;  &lt;p&gt;and the same as:&lt;/p&gt;  &lt;p&gt;Add-Number 1 2 3 4 5&lt;/p&gt;  &lt;p&gt;Since every item in PowerShell is an object, you can also easily check for types at any point, which allows you to respond to multiple types of objects in a pipeline.&amp;#160; This simple trick makes it much easier to build V1 functions that have most of the flexibility of cmdlets.&lt;/p&gt;  &lt;p&gt;Hope this helps,&lt;/p&gt;  &lt;p&gt;James Brundage&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8776471" width="1" height="1"&gt;</description><pubDate>Sat, 26 Jul 2008 20:01:21 GMT</pubDate><guid isPermaLink="false">http://blogs.msdn.com/mediaandmicrocode/archive/2008/07/26/microcode-powershell-scripting-trick-writing-functions-that-use-the-pipeline-or-take-arguments.aspx</guid><author>JamesBrundage</author><source url="http://blogs.msdn.com/mediaandmicrocode/atom.xml">Media And Microcode</source><ng:postId>5574444587</ng:postId><ng:feedId>3320635</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Check NIC bind order | PeetersOnline.nl</title><link>http://www.peetersonline.nl/index.php/powershell/check-nic-bind-order</link><description /><pubDate>Mon, 04 Aug 2008 15:47:15 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/5531394734</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>5531394734</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Using PowerShell to make sure your XP machine is defragmented</title><link>http://blogs.msdn.com/jaredpar/archive/2008/06/13/using-powershell-to-make-sure-your-xp-machine-is-defragmented.aspx</link><description>&lt;p&gt;Quick script you can run at login to ensure that your XP machine is being defragmented.&amp;nbsp; I chose 1:00 AM every evening but you can quickly alter that in the script.&amp;nbsp; I have this script run as part of my regular set of configuration scripts to ensure that my XP machines are in good shape.&lt;br&gt;&lt;/p&gt; &lt;p&gt;$script:title = "Xp Regular Degrag"&lt;br&gt;if ( 5 -ne [Environment]::OsVersion.Version.Major ) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return; &lt;br&gt;}&lt;br&gt;$found = schtasks /query | ?{ $_ -match "^\w*$title" } | test-any&lt;br&gt;if ( $found ) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;br&gt;}&lt;br&gt;# Set up the defrag task&lt;br&gt;$task = "{0} {1}" -f (join-path $env:WinDir "System32\defrag.exe"),$env:SystemDrive&lt;br&gt;schtasks /create /ru system /tn $title /sc daily /st "01:00:00" /tr $task  &lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8591610" width="1" height="1"&gt;</description><pubDate>Fri, 13 Jun 2008 12:00:15 GMT</pubDate><guid isPermaLink="false">http://blogs.msdn.com/jaredpar/archive/2008/06/13/using-powershell-to-make-sure-your-xp-machine-is-defragmented.aspx</guid><author>jaredpar</author><source url="http://blogs.msdn.com/jaredpar/atom.xml">jaredpar's WebLog</source><ng:postId>5279002081</ng:postId><ng:feedId>1657500</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell : $MindWarpingPower = $Cmdlets + $ScriptBlock_Parameters</title><link>http://blogs.msdn.com/powershell/archive/2008/04/21/mindwarpingpower-cmdlets-scriptblock-parameters.aspx</link><description /><pubDate>Sun, 22 Jun 2008 10:30:34 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/5191702031</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>5191702031</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Find Exceptional Mailboxes in Exchange Environment</title><link>http://exchangeshare.wordpress.com/2008/06/11/find-exceptional-mailboxes-in-the-exchange-environment/</link><description>  In Exchange 2003, we are using Active Directory Users &amp; Computers to find some of the exceptional users/mailboxes up to certain level (may be with custom LDAP query) in the environment but in Exchange 2007 Management Console we have certain limitations to find it but there PowerShell helps you.  In Exchange 2007 Management Console we can filter recipients for below attributes and values are matching, available or unavailable.         ActiveSynch Mailbox Policy  Alias  City  Company  Countr</description><pubDate>Wed, 11 Jun 2008 16:02:02 GMT</pubDate><guid isPermaLink="false">http://exchangeshare.wordpress.com/2008/06/11/find-exceptional-mailboxes-in-the-exchange-environment/</guid><comments>http://technorati.com/search/exchangeshare.wordpress.com/2008/06/11/find-exceptional-mailboxes-in-the-exchange-environment/</comments><source url="http://feeds.technorati.com/feed/posts/tag/powershell">[Technorati] Tag results for powershell</source><ng:postId>5115139127</ng:postId><ng:feedId>645555</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Writing Better Script Functions for the PowerShell Pipeline</title><link>http://huddledmasses.org/writing-better-script-functions-for-the-powershell-pipeline/</link><description /><pubDate>Tue, 13 May 2008 01:18:23 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/4924963371</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>4924963371</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell</title><link>http://technet.microsoft.com/en-us/library/bb978526.aspx</link><description>20080424</description><pubDate>Thu, 24 Apr 2008 09:22:31 GMT</pubDate><guid isPermaLink="false">33687bc3d3d2b1d69b88a66e5788e69a</guid><source url="http://technet.microsoft.com/en-us/library/bb978526.aspx" /><ng:postId>4803423179</ng:postId><ng:feedId>1816673</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>WindowsDevCenter.com -- Top 10 Tips for Using Windows PowerShell</title><link>http://www.windowsdevcenter.com/pub/a/windows/2006/11/07/top-10-tips-for-using-windows-powershell.html</link><description /><pubDate>Thu, 17 Apr 2008 16:39:32 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/4761716449</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>4761716449</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Virtual machine copying with PowerShell</title><link>http://www.justaddcode.com/blog/2007/02/19/virtual-machine-copying-with-powershell/</link><description>&lt;p&gt;Believe it or not, PowerShell is more than just fun and &lt;a TARGET="_blank" HREF="http://ps1.soapyfrog.com/2007/01/02/space-invaders/"&gt;games&lt;/a&gt;. You can even do productive things with it! A common scenario I run into is the need to create a new virtual machine. Usually I want to base it on one I’ve already created and I want it to join a domain. There are a couple issues that I run in to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; Duplicate&lt;a TARGET="_blank" HREF="http://en.wikipedia.org/wiki/Security_Identifier"&gt; SID&lt;/a&gt; Error&lt;/li&gt;
&lt;li&gt; Too many clicks&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first problem can be solved with a free tool that Microsoft has released called &lt;a TARGET="_blank" HREF="http://www.microsoft.com/technet/sysinternals/Security/NewSid.mspx"&gt;NewSID&lt;/a&gt;. Running that will give my virtual a unique SID so that it can be added to the domain.&lt;/p&gt;
&lt;p&gt;Now for the second problem..too many clicks! Renaming a machine and adding it to the domain takes almost 2 minutes and a nearly infinite number of clicks and keystrokes…or maybe not. At any rate, it’d be great to simplify this process. Enter PowerShell.&lt;br /&gt;
Rename a Computer and Join Domain&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="php"&gt;&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt; = get-wmiobject Win32_ComputerSystem 
&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt;.&lt;span style="color: #000066;"&gt;Rename&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;“newComputerName”,”password”,”administrator”&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; 
&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt;.JoinDomainOrWorkGroup&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;“MYDOMAIN”,”domainPassword”,”MYDOMAINdomainAdmin”,&lt;span style="color: #0000ff;"&gt;$null&lt;/span&gt;,&lt;span style="color: #cc66cc;"&gt;3&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add a call to NewSID, wrap those delicious lines in a function and you are well on your way to renaming a virtual and joining a domain in fewer keystrokes. Its so easy you might even find yourself creating new virtuals just to run it again.&lt;/p&gt;
</description><pubDate>Tue, 20 Feb 2007 02:14:56 GMT</pubDate><guid isPermaLink="false">http://www.justaddcode.com/wordpress/2007/02/19/virtual-machine-copying-with-powershell/</guid><comments>http://www.justaddcode.com/blog/2007/02/19/virtual-machine-copying-with-powershell/#comments</comments><author>neil</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>4338798598</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell 1.0 - In Action</title><link>http://www.frameworkx.com/blogpost.aspx?id=2&amp;c=1428</link><description>This is a three part series; Part 1 looks at how to process, search, and manipulate strings and unstructured text using the .NET string object and regular expressions; Part 2 focuses on file processing; Part 3 looks at working with XML in PowerShell....</description><pubDate>Sat, 05 Apr 2008 21:35:11 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/2278658/4683559204</guid><source url="http://www.frameworkx.com/rss.aspx?blog=2">Rich Crusco Technology Blog RSS</source><ng:postId>4683559204</ng:postId><ng:feedId>2278658</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell 1.0 - SDK</title><link>http://www.frameworkx.com/blogpost.aspx?id=2&amp;c=1424</link><description>The Windows PowerShell Software Development Kit (SDK) is now available as part of Microsoft Windows SDK for Windows Server 2003, Windows Server 2008, Windows Vista, and Windows XP.
...</description><pubDate>Sat, 05 Apr 2008 19:54:02 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/2278658/4683559162</guid><source url="http://www.frameworkx.com/rss.aspx?blog=2">Rich Crusco Technology Blog RSS</source><ng:postId>4683559162</ng:postId><ng:feedId>2278658</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>A collection of LDAP Filter Info</title><link>http://bsonposh.com/modules/wordpress/?p=101</link><description>&lt;p&gt;I often find myself googling for LDAP filter info. This time I decided to post the resulting set of websites I hit for this info.&lt;/p&gt;
&lt;p&gt;NOTE: MS release the Specs for Active Directory's LDAP Compliance here. GREAT DOC!&lt;br /&gt;&lt;a href="http://download.microsoft.com/download/d/c/8/dc83e0b8-fc2c-4af4-bd27-45b5963ad98d/AD%20LDAP%20Compliance.doc" target="_blank"&gt;http://download.microsoft.com/download/d/c/8/dc83e0b8-fc2c-4af4-bd27-45b5963ad98d/AD%20LDAP%20Compliance.doc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Blog Entry on LDAP Filters&lt;br /&gt;-------------------------&lt;br /&gt;&lt;a href="http://bsonposh.com/modules/wordpress/?p=78" target="_blank"&gt;http://bsonposh.com/modules/wordpress/?p=78&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;LDAP Filter Articles&lt;br /&gt;-------------------&lt;br /&gt;query Active Directory by using a bitwise filter&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/269181" target="_blank"&gt;http://support.microsoft.com/kb/269181&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Search Filter Syntax&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa746475.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/aa746475.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Mastering the LDAP search filter&lt;br /&gt;&lt;a href="http://searchwinit.techtarget.com/tip/0" target="_blank"&gt;http://searchwinit.techtarget.com/tip/0&lt;/a&gt;,289483,sid1_gci1191071,00.html&lt;/p&gt;
&lt;p&gt;userAccountControl&lt;br /&gt;-------------------&lt;br /&gt;UserAccountControl flags&lt;br /&gt;&lt;a href="http://support.microsoft.com/kb/305144" target="_blank"&gt;http://support.microsoft.com/kb/305144&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;User-Account-Control Attribute (Windows)&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms680832.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/ms680832.aspx&lt;/a&gt;
&lt;/p&gt;
</description><pubDate>Fri, 28 Mar 2008 01:25:50 GMT</pubDate><guid isPermaLink="false">http://bsonposh.com/modules/wordpress/?p=101</guid><comments>http://bsonposh.com/modules/wordpress/?p=101#comments</comments><author>Brandon</author><source url="http://bsonposh.com/modules/wordpress/?feed=rss2">BSonPoSH</source><ng:postId>4626726236</ng:postId><ng:feedId>1191563</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Using Switch -RegEx to create Custom Object (Getting HBA Info)</title><link>http://bsonposh.com/modules/wordpress/?p=59</link><description>&lt;p&gt;The other day I had a need to collect HBA (Host Base Fiber Adapters) from all my Servers. So the first place I looked was at WMI, but unfortunately... no dice. It didnt have the information I needed. The only way I knew to get the info I needed was to use was HBACmd.exe (utility to collect HBA information remotely.) So I went to writing a wrapper script in powershell to call the exe and then grep the text for what I was looking for, but I thought... HEY! Thats not the powershell thing to do! We do objects not text. So I went to parsing the text and making an object out of it. The script below is the result and while I dont believe many of you will find it particularly useful as it has a VERY specific use, I wanted to share with you how I went about objectizing the output.&lt;/p&gt;
&lt;p&gt;Here is a littel Q and A on the script&lt;/p&gt;
&lt;p&gt;Q: Purpose?&lt;br /&gt;A: To get all the HBA information include Type, Firmware, Bios, Target Lun, WWN and a slew of other stuff.&lt;/p&gt;
&lt;p&gt;Q: Why Did I objectize my text?&lt;br /&gt;A: Because I know can simply use properties to filter and output data. Like what Machines have what Bios and what type of HBAs they have. Before I would have the parse the text for every different senario... now I just use where-object and filter away.&lt;/p&gt;
&lt;p&gt;I few things that I wanted to point out here are the use of Switch to create the Custom Objects. IMO, Switch is one of the most powerful commands in the Powershell Language. It is INSANELY Powerfull. To be honest, It is pretty much the only one you need. &lt;/p&gt;
&lt;p&gt;To compare it "Select Case" in vbscript would be insulting, but it can peform a similar function Like&lt;br /&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$a&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Value1&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;It was Value 1&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Value2&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;It was Value 2&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Value3&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;It was Value 3&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Value4&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;It was Value 4&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;It would take a whole series of post to completely cover switch, but for this one I only want to go over -regex use. For complete use read the help located:&lt;br /&gt;PS&gt; Get-help About_Switch    # Read it, Learn it, Love it&lt;/p&gt;
&lt;p&gt;Some Quick Notes about Switch&lt;br /&gt;- Can use RegEx, WildCard, Exact, CaseSensitive, or File options.&lt;br /&gt;- It takes input via Pipeline {expression} or File. The cool thing is the pipeline can be any expression that results in piped output.&lt;br /&gt;- For each match it can perform any ScritpBlock use $_ as the current Item&lt;br /&gt;- It performs EVERY match on each element unless you use Continue after a match to stop processing that record&lt;/p&gt;
&lt;p&gt;Like I said, Switch is insanely powerful. Just one of those powers is using RegEx for comparison. &lt;/p&gt;
&lt;p&gt;Here is an example of using the -RegEx option&lt;br /&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt; &lt;span style="color: #000066;"&gt;-RegEx&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;Get-&lt;span style="font-style: normal;"&gt;ChildItem&lt;/span&gt;&lt;/span&gt; C:\test&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^\d&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;Starts with number:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;&lt;/span&gt; + &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FullName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;\d&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;Has a number in it:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;quot;&lt;/span&gt; + &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FullName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;[^A-Za-z]&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;Does NOT start with Number:&amp;nbsp; &amp;quot;&lt;/span&gt; + &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FullName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;tmp&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;Has 'tmp' in it:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;&lt;/span&gt; + &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FullName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #458B74; font-style: italic;"&gt;# Notice that you can even use and expression to match&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Mode&lt;/span&gt; &lt;span style="color: #000066;"&gt;-match&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;-a&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;Has Archive Bit Set:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;&lt;/span&gt; + &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FullName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Now.. lets look at the script below. You will noticed I used RegEx to decide what value gets put in to what property of the object. &lt;/p&gt;
&lt;p&gt;The script converts the output of three commands into two different objects. Lets look at one of them&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;It takes text like This&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Manageable HBA List&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Port WWN&amp;nbsp; &amp;nbsp;: &lt;span style="color: #cc66cc;"&gt;10&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Node WWN&amp;nbsp; &amp;nbsp;: &lt;span style="color: #cc66cc;"&gt;20&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Fabric Name: &lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Flags&amp;nbsp; &amp;nbsp; &amp;nbsp; : 0000f0a5&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #660033;"&gt;Host&lt;/span&gt; Name&amp;nbsp; : Server1&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Mfg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Emulex Corporation&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Port WWN&amp;nbsp; &amp;nbsp;: &lt;span style="color: #cc66cc;"&gt;10&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Node WWN&amp;nbsp; &amp;nbsp;: &lt;span style="color: #cc66cc;"&gt;20&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;22&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Fabric Name: &lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Flags&amp;nbsp; &amp;nbsp; &amp;nbsp; : 0000f0a5&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #660033;"&gt;Host&lt;/span&gt; Name&amp;nbsp; : Server1&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Mfg&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Emulex Corporation&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;And converts Into an object like This&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp;TypeName: &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;Management&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Automation&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PSCustomObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MemberType&amp;nbsp; &amp;nbsp;Definition&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;----&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ----------&amp;nbsp; &amp;nbsp;----------&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Equals&amp;nbsp; &amp;nbsp; &amp;nbsp; Method&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;Boolean&lt;/span&gt; Equals&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;Object obj&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;GetHashCode Method&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;Int32&lt;/span&gt; GetHashCode&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;GetType&amp;nbsp; &amp;nbsp; &amp;nbsp;Method&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=type+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;Type&lt;/span&gt;&lt;/a&gt; GetType&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;ToString&amp;nbsp; &amp;nbsp; Method&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; ToString&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Fabric&amp;nbsp; &amp;nbsp; &amp;nbsp; NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; Fabric=&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;Flags&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; Flags=0000f0a5&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;HBADetail&amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;Object&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt; HBADetail=&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;Object&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #660033;"&gt;Host&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #660033;"&gt;Host&lt;/span&gt;=Server1&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;LUN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; LUN=&lt;span style="color: #cc66cc;"&gt;01&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;MFG&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; MFG=Emulex Corporation&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;NodeWWN&amp;nbsp; &amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; NodeWWN=&lt;span style="color: #cc66cc;"&gt;20&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;PortWWN&amp;nbsp; &amp;nbsp; &amp;nbsp;NoteProperty &lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;System&lt;/span&gt;&lt;/a&gt;.&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;String&lt;/span&gt;&lt;/a&gt; PortWWN=&lt;span style="color: #cc66cc;"&gt;10&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;00&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;:&lt;span style="color: #cc66cc;"&gt;11&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Here is the Script&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;Param&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$List&lt;/span&gt;,&lt;span style="color: #660033; font-weight: bold;"&gt;$HostName&lt;/span&gt;,&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$FullDetail&lt;/span&gt;,&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$Verbose&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;Begin&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$erroractionpreference&lt;/span&gt; = &lt;span style="color: #009900;"&gt;&amp;quot;SilentlyContinue&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBACMDPath&lt;/span&gt; = &lt;span style="color: #009900;"&gt;&amp;quot;&amp;lt;Path To HbaCmd.exe&amp;gt;&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;function&lt;/span&gt; CreateHBAListObj&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;Param&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; = @&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt; = &amp;amp;&lt;span style="color: #009900;"&gt;&amp;quot;$HBACMDPath&amp;quot;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;h=$srv&amp;quot;&lt;/span&gt; ListHBAs&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;foreach&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$item&lt;/span&gt; &lt;span style="color: #666699; font-weight: bold;"&gt;in&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$item&lt;/span&gt;.&lt;span style="color: #003366;"&gt;split&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;string&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;,&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;system&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;StringSplitOptions&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;::&lt;span style="color: #003366;"&gt;RemoveEmptyEntries&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt; &lt;span style="color: #000066;"&gt;-regex&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Port&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt; = &lt;span style="color: #009900;"&gt;&amp;quot;&amp;quot;&lt;/span&gt; | &lt;span style="color: #0066cc; font-style: italic;"&gt;Select-&lt;span style="font-style: normal;"&gt;Object&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #660033;"&gt;Host&lt;/span&gt;,PortWWN,NodeWWN,Fabric,Flags,LUN,MFG&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PortWWN&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Lun&lt;/span&gt; = GetTargetLun &lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PortWWN&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Node&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;NodeWWN&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Fabr&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Fabric&lt;/span&gt;&amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Flag&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Flags&lt;/span&gt;&amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Host&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #660033;"&gt;Host&lt;/span&gt;&amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^MFG &amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;MFG&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; += &lt;span style="color: #660033; font-weight: bold;"&gt;$myObj&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;function&lt;/span&gt; CreateHBAInfoObj&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;Param&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt;,&lt;span style="color: #660033; font-weight: bold;"&gt;$wwn&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; = @&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt; = &amp;amp;&lt;span style="color: #009900;"&gt;&amp;quot;$HBACMDPath&amp;quot;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;h=$srv&amp;quot;&lt;/span&gt; HBAAttrib &lt;span style="color: #660033; font-weight: bold;"&gt;$wwn&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt; = &lt;span style="color: #009900;"&gt;&amp;quot;&amp;quot;&lt;/span&gt; |&lt;span style="color: #0066cc; font-style: italic;"&gt;Select-&lt;span style="font-style: normal;"&gt;Object&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #660033;"&gt;Host&lt;/span&gt;,MFG,SN,Model,ModelDesc,NodeWWN,NodeSymname,&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;HWVersion,ROM,FW,VenderID,Ports,DriverName,DeviceID,HBAType,&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OpFW,SLT1FW,SLT2FW,IEEEAddress,BootBios,DriverVer,KernelVer&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;foreach&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$item&lt;/span&gt; &lt;span style="color: #666699; font-weight: bold;"&gt;in&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$item&lt;/span&gt;.&lt;span style="color: #003366;"&gt;split&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;string&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;,&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;system&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;StringSplitOptions&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;::&lt;span style="color: #003366;"&gt;RemoveEmptyEntries&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt; &lt;span style="color: #000066;"&gt;-regex&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Host&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #660033;"&gt;Host&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Manufacturer&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;MFG&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Serial&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Sn&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Model&amp;nbsp; &amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Model&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Model Desc&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;ModelDesc&lt;/span&gt;&amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Node WWN &amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;NodeWWN&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Node Symname&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;NodeSymname&lt;/span&gt;&amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^HW&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;HWVersion&lt;/span&gt;&amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Opt&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;ROM&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^FW&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;FW&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Vender&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;VenderID&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Number&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;Ports&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Driver Name&amp;quot;&lt;/span&gt;&amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;DriverName&lt;/span&gt;&amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Device&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;DeviceID&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^HBA Type&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;HBAType&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Operational&amp;quot;&lt;/span&gt;&amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;OpFW&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^SLI1 FW&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;SLT1FW&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^SLI2 FW&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;SLT2FW&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^IEEE&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;IEEEAddress&lt;/span&gt;&amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Boot &amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;BootBios&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;= &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Driver Ver&amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;DriverVer&lt;/span&gt;&amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^Kernel &amp;quot;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$myobj&lt;/span&gt;.&lt;span style="color: #003366;"&gt;KernelVer&lt;/span&gt;&amp;nbsp; &amp;nbsp; = &lt;span style="color: #660033; font-weight: bold;"&gt;$parsd&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; += &lt;span style="color: #660033; font-weight: bold;"&gt;$myObj&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; &lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;function&lt;/span&gt; GetTargetLun&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;Param&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt;,&lt;span style="color: #660033; font-weight: bold;"&gt;$wwn&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$objCol&lt;/span&gt; = @&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt; = &amp;amp;&lt;span style="color: #009900;"&gt;&amp;quot;$HBACMDPath&amp;quot;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;h=$srv&amp;quot;&lt;/span&gt; TargetMapping &lt;span style="color: #660033; font-weight: bold;"&gt;$wwn&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=int+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;int&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$lun&lt;/span&gt; = &lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;switch&lt;/span&gt; &lt;span style="color: #000066;"&gt;-regex&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$result&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;^SCSI OS Lun&amp;quot;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$lun&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;split&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;string&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;: &amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;,&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=System+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;system&lt;/span&gt;&lt;/a&gt;.&lt;span style="color: #003366;"&gt;StringSplitOptions&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;::&lt;span style="color: #003366;"&gt;RemoveEmptyEntries&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;.&lt;span style="color: #003366;"&gt;trim&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #009900;"&gt;&amp;quot;{0:x}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$lun&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;function&lt;/span&gt; &lt;span style="color: #0066cc; font-style: italic;"&gt;Ping-&lt;span style="font-style: normal;"&gt;Server&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;Param&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#91;&lt;/span&gt;&lt;a href="http://www.google.com/search?q=string+site:msdn.microsoft.com"&gt;&lt;span style="color: #003366; font-weight: bold;"&gt;string&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #333;"&gt;&amp;#93;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$srv&lt;/span&gt; &lt;span style="color: #000066;"&gt;-eq&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;return&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$false&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$pingresult&lt;/span&gt; = &lt;span style="color: #0066cc; font-style: italic;"&gt;Get-&lt;span style="font-style: normal;"&gt;WmiObject&lt;/span&gt;&lt;/span&gt; win32_pingstatus &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;address='$srv'&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$pingresult&lt;/span&gt;.&lt;span style="color: #003366;"&gt;statuscode&lt;/span&gt; &lt;span style="color: #000066;"&gt;-eq&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$true&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$false&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$verbose&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$VerbosePreference&lt;/span&gt; = &lt;span style="color: #009900;"&gt;&amp;quot;Continue&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;Process&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Getting HBA Info from $_&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$FullDetail&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;CreateHBAInfoObj &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #660033;"&gt;Host&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PortWWN&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #0066cc; font-style: italic;"&gt;add-&lt;span style="font-style: normal;"&gt;Member&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-Name&lt;/span&gt; HBADetail &lt;span style="color: #000066;"&gt;-type&lt;/span&gt; NoteProperty &lt;span style="color: #000066;"&gt;-Value&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; &lt;span style="color: #000066;"&gt;-force&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #666699; font-weight: bold;"&gt;End&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$list&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$servers&lt;/span&gt; = &lt;span style="color: #0066cc; font-style: italic;"&gt;Get-&lt;span style="font-style: normal;"&gt;Content&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$list&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Running HBA Check against Servers in $list&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;foreach&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$server&lt;/span&gt; &lt;span style="color: #666699; font-weight: bold;"&gt;in&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$servers&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$server&lt;/span&gt; &lt;span style="color: #000066;"&gt;-ne&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;ping-&lt;span style="font-style: normal;"&gt;server&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$server&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Getting HBA Info from $server&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$FullDetail&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$server&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;CreateHBAInfoObj &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #660033;"&gt;Host&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PortWWN&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #0066cc; font-style: italic;"&gt;add-&lt;span style="font-style: normal;"&gt;Member&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-Name&lt;/span&gt; HBADetail &lt;span style="color: #000066;"&gt;-type&lt;/span&gt; NoteProperty &lt;span style="color: #000066;"&gt;-Value&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; &lt;span style="color: #000066;"&gt;-force&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$server&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;$Server not Pingable &lt;span style="color: #000099; font-weight: bold;"&gt;`n&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-foregroundcolor&lt;/span&gt; RED&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$HostName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Running HBA Check against Servers in $HostName&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;ping-&lt;span style="font-style: normal;"&gt;server&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$HostName&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Getting HBA Info from $HostName&amp;quot;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #660033; font-weight: bold;"&gt;$FullDetail&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$HostName&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; = &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;CreateHBAInfoObj &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #660033;"&gt;Host&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;.&lt;span style="color: #003366;"&gt;PortWWN&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; | &lt;span style="color: #0066cc; font-style: italic;"&gt;add-&lt;span style="font-style: normal;"&gt;Member&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-Name&lt;/span&gt; HBADetail &lt;span style="color: #000066;"&gt;-type&lt;/span&gt; NoteProperty &lt;span style="color: #000066;"&gt;-Value&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$HBADetail&lt;/span&gt; &lt;span style="color: #000066;"&gt;-force&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt; = CreateHBAListObj &lt;span style="color: #660033; font-weight: bold;"&gt;$HostName&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #660033; font-weight: bold;"&gt;$MyObject&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #666699; font-weight: bold;"&gt;else&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;$HostName not Pingable &lt;span style="color: #000099; font-weight: bold;"&gt;`n&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-foregroundcolor&lt;/span&gt; RED&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #0066cc; font-style: italic;"&gt;Write-&lt;span style="font-style: normal;"&gt;Host&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&amp;nbsp;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description><pubDate>Thu, 08 Nov 2007 22:22:42 GMT</pubDate><guid isPermaLink="false">http://bsonposh.com/modules/wordpress/?p=59</guid><comments>http://bsonposh.com/modules/wordpress/?p=59#comments</comments><author>Brandon</author><source url="http://bsonposh.com/modules/wordpress/?feed=rss2">BSonPoSH</source><ng:postId>3952834595</ng:postId><ng:feedId>1191563</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>The Power of -f. The Format Operator</title><link>http://bsonposh.com/modules/wordpress/?p=35</link><description>&lt;p&gt;This is from a NG post discussing the -f Operator&amp;#8230; I thought it was a pretty good description. Compliments to Kiron.&lt;/p&gt;
&lt;p&gt;Q: What is the -f operator&lt;/p&gt;
&lt;p&gt;A: PowerShell&amp;#8217;s Format Operator &amp;#8216;-f&amp;#8217; is equivalent to .Net&amp;#8217;s Composite &lt;br /&gt;Formatting. The syntax is:&lt;br /&gt;{index[,alignment][:formatString]} -f listOfValues&lt;/p&gt;
&lt;p&gt;Composite Formatting&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/txafckwd" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/txafckwd&lt;/a&gt;(vs.71).aspx&lt;/p&gt;
&lt;p&gt;Quoting from about_operator:&lt;br /&gt;Format Operator &amp;#8220;-f&amp;#8221;&lt;br /&gt;The format operator provides support for formatting strings via the .NET &lt;br /&gt;string object format method.  On the left hand side of the operator is the &lt;br /&gt;format string and on the right hand of the operator is the collection of &lt;br /&gt;objects to be formatted.&lt;br /&gt;The following example shows some of the capabilities of the format operator.&lt;br /&gt;PS&gt; &amp;#8220;{0} {1,-10} {2:N}&amp;#8221; -f 1,&amp;#8221;hello&amp;#8221;,[math]::pi&lt;br /&gt;1 hello      3.14&lt;/p&gt;
&lt;p&gt;Some samples:&lt;br /&gt;
&lt;div class="ch_code_container" style="font-family: monospace;height:100%;"&gt;
&lt;ol&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #458B74; font-style: italic;"&gt;# the &amp;#8216;|&amp;#8217; is for demonstrating the alignment&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:(###) ###-####}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #cc66cc;"&gt;2224445555&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# phone number&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:hh:mm:ss tt}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;get-&lt;span style="font-style: normal;"&gt;date&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# time, 12 hour format&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:HH:mm:ss}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;get-&lt;span style="font-style: normal;"&gt;date&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# time, 24 hour format&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:p4}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1&lt;/span&gt;/&lt;span style="color: #cc66cc;"&gt;3&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# percent with four decimal places&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:c2}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1724.87&lt;/span&gt; * &lt;span style="color: #cc66cc;"&gt;12&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# currency with two decimal places&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;|{0,22:c2}|&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;1724.87&lt;/span&gt; * &lt;span style="color: #cc66cc;"&gt;12&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# right aligned currency with two decimal places&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;|{0,-22:n2}|&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #cc66cc;"&gt;13&lt;/span&gt;/&lt;span style="color: #cc66cc;"&gt;57&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# left aligned number with two decimal places&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:MM dd yy}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;get-&lt;span style="font-style: normal;"&gt;date&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# date, custom short format&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-weight: bold;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:MMMM yyyy}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#40;&lt;/span&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;get-&lt;span style="font-style: normal;"&gt;date&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#41;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# date, &amp;#8216;month year&amp;#8217; format&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;..&lt;span style="color: #cc66cc;"&gt;15&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;{0:0##}&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #660033; font-weight: bold;"&gt;$_&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# filled number format&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;..&lt;span style="color: #cc66cc;"&gt;15&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;|{0,33}|&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Number $_&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# right aligned string&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;..&lt;span style="color: #cc66cc;"&gt;15&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;|{0,-33}|&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Number $_&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# left aligned string&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"&gt;
&lt;div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"&gt;&lt;span style="color: #cc66cc;"&gt;0&lt;/span&gt;..&lt;span style="color: #cc66cc;"&gt;15&lt;/span&gt; | &lt;span style="color: #666699; font-weight: bold;"&gt;%&lt;/span&gt; &lt;span style="color: #333;"&gt;&amp;#123;&lt;/span&gt;&lt;span style="color: #009900;"&gt;&amp;quot;|{0,33}|&amp;nbsp; |{0,-33}|&amp;quot;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-f&lt;/span&gt; &lt;span style="color: #009900;"&gt;&amp;quot;Number $_&amp;quot;&lt;/span&gt;&lt;span style="color: #333;"&gt;&amp;#125;&lt;/span&gt; &lt;span style="color: #458B74; font-style: italic;"&gt;# right &amp;amp; left aligned string&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Suggested Reading.&lt;/p&gt;
&lt;p&gt;Standard Numeric Format Strings&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Custom Numeric Format Strings&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Standard DateTime Format Strings&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/az4se3k1.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/az4se3k1.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Custom DateTime Format Strings&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Enumeration Format Strings&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/c3s1ez6e.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/c3s1ez6e.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Check out this blog from the PowerShell Team&lt;br /&gt;&lt;a href="http://blogs.msdn.com/powershell/archive/2006/06/16/634575.aspx" target="_blank"&gt;http://blogs.msdn.com/powershell/archive/2006/06/16/634575.aspx&lt;/a&gt;
&lt;/p&gt;
</description><pubDate>Tue, 28 Aug 2007 02:22:26 GMT</pubDate><guid isPermaLink="false">http://bsonposh.com/modules/wordpress/?p=35</guid><comments>http://bsonposh.com/modules/wordpress/?p=35#comments</comments><author>Brandon</author><source url="http://bsonposh.com/modules/wordpress/?feed=rss2">BSonPoSH</source><ng:postId>3354774934</ng:postId><ng:feedId>1191563</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Update to GPMC Cmdlets!</title><link>http://sdmsoftware.com/blog/2008/02/update_to_gpmc_cmdlets.html</link><description>&lt;p&gt;Well, we've updated our free &lt;a href="http://www.sdmsoftware.com/freeware.php" target="_blank"&gt;SDM Software GPMC PowerShell cmdlets&lt;/a&gt;&amp;nbsp;(registration optional)! We are now up to 16 cmdlets! Cool. Here's what we've added:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Added the &amp;ndash;DomainName parameter to all cmdlets as appropriate to allow you to perform operations against domains other than the one the cmdlets run in&lt;/li&gt;&lt;li&gt;Added &amp;nbsp;4 new cmdlets, including:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;ul&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Import-SDMgpo&lt;/strong&gt;: provides support for the GPMC Import function that allows you to import a GPMC backup into a GPO. This is often used for migration of GPOs from test to production domains/forests.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Get-SDMSOMSecurity&lt;/strong&gt;: provides a list of GP-related permissions on a given SOM (Scope of Management, i.e. site, domain or OU)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Add-SDMSOMSecurity&lt;/strong&gt;: lets you add GP-related permissions (e.g. create GPO, link GPO, RSOP logging and planning) to a given SOM&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Remove-SDMSOMSecurity&lt;/strong&gt;: lets you remove GP-related permissions from a given SOM&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;p&gt;If you installed the 1.0 version, just uninstall that and install this new setup.&amp;nbsp; Note that the snap-in name has changed to &lt;strong&gt;SDMSoftware.PowerShell.GPMC&lt;/strong&gt;. &amp;nbsp;&lt;/p&gt;&lt;p&gt;To get a full list of the GPMC&amp;nbsp;cmdlets, type this at a PowerShell command prompt:&lt;/p&gt;&lt;p&gt;&lt;em&gt;get-command *sdm* -type cmdlet&lt;/em&gt;&lt;/p&gt;&lt;p&gt;All the cmdlets also include help, so just use &lt;em&gt;get-help &amp;lt;cmdlet name&amp;gt;&lt;/em&gt;&amp;nbsp;to find out the correct syntax.&lt;/p&gt;&lt;p&gt;Check it out and let me know what you think.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Tags:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.technorati.com/tags/PowerShell" target="_blank"&gt;PowerShell&lt;/a&gt;, &lt;a href="http://www.technorati.com/tags/Group+Policy" target="_blank"&gt;Group Policy&lt;/a&gt;, &lt;a href="http://www.technorati.com/tags/SDM+Software" target="_blank"&gt;SDM Software&lt;/a&gt;, &lt;a href="http://www.technorati.com/tags/GPMC" target="_blank"&gt;GPMC&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description><pubDate>Fri, 08 Feb 2008 21:58:35 GMT</pubDate><guid isPermaLink="false">tag:sdmsoftware.com,2008:/blog//1.50</guid><author>gpoguy</author><source url="http://sdmsoftware.com/blog/atom.xml">The GPOGUY-- Group Policy Blog</source><ng:postId>4330683732</ng:postId><ng:feedId>1339088</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>DevConnections - PowerShell for SharePoint Developers</title><link>http://www.justaddcode.com/blog/2007/11/12/devconnections-powershell-for-sharepoint-developers/</link><description>&lt;p&gt;My final presentation at SharePoint Connections was the one I&amp;#8217;d been looking forward to the most.&amp;nbsp; I&amp;#8217;m a big fan of using PowerShell and SharePoint together, it was great to show a crowd some of the thing they could do.&amp;nbsp; I&amp;#8217;d done a couple hour PowerShell presentations (that always seemed to run long) before, but never with SharePoint.&amp;nbsp; The challenge this time was to do them both together&amp;#8230;in an hour.&amp;nbsp; I was able to get through everything I&amp;#8217;d planned and now I have some more detailed content that didn&amp;#8217;t fit into the presentation that I can put into some future posts. &lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.justaddcode.com/devconnections08/Iversen_SharePoint_314_PowerShellForSharePointDevelopers.ppt"&gt;deck&lt;/a&gt; is now uploaded, and as promised, you didn&amp;#8217;t miss out if you couldn&amp;#8217;t write down all my commands.&amp;nbsp; Nearly all of the commands are &lt;a href="http://www.justaddcode.com/devconnections08/PowerShellCommands.txt"&gt;here&lt;/a&gt;, incorrect statements and all.&amp;nbsp; I also have my &lt;a href="http://www.justaddcode.com/devconnections08/DemoProfile.txt"&gt;profile&lt;/a&gt;, so you can see how I cheated in my other presentations.&lt;/p&gt;
&lt;p&gt;I also made a basic PowerShell Types (ps1xml) file to demonstrate the how to extend familiar types to make them easier to work with.&amp;nbsp; You can grab the &lt;a href="http://www.justaddcode.com/devconnections08/JustAddCode.Types.ps1xml.txt"&gt;file&lt;/a&gt; and use it in your own development environment, though I probably wouldn&amp;#8217;t rely on it in production quite yet.&amp;nbsp; Remember to get it started you need to:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="posh"&gt;&lt;span style="color: #0066cc; font-style: italic;"&gt;Update-&lt;span style="font-style: normal;"&gt;TypeData&lt;/span&gt;&lt;/span&gt; &lt;span style="color: #000066;"&gt;-prepend&lt;/span&gt; JustAddCode.&lt;span style="color: #003366;"&gt;Types&lt;/span&gt;.&lt;span style="color: #003366;"&gt;ps1xml&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/p&gt;
</description><pubDate>Tue, 13 Nov 2007 05:36:22 GMT</pubDate><guid isPermaLink="false">http://www.justaddcode.com/blog/2007/11/12/devconnections-powershell-for-sharepoint-developers/</guid><comments>http://www.justaddcode.com/blog/2007/11/12/devconnections-powershell-for-sharepoint-developers/#comments</comments><author>neil</author><source url="http://www.justaddcode.com/blog/feed/">Just Add Code</source><ng:postId>4338103189</ng:postId><ng:feedId>2250618</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Virtual machine copying with PowerShell</title><link>http://www.justaddcode.com/blog/2007/02/19/virtual-machine-copying-with-powershell/</link><description>&lt;p&gt;Believe it or not, PowerShell is more than just fun and &lt;a TARGET="_blank" HREF="http://ps1.soapyfrog.com/2007/01/02/space-invaders/"&gt;games&lt;/a&gt;. You can even do productive things with it! A common scenario I run into is the need to create a new virtual machine. Usually I want to base it on one I’ve already created and I want it to join a domain. There are a couple issues that I run in to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; Duplicate&lt;a TARGET="_blank" HREF="http://en.wikipedia.org/wiki/Security_Identifier"&gt; SID&lt;/a&gt; Error&lt;/li&gt;
&lt;li&gt; Too many clicks&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The first problem can be solved with a free tool that Microsoft has released called &lt;a TARGET="_blank" HREF="http://www.microsoft.com/technet/sysinternals/Security/NewSid.mspx"&gt;NewSID&lt;/a&gt;. Running that will give my virtual a unique SID so that it can be added to the domain.&lt;/p&gt;
&lt;p&gt;Now for the second problem..too many clicks! Renaming a machine and adding it to the domain takes almost 2 minutes and a nearly infinite number of clicks and keystrokes…or maybe not. At any rate, it’d be great to simplify this process. Enter PowerShell.&lt;br /&gt;
Rename a Computer and Join Domain&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;pre class="php"&gt;&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt; = get-wmiobject Win32_ComputerSystem 
&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt;.&lt;span style="color: #000066;"&gt;Rename&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;“newComputerName”,”password”,”administrator”&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt; 
&lt;span style="color: #0000ff;"&gt;$comp&lt;/span&gt;.JoinDomainOrWorkGroup&lt;span style="color: #66cc66;"&gt;&amp;#40;&lt;/span&gt;“MYDOMAIN”,”domainPassword”,”MYDOMAINdomainAdmin”,&lt;span style="color: #0000ff;"&gt;$null&lt;/span&gt;,&lt;span style="color: #cc66cc;"&gt;3&lt;/span&gt;&lt;span style="color: #66cc66;"&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add a call to NewSID, wrap those delicious lines in a function and you are well on your way to renaming a virtual and joining a domain in fewer keystrokes. Its so easy you might even find yourself creating new virtuals just to run it again.&lt;/p&gt;
</description><pubDate>Tue, 20 Feb 2007 02:14:56 GMT</pubDate><guid isPermaLink="false">http://www.justaddcode.com/wordpress/2007/02/19/virtual-machine-copying-with-powershell/</guid><comments>http://www.justaddcode.com/blog/2007/02/19/virtual-machine-copying-with-powershell/#comments</comments><author>neil</author><source url="http://www.justaddcode.com/blog/feed/">Just Add Code</source><ng:postId>4338103182</ng:postId><ng:feedId>2250618</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Using Powershell to Mail-Enable an AD User without CDOEXM</title><link>http://thepowershellguy.com/blogs/gaurhoth/archive/2007/08/15/using-powershell-to-mail-enable-an-ad-user-without-cdoexm.aspx</link><description>&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;Over on microsoft.public.windows.powershell, it’s been asked how to mail-enable an AD user in an Exchange &lt;STRONG&gt;2003&lt;/STRONG&gt; Environment. The MS supported way involves CDOEXM (part of Exchange System Manager) which seems to be rather difficult to use from powershell. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;In reality, you can usually get away with using [ADSI] to modify several key attributes on the AD user and let RUS initailize the remaining attributes to create the mail-enabled user.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;FONT face=Calibri size=3&gt;Here’s the example I posted on Usenet:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt; = [ADSI]&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:navy;FONT-FAMILY:'Courier New';"&gt;"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;.mailNickname = &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:navy;FONT-FAMILY:'Courier New';"&gt;"ptest"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;.msExchHomeServerName = &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:navy;FONT-FAMILY:'Courier New';"&gt;"/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:green;FONT-FAMILY:'Courier New';"&gt;#wait for RUS - This can be seconds or hours depending on your Exchange configuration.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:green;FONT-FAMILY:'Courier New';"&gt;# To see the changes, reassign the modified AD object to $user&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt; = [ADSI]&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:navy;FONT-FAMILY:'Courier New';"&gt;"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;LINE-HEIGHT:normal;mso-layout-grid-align:none;"&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:blue;FONT-FAMILY:'Courier New';"&gt;$user&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE:9pt;COLOR:black;FONT-FAMILY:'Courier New';"&gt; | fl *&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 10pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;The minimum attributes needed for RUS are mailNickname (Exchange Alias) and msExchHomeServerName. &lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/SPAN&gt;You can see the format that msExchHomeServerName expects in the example and this will obviously be different for every exchange server. If you don’t fill in any additional attributes, the mailbox will be created in the default mail store on the server specified. If you need to point to a different mail store, you can use the &lt;B style="mso-bidi-font-weight:normal;"&gt;homeMDB&lt;/B&gt; attribute.&lt;SPAN style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/SPAN&gt;Again, the easiest way to see the expected format is to grab an already mail-enabled user and take a look at the attributes:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;PRE style="FONT:9pt courier new;COLOR:#eeedf0;BACKGROUND-COLOR:#012456;"&gt;PS C:\&amp;gt; $user = [ADSI]"LDAP://CN=Powershell Test,OU=Standard Users,OU=Site1,DC=testlab,DC=com"                          
PS C:\&amp;gt; $user | format-list cn,mailNickname,msExchHomeServerName,homeMDB,homeMTA,proxyAddresses                         
                                                                                                                        
                                                                                                                        
cn                   : {Powershell Test}                                                                                
mailNickname         : {ptest}                                                                                          
msExchHomeServerName : {/o=testlab/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=SITE1-03EX1}            
homeMDB              : {CN=Mailbox Store (SITE1-03EX1),CN=First Storage Group,CN=InformationStore,CN=SITE1-03EX1,CN=Ser 
                       vers,CN=First Administrative Group,CN=Administrative Groups,CN=testlab,CN=Microsoft Exchange,CN= 
                       Services,CN=Configuration,DC=testlab,DC=com}                                                     
homeMTA              : {CN=Microsoft MTA,CN=SITE1-03EX1,CN=Servers,CN=First Administrative Group,CN=Administrative Grou 
                       ps,CN=testlab,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testlab,DC=com}              
proxyAddresses       : {SMTP:ptest@testlab.com, X400:c=US;a= ;p=testlab;o=Exchange;s=Test;g=Powershell;}                
                                                                                                                        
                                                                                                                        
                                                                                                                        

&lt;/PRE&gt;&lt;/o:p&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;FONT face=Calibri size=3&gt;After you assign the necessary attributes and issue the .setInfo() method, you just have to wait for RUS to do it’s magic. This can take seconds or much longer. It just depends on how the Exchange environment is configured.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;B style="mso-bidi-font-weight:normal;"&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE:14pt;LINE-HEIGHT:115%;"&gt;&lt;FONT face=Calibri&gt;As with anything that directly modifies AD attributes… TEST, TEST and TEST some more in a LAB. Never start in a production environment.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;gaurhoth&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN:0in 0in 0pt;"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;* Edited to reflect that this article is about Exchange &lt;STRONG&gt;2003.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://thepowershellguy.com/aggbug.aspx?PostID=6532" width="1" height="1"&gt;</description><pubDate>Thu, 16 Aug 2007 00:39:00 GMT</pubDate><guid isPermaLink="false">http://thepowershellguy.com/blogs/gaurhoth/archive/2007/08/15/using-powershell-to-mail-enable-an-ad-user-without-cdoexm.aspx</guid><author>Gaurhoth</author><source url="http://thepowershellguy.com/blogs/gaurhoth/atom.aspx">new-blogentry -topic Powershell</source><ng:postId>3264366167</ng:postId><ng:feedId>1619080</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Table/Collection lookup with PowerShell</title><link>http://feeds.msgoodies.com/~r/blogspot/msgoodies/~3/226690093/tablecollection-lookup-with-powershell.html</link><description>&lt;p&gt;If you have to lookup data in a collection repeatedly, that can be quite slow. &lt;/p&gt;  &lt;p&gt;Let us say you have two collections and want to update one collection based on some criteria from the other. You can do it like this - &lt;/p&gt;  &lt;pre&gt;&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$collB&lt;/span&gt; | ? { &lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.key -eq &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.key} | % { &lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.value=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.value } } &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;But in this scenario, you have to iterate $collB for each of the value in $collA. This is not efficient, especially not when you have plus 50.000 elements in both collections. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;As a way to speed things up, you can build a lookup table. Note that this only works, if the key is unique in $collB. The best choice for this is an hash table. You create it like this - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #35687d"&gt;$collB&lt;/span&gt; | % {&lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;=@{}} {&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.key; &lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;.&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now you can use the hash in your code&amp;#160; -&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.key; &lt;span style="color: #35687d"&gt;$objB&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;.&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$objB&lt;/span&gt;.value=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.value }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The traversal of $collB is replaced by a much faster hash table lookup. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you only need to know whether the value is in $collB, just do like this - &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.key; &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;.&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;) { &amp;quot;found&amp;quot; } }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;I did a performance comparison (with only 500 items) so you can see the difference -&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: green"&gt;# Build two collections&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: green"&gt;&lt;/span&gt;&lt;span style="color: maroon"&gt;1&lt;/span&gt;.&lt;span style="color: maroon"&gt;.500&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$collA&lt;/span&gt;=@(); &lt;span style="color: #35687d"&gt;$collB&lt;/span&gt;=@() } {&lt;br /&gt;	&lt;span style="color: #35687d"&gt;$c&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;&lt;br /&gt;	&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt;+=&lt;span style="color: maroon"&gt;&amp;quot;&amp;quot;&lt;/span&gt; | &lt;span style="color: #2b91af"&gt;select&lt;/span&gt; @{n=&lt;span style="color: maroon"&gt;&amp;quot;Key&amp;quot;&lt;/span&gt;;e={&lt;span style="color: #35687d"&gt;$c&lt;/span&gt;}},@{n=&lt;span style="color: maroon"&gt;&amp;quot;Blah&amp;quot;&lt;/span&gt;;e={&lt;span style="color: #35687d"&gt;$c&lt;/span&gt;+&lt;span style="color: maroon"&gt;100000&lt;/span&gt;}}; &lt;br /&gt;	&lt;span style="color: #35687d"&gt;$collB&lt;/span&gt;+=&lt;span style="color: maroon"&gt;&amp;quot;&amp;quot;&lt;/span&gt; | &lt;span style="color: #2b91af"&gt;select&lt;/span&gt; @{n=&lt;span style="color: maroon"&gt;&amp;quot;Key&amp;quot;&lt;/span&gt;;e={&lt;span style="color: #35687d"&gt;$c&lt;/span&gt;}},@{n=&lt;span style="color: maroon"&gt;&amp;quot;Blah2&amp;quot;&lt;/span&gt;;e={&lt;span style="color: #35687d"&gt;$c&lt;/span&gt;+&lt;span style="color: maroon"&gt;200000&lt;/span&gt;}};&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green"&gt;# Run 'normal' lookup&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: green"&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;measure-command&lt;/span&gt; {&lt;br /&gt;	&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$collB&lt;/span&gt; | ? { &lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.key -eq &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.key} | % { &lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.blah2=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.blah+&lt;span style="color: maroon"&gt;100000&lt;/span&gt; } }&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: green"&gt;# It took 27,3 seconds&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green"&gt;# Build hash and run hash lookup&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: green"&gt;&lt;/span&gt;&lt;span style="color: #2b91af"&gt;measure-command&lt;/span&gt; {&lt;br /&gt;	&lt;span style="color: #35687d"&gt;$collB&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;=@{} } { &lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;.key; &lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;.&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_ &lt;/span&gt;}&lt;br /&gt;	&lt;span style="color: #35687d"&gt;$collA&lt;/span&gt; | % { &lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$_&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$key&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.key; &lt;span style="color: #35687d"&gt;$objB&lt;/span&gt;=&lt;span style="color: #35687d"&gt;$hashB&lt;/span&gt;.&lt;span style="color: #35687d"&gt;$key&lt;/span&gt;; &lt;span style="color: #35687d"&gt;$objB&lt;/span&gt;.blah2=&lt;span style="color: #35687d"&gt;$itemA&lt;/span&gt;.blah+&lt;span style="color: maroon"&gt;200000&lt;/span&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green"&gt;# It took 0,1 seconds&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Do I need to say more?&lt;/p&gt;  &lt;div class="feedflare"&gt;
&lt;a href="http://feeds.msgoodies.com/~f/blogspot/msgoodies?a=rDvXnvD"&gt;&lt;img src="http://feeds.msgoodies.com/~f/blogspot/msgoodies?i=rDvXnvD" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.msgoodies.com/~f/blogspot/msgoodies?a=vka8kYd"&gt;&lt;img src="http://feeds.msgoodies.com/~f/blogspot/msgoodies?i=vka8kYd" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.msgoodies.com/~f/blogspot/msgoodies?a=PucueOd"&gt;&lt;img src="http://feeds.msgoodies.com/~f/blogspot/msgoodies?i=PucueOd" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.msgoodies.com/~r/blogspot/msgoodies/~4/226690093" height="1" width="1"/&gt;</description><pubDate>Thu, 31 Jan 2008 17:59:00 GMT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-8600848.post-5152883800464832894</guid><author>Per Østergaard</author><source url="http://msgoodies.blogspot.com/2008/01/tablecollection-lookup-with-powershell.html">msgoodies</source><ng:postId>4277091206</ng:postId><ng:feedId>1229600</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>32-bit or 64-bit - What Is My Processor?</title><link>http://theessentialexchange.com/blogs/michael/archive/2008/01/21/32_2D00_bit-or-64_2D00_bit.aspx</link><description> Almost everything you can buy in the server market these days is 64-bit capable - whether AMD or Intel. Almost.  Much of what you buy in the desktop market is 64-bit capable - whether AMD or Intel. Much.  Why do you care? Exchange Server 2007 is only supported in production on 64-bit servers running 64-bit versions of Windows Server 2003 (and soon Windows Server 2008). However, 32-bit versions of Windows Server 2003 can also be installed on 64-bit hardware. And that doesn't count! You need a 64</description><pubDate>Tue, 22 Jan 2008 01:13:00 GMT</pubDate><guid isPermaLink="false">http://theessentialexchange.com/blogs/michael/archive/2008/01/21/32_2D00_bit-or-64_2D00_bit.aspx</guid><comments>http://technorati.com/search/theessentialexchange.com/blogs/michael/archive/2008/01/21/32_2D00_bit-or-64_2D00_bit.aspx</comments><source url="http://feeds.technorati.com/feed/posts/tag/powershell">[Technorati] Tag results for powershell</source><ng:postId>4214062309</ng:postId><ng:feedId>645555</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell Tip of the Week: Using the Switch Statement</title><link>http://www.microsoft.com/technet/scriptcenter/resources/pstips/jan08/pstip0111.mspx</link><description>Believe it or not, the switch statement is known as one of the most useful statements in Windows PowerShell. Find out why this week.</description><pubDate>Fri, 11 Jan 2008 07:00:00 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/560050/4154724784</guid><source url="http://www.microsoft.com/technet/scriptcenter/whatsnew.xml">New Additions to the TechNet Script Center</source><ng:postId>4154724784</ng:postId><ng:feedId>560050</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>AD Group Membership Management « Dmitry’s PowerBlog: PowerShell and beyond</title><link>http://dmitrysotnikov.wordpress.com/2007/10/19/ad-group-membership-management/</link><description /><pubDate>Thu, 27 Dec 2007 06:46:36 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/4079712612</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>4079712612</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Auditing Services Running as Service Accounts</title><link>http://merddyin.spaces.live.com/Blog/cns!BDFB49CC3E93F6AE!140.entry</link><description>&lt;p&gt;So I recently had a need to locate any services on any system in a domain that was running under the context of a service account. Sure I could have used any number of auditing tools or any of a number of other methods…but where would be the sport in that? I wanted to use PowerShell to do it. 
&lt;p&gt;Now I could have been extremely simple with this script by just feeding it a text file and using Foreach-Object to run Get-WMIObject on each item and then pipe that through a Where-Object to filter and finally, dump it to Export-CSV to get my output…except that, like far too many companies today, this client had a fairly large number of defunct computer accounts and no accurate lists of system names which would have likely resulted in incomplete data and a lengthy runtime. Because of this, I needed to do a bit more pre-processing.
&lt;p&gt;Enter the script I put together for this purpose (shown below). It requires the PowerShell Community Extensions (PSCX) to function properly as I use the Directory Services provider to get the computer names. Don't worry, it's completely free and you can get it &lt;a href="http://www.codeplex.com/PowerShellCX/Release/ProjectReleases.aspx"&gt;here.&lt;/a&gt; The script gets the netbios domain name from the system on which it is running and uses the provider to find ALL computers in the domain. To deal with the dead and no access systems, I run each computer name through a ping check and record the results as to whether or not the check was successful or if the script couldn't even resolve the name (&lt;em&gt;Note: The ping check is performed via the ping-host cmdlet which is also part of PSCX…two tools at once!! What can I say, I'm a giver). &lt;/em&gt;If the ping works, the script attempts to connect via WMI and retrieve a filtered list of services that have domain\username or computername\username&lt;em&gt;
		&lt;/em&gt;as the account context under which they are running. All of the output is sent to Excel and formatted all pretty for you to do with as you will. Unfortunately, there was one minor lazy moment that made me leave something out…I don't have any error checking on the WMI connection. I should have, but I didn't…but anyone reading this is more than welcome to correct my oversight. In fact, all improvements are welcome and all I ask in return is that you shoot me a copy.
&lt;p&gt;Anyway, I hope someone will find this useful…enjoy!
&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$erroractionpreference = &amp;quot;SilentlyContinue&amp;quot;
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$strDom = $env:userdomain 
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$strDomain = $strDom + &amp;quot;:\&amp;quot;
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$objExcel = New-Object -comobject Excel.Application
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objExcel.visible = $True 
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWB = $objExcel.Workbooks.Add()
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS = $objWB.Worksheets.Item(1)
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,1) = &amp;quot;System&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,2) = &amp;quot;Ping Status&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,3) = &amp;quot;Service Name&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,4) = &amp;quot;Account&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,5) = &amp;quot;Startup&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objWS.Cells.Item(1,6) = &amp;quot;Status&amp;quot;
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$objRange = $objWS.UsedRange
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objRange.Interior.ColorIndex = 19
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objRange.Font.ColorIndex = 11
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objRange.Font.Bold = $True
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;$Script:intRow = 2
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;# Query AD for objects of type 'computer' and store in variable
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$arrComputers = Get-ChildItem $strDomain -recurse | Where-Object { $_.Type -like &amp;quot;computer&amp;quot; } | Select-Object Name
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;foreach ($objComputer in $arrComputers)
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;{
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;Function GetSvcInfo
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;{
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    Param([string] $strComputer)
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;    # Set variables for use as WMI query string
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    $strQuery = ('Select * from Win32_Service where StartName LIKE &amp;quot;%' + $strDom + '%&amp;quot; OR StartName LIKE &amp;quot;%' + $strComputer + '%&amp;quot;')
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    # Connect to computer with WMI and get filtered service info
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    $objWMI = Get-WmiObject -q $strQuery -computer $strComputer
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;    # Check to see if $objWMI has any data and record results as appropriate
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    If($objWMI -eq $NULL)
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,3) = &amp;quot;N/A&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $Script:intRow = $intRow + 1
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        }
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    Else
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            foreach($objSvc in $objWMI)
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;                $objWS.Cells.Item($intRow,3) = $objSVC.Name
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;                $objWS.Cells.Item($intRow,4) = $objSVC.StartName
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;                $objWS.Cells.Item($intRow,5) = $objSVC.StartMode
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;                $objWS.Cells.Item($intRow,6) = $objSVC.State
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;                $Script:intRow = $intRow + 1
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            }
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        }
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;}
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;    $results = ping-host $objComputer.Name -count 1 -q
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;    If($results.Received -eq &amp;quot;1&amp;quot;)
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $strComputer = $objComputer.Name
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,1) = $objComputer.Name
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,2) = &amp;quot;Online&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            GetSvcInfo $strComputer
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        } 
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        ElseIf($results.Received -eq &amp;quot;0&amp;quot;)
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,1) = $objComputer.Name
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,2) = &amp;quot;Offline&amp;quot;
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $intRow = $intRow + 1
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        }
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        Else
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        {
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,1) = $objComputer.Name
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $objWS.Cells.Item($intRow,2) = &amp;quot;Cannot Resolve&amp;quot;        
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;            $intRow = $intRow + 1
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;        }
&lt;/span&gt;&lt;p&gt;
 &lt;p&gt;&lt;span style="font-size:8pt"&gt;}
&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:8pt"&gt;$objRange.EntireColumn.AutoFit()&lt;/span&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=-4757127439814756690&amp;page=RSS%3a+Auditing+Services+Running+as+Service+Accounts&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=merddyin.spaces.live.com&amp;amp;GT1=merddyin"&gt;</description><pubDate>Fri, 05 Oct 2007 17:19:36 GMT</pubDate><guid isPermaLink="false">http://merddyin.spaces.live.com/Blog/cns!BDFB49CC3E93F6AE!140.entry</guid><comments>http://merddyin.spaces.live.com/Blog/cns!BDFB49CC3E93F6AE!140.entry#comment</comments><source url="http://cid-bdfb49cc3e93f6ae.users.api.live.net/Users(-4757127439814756690)/Blogs('BDFB49CC3E93F6AE!103')/Categories('PowerShell')/Entries?$format=rss20">Chris Whitfield's space: PowerShell</source><ng:postId>3609999260</ng:postId><ng:feedId>1590239</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows PowerShell Tip of the Week: Running Windows PowerShell Scripts Against Multiple Computers</title><link>http://www.microsoft.com/technet/scriptcenter/resources/pstips/oct07/pstip1012.mspx</link><description>Learn several different ways to read computer names into a script and run the script against those computers.</description><pubDate>Fri, 12 Oct 2007 06:00:00 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/560050/3663416921</guid><source url="http://www.microsoft.com/technet/scriptcenter/whatsnew.xml">New Additions to the TechNet Script Center</source><ng:postId>3663416921</ng:postId><ng:feedId>560050</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Essential PowerShell: Learn how to find what you are looking for</title><link>http://poshoholic.com/2007/10/25/essential-powershell-learn-how-to-find-what-you-are-looking-for/</link><description>&lt;div class='snap_preview'&gt;&lt;p&gt;As silly as this may sound, learning how to find what you&amp;#8217;re looking for in PowerShell is key if you want to learn PowerShell quickly and easily.  PowerShell is a rather unique language in that most of the information you will need to use the language is retrievable by using the language itself.  The problem for newcomers to PowerShell who like to dive right in when learning something and who don&amp;#8217;t want to read through lots of documentation to get started is that they need to know some PowerShell to learn more about PowerShell and what it can do.&lt;/p&gt;
&lt;p&gt;When I first started learning PowerShell I was fortunate to be able to see PowerShell presented twice, both times by Jeffrey Snover, the &amp;#8220;father&amp;#8221; of PowerShell.  In both presentations as he wrapped things up he mentioned that if there&amp;#8217;s one thing you should make sure that you take with you about PowerShell it&amp;#8217;s a set of five cmdlets that are key to learning more about PowerShell.  They are (in no particular order): Get-Help, Get-Command, Get-Member, Get-PSDrive and Get-Alias.&lt;/p&gt;
&lt;p&gt;Rather than pulling the documentation about these cmdlets into this article, I thought it would be more useful to follow the &lt;a href="http://en.wikipedia.org/wiki/KISS_principle" title="KISS Principle"&gt;KISS principle&lt;/a&gt; and list a series of questions you might ask yourself about PowerShell accompanied with the PowerShell script (mostly one-liners) that can be used to answer those very questions primarily using the cmdlets I mentioned above.  Here are the questions and their answers to help get you started.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve heard PowerShell cmdlets all follow a verb-noun syntax.  What verbs are available in PowerShell?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Command&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-CommandType&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; Cmdlet | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Group-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Property&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; Verb &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-NoElement&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What cmdlets use the verb &amp;#8220;out&amp;#8221;?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Command&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Verb&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; Out&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What cmdlets use the noun &amp;#8220;command&amp;#8221;?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Command&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Noun&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; Command&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What examples are available for the Tee-Object cmdlet?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Tee-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-examples&lt;/font&gt;&lt;/em&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What is the full help information for Tee-Object?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;&lt;strong&gt;Get-Help&lt;/strong&gt;&lt;font size="2" color="#000000" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;&lt;strong&gt;Tee-Object&lt;/strong&gt;&lt;/font&gt;&lt;font size="2" color="#000000" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Full&lt;/font&gt;&lt;/em&gt;&lt;font size="2" color="#000000" face="Courier New"&gt; | &lt;/font&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;&lt;strong&gt;Out-Host&lt;/strong&gt;&lt;/font&gt;&lt;font size="2" color="#000000" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Paging&lt;br /&gt;
&lt;/font&gt;&lt;/em&gt;&lt;font size="2" color="#008000" face="Courier New"&gt;&lt;strong&gt;# Note: I could have replaced &amp;#8220;Out-Host -Paging&amp;#8221; with &amp;#8220;more&amp;#8221; and the result would have been the same&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What are the non-common parameters of Set-Location (with their documentation)?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Set-Location&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Parameter&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; *&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What cmdlets have a parameter like &amp;#8220;path&amp;#8221;?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; * &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Parameter&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; *path* | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Sort-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Property&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; Name&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What general PowerShell help topics are available?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Category&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; HelpFile,Provider&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I need general help on operators.  Where can I find that information?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Category&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; HelpFile,Provider | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Where-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; { (&lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#000080" face="Courier New"&gt;$_&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;.Name | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Out-String&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt;).Contains(&lt;/font&gt;&lt;font size="2" color="#800000" face="Courier New"&gt;&amp;#8220;operator&amp;#8221;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;) }&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Now that I see the help topics and providers that reference the keyword &amp;#8220;operator&amp;#8221;, how do I see the details?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;font size="2" face="Courier New"&gt; about_operator&lt;br /&gt;
&lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Help&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; Variable&lt;br /&gt;
&lt;/font&gt;&lt;font size="2" color="#008000" face="Courier New"&gt;# etc.&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;What aliases are defined for the ForEach-Object cmdlet?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Alias&lt;font size="2" face="Courier New"&gt; | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Where-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; {&lt;/font&gt;&lt;font size="2" color="#000080" face="Courier New"&gt;$_&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;.Definition &lt;/font&gt;&lt;font size="2" color="#ff0000" face="Courier New"&gt;-eq&lt;/font&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#800000" face="Courier New"&gt;&amp;#8220;ForEach-Object&amp;#8221;&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;#8217;ve heard PowerShell even treats the registry as a drive.  What other drives are there?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-PSDrive&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;How do I start browsing the Registry in PowerShell?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Set-Location&lt;font size="2" face="Courier New"&gt; HKLM: &lt;/font&gt;&lt;font size="2" color="#008000" face="Courier New"&gt;# or cd HKLM:&lt;br /&gt;
&lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-ChildItem&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#008000" face="Courier New"&gt;# or dir&lt;br /&gt;
&lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Set-Location&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; Software &lt;/font&gt;&lt;font size="2" color="#008000" face="Courier New"&gt;# or cd Software&lt;br /&gt;
# etc.&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I noticed that there is a drive for environment variables.  How do I use that to check the value of my Path environment variable?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;font size="2" face="Courier New"&gt;(&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Item&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; env:Path).Value&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;How do I add all of my installed PowerShell snapins to the current session so that I can use their cmdlets too?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-PSSnapin&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-Registered&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;ForEach-Object&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; { &lt;/font&gt;&lt;font size="2" color="#0000ff" face="Courier New"&gt;if&lt;/font&gt;&lt;font size="2" face="Courier New"&gt; ((&lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-PSSnapin&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#000080" face="Courier New"&gt;$_&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;.Name &lt;/font&gt;&lt;em&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;-ErrorAction&lt;/font&gt;&lt;/em&gt;&lt;font size="2" face="Courier New"&gt; SilentlyContinue) &lt;/font&gt;&lt;font size="2" color="#ff0000" face="Courier New"&gt;-eq&lt;/font&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#800080" face="Courier New"&gt;$null&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;) { &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Add-PSSnapin&lt;/font&gt;&lt;/strong&gt;&lt;font size="2" face="Courier New"&gt; &lt;/font&gt;&lt;font size="2" color="#000080" face="Courier New"&gt;$_&lt;/font&gt;&lt;font size="2" face="Courier New"&gt;.Name } }&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;(Note: More useful one-liners using Get-PSSnapin can be found &lt;a href="http://poshoholic.com/2007/10/01/get-pssnapin-one-liners/" title="Get-PSSnapin one-liners"&gt;here&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;I need to enumerate a bunch of services and then do other things.  Since these are enumerated as objects, how can I tell what I can do with them (i.e. how can I tell what properties and methods they have)?&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Service&lt;font size="2" face="Courier New"&gt; | &lt;/font&gt;&lt;strong&gt;&lt;font size="2" color="#5f9ea0" face="Courier New"&gt;Get-Member&lt;/font&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Are there other basic questions that you think should be on this list?  After learning how to find the information you need within PowerShell, what has been your biggest stumbling block?  Let me know in the comments!&lt;/p&gt;
&lt;p&gt;Kirk out.&lt;/p&gt;
&lt;p&gt;&lt;span class="technoratitag"&gt;Technorati Tags: &lt;a rel="tag" target="_blank" href="http://www.technorati.com/tag/PowerShell" title="Link to Technorati Tag category for PowerShell"&gt;PowerShell&lt;/a&gt;, &lt;a rel="tag" target="_blank" href="http://www.technorati.com/tag/PoSh" title="Link to Technorati Tag category for PoSh"&gt;PoSh&lt;/a&gt;, &lt;a rel="tag" target="_blank" href="http://www.technorati.com/tag/Poshoholic" title="Link to Technorati Tag category for Poshoholic"&gt;Poshoholic&lt;/a&gt;, &lt;a rel="tag" target="_blank" href="http://www.technorati.com/tag/one-liner" title="Link to Technorati Tag category for one-liner"&gt;one-liner&lt;/a&gt;, &lt;a rel="tag" target="_blank" href="http://www.technorati.com/tag/oneliner" title="Link to Technorati Tag category for oneliner"&gt;oneliner&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="sociallinks"&gt;Add to: | &lt;a target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F"&gt;Technorati&lt;/a&gt; | &lt;a target="_blank" href="http://digg.com/submit?phase=2&amp;amp;url=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F"&gt;Digg&lt;/a&gt; | &lt;a target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F;title=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for"&gt;del.icio.us&lt;/a&gt; | &lt;a target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?t=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for&amp;amp;u=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F"&gt;Yahoo&lt;/a&gt; | &lt;a target="_blank" href="http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;amp;Url=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F&amp;amp;Title=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for"&gt;BlinkList&lt;/a&gt; | &lt;a target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F&amp;amp;title=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for"&gt;Spurl&lt;/a&gt; | &lt;a target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F&amp;amp;title=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for"&gt;reddit&lt;/a&gt; | &lt;a target="_blank" href="http://www.furl.net/storeIt.jsp?t=Essential%20PowerShell%3A%20Learn%20how%20to%20find%20what%20you%20are%20looking%20for&amp;amp;u=http%3A%2F%2Fposhoholic%2Ecom%2F2007%2F10%2F25%2Fessential%2Dpowershell%2Dlearn%2Dhow%2Dto%2Dfind%2Dwhat%2Dyou%2Dare%2Dlooking%2Dfor%2F"&gt;Furl&lt;/a&gt; | &lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</description><pubDate>Thu, 25 Oct 2007 13:23:07 GMT</pubDate><guid isPermaLink="false">http://poshoholic.com/2007/10/25/essential-powershell-learn-how-to-find-what-you-are-looking-for/</guid><comments>http://poshoholic.com/2007/10/25/essential-powershell-learn-how-to-find-what-you-are-looking-for/#comments</comments><author>Kirk Munro</author><source url="http://kirkmunro.wordpress.com/feed/">Poshoholic</source><ng:postId>3699883855</ng:postId><ng:feedId>1619130</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Scripting Active Directory</title><link>http://www.kenandsarah.co.uk/2007/10/03/Scripting+Active+Directory.aspx</link><description>Scripting Active Directory   I seem to have been dong a lot of scripting work recently - I really should be using PowerShell, but I had limited time to get this stuff done and it needed to pretty generic / simple as it would be implemented by others (some with limited knowledge of scripting</description><pubDate>Wed, 03 Oct 2007 21:41:30 GMT</pubDate><guid isPermaLink="false">http://www.kenandsarah.co.uk/2007/10/03/Scripting+Active+Directory.aspx</guid><comments>http://technorati.com/search/www.kenandsarah.co.uk/2007/10/03/Scripting+Active+Directory.aspx</comments><source url="http://www.kenandsarah.co.uk/2007/10/03/Scripting+Active+Directory.aspx" /><ng:postId>3599253215</ng:postId><ng:feedId>1304192</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>/\/\o\/\/ PowerShelled: PowerShell : Learn about the HashTable Object and other Collections</title><link>http://mow001.blogspot.com/2006/09/powershell-learn-about-hashtable_07.html</link><description /><pubDate>Fri, 24 Aug 2007 06:27:33 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/3327795396</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>3327795396</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>RegExLib.com Regular Expression Cheat Sheet (.NET Framework)</title><link>http://regexlib.com/CheatSheet.aspx</link><description>    &lt;span&gt;
        &lt;a href="http://del.icio.us/post?url=http%3A%2F%2Fregexlib.com%2FCheatSheet.aspx&amp;amp;title=RegExLib.com%20Regular%20Expression%20Cheat%20Sheet%20%28.NET%20Framework%29&amp;amp;copyuser=jjh&amp;amp;copytags=cheatsheet%2Bdevelopment%2Bprogramming%2Bregularexpressions%2Bregexp&amp;amp;jump=yes&amp;amp;partner=delrss&amp;amp;src=feed_newsgator" rel="nofollow" title="add this bookmark to your collection at del.icio.us"&gt;&lt;img src="http://images.del.icio.us/static/img/delicious.small.gif" alt="del.icio.us" width="10" height="10" border="0" /&gt;&amp;nbsp;bookmark&amp;nbsp;this&amp;nbsp;on&amp;nbsp;del.icio.us&lt;/a&gt;
        -
        posted 
        by &lt;a title="visit jjh's bookmarks at del.icio.us" href="http://del.icio.us/jjh"&gt;jjh&lt;/a&gt;
        to
            &lt;a rel="tag" title="view all bookmarks tagged 'cheatsheet' at del.icio.us" href="http://del.icio.us/tag/cheatsheet"&gt;cheatsheet&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'development' at del.icio.us" href="http://del.icio.us/tag/development"&gt;development&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'programming' at del.icio.us" href="http://del.icio.us/tag/programming"&gt;programming&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'regularexpressions' at del.icio.us" href="http://del.icio.us/tag/regularexpressions"&gt;regularexpressions&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'regexp' at del.icio.us" href="http://del.icio.us/tag/regexp"&gt;regexp&lt;/a&gt;
            - &lt;a rel="self" title="view more details on this bookmark at del.icio.us" href="http://del.icio.us/url/8eab1099cb0eb0958761634a0dea6fa9"&gt;more&amp;nbsp;about&amp;nbsp;this&amp;nbsp;bookmark...&lt;/a&gt;
    &lt;/span&gt;
</description><pubDate>Fri, 24 Aug 2007 06:09:24 GMT</pubDate><guid isPermaLink="false">http://regexlib.com/CheatSheet.aspx</guid><author>jjh</author><source url="http://feeds.delicious.com/rss/tag/development">Delicious/tag/development</source><ng:postId>3325620835</ng:postId><ng:feedId>74321</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Microsoft Command Line Standard</title><link>http://www.microsoft.com/technet/scriptcenter/topics/winpsh/cmdline_std.mspx</link><description /><pubDate>Thu, 17 May 2007 01:20:53 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2597550424</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>2597550424</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Microsoft Command Line Standard</title><link>http://www.microsoft.com/technet/scriptcenter/topics/winpsh/cmdline_std.mspx</link><description /><pubDate>Thu, 17 May 2007 01:20:53 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2597550424</guid><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2597577221</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows Administration: Simplify Group Policy Administration with Windows PowerShell -- TechNet Magazine, May 2007</title><link>http://www.microsoft.com/technet/technetmag/issues/2007/05/GroupPolicy/default.aspx</link><description>    &lt;span&gt;
        &lt;a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.microsoft.com%2Ftechnet%2Ftechnetmag%2Fissues%2F2007%2F05%2FGroupPolicy%2Fdefault.aspx&amp;amp;title=Windows%20Administration%3A%20Simplify%20Group%20Policy%20Administration%20with%20Windows%20PowerShell%20--%20TechNet%20Magazine%2C%20May%202007&amp;amp;copyuser=ironfroggy&amp;amp;copytags=toread%2Bpowershell&amp;amp;jump=yes&amp;amp;partner=delrss&amp;amp;src=feed_newsgator" rel="nofollow" title="add this bookmark to your collection at del.icio.us"&gt;&lt;img src="http://images.del.icio.us/static/img/delicious.small.gif" alt="del.icio.us" width="10" height="10" border="0" /&gt;&amp;nbsp;bookmark&amp;nbsp;this&amp;nbsp;on&amp;nbsp;del.icio.us&lt;/a&gt;
        -
        posted 
        by &lt;a title="visit ironfroggy's bookmarks at del.icio.us" href="http://del.icio.us/ironfroggy"&gt;ironfroggy&lt;/a&gt;
        to
            &lt;a rel="tag" title="view all bookmarks tagged 'toread' at del.icio.us" href="http://del.icio.us/tag/toread"&gt;toread&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'powershell' at del.icio.us" href="http://del.icio.us/tag/powershell"&gt;powershell&lt;/a&gt;
            - &lt;a rel="self" title="view more details on this bookmark at del.icio.us" href="http://del.icio.us/url/1cc515f033acb5b47de0f88b757b1f68"&gt;more&amp;nbsp;about&amp;nbsp;this&amp;nbsp;bookmark...&lt;/a&gt;
    &lt;/span&gt;
</description><pubDate>Mon, 07 May 2007 03:26:30 GMT</pubDate><guid isPermaLink="false">http://www.microsoft.com/technet/technetmag/issues/2007/05/GroupPolicy/default.aspx</guid><author>ironfroggy</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302490</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows Administration: Simplify Group Policy Administration with Windows PowerShell -- TechNet Magazine, May 2007</title><link>http://www.microsoft.com/technet/technetmag/issues/2007/05/GroupPolicy/default.aspx</link><description>    &lt;span&gt;
        &lt;a href="http://del.icio.us/post?url=http%3A%2F%2Fwww.microsoft.com%2Ftechnet%2Ftechnetmag%2Fissues%2F2007%2F05%2FGroupPolicy%2Fdefault.aspx&amp;amp;title=Windows%20Administration%3A%20Simplify%20Group%20Policy%20Administration%20with%20Windows%20PowerShell%20--%20TechNet%20Magazine%2C%20May%202007&amp;amp;copyuser=ironfroggy&amp;amp;copytags=toread%2Bpowershell&amp;amp;jump=yes&amp;amp;partner=delrss&amp;amp;src=feed_newsgator" rel="nofollow" title="add this bookmark to your collection at del.icio.us"&gt;&lt;img src="http://images.del.icio.us/static/img/delicious.small.gif" alt="del.icio.us" width="10" height="10" border="0" /&gt;&amp;nbsp;bookmark&amp;nbsp;this&amp;nbsp;on&amp;nbsp;del.icio.us&lt;/a&gt;
        -
        posted 
        by &lt;a title="visit ironfroggy's bookmarks at del.icio.us" href="http://del.icio.us/ironfroggy"&gt;ironfroggy&lt;/a&gt;
        to
            &lt;a rel="tag" title="view all bookmarks tagged 'toread' at del.icio.us" href="http://del.icio.us/tag/toread"&gt;toread&lt;/a&gt;
            &lt;a rel="tag" title="view all bookmarks tagged 'powershell' at del.icio.us" href="http://del.icio.us/tag/powershell"&gt;powershell&lt;/a&gt;
            - &lt;a rel="self" title="view more details on this bookmark at del.icio.us" href="http://del.icio.us/url/1cc515f033acb5b47de0f88b757b1f68"&gt;more&amp;nbsp;about&amp;nbsp;this&amp;nbsp;bookmark...&lt;/a&gt;
    &lt;/span&gt;
</description><pubDate>Mon, 07 May 2007 03:26:30 GMT</pubDate><guid isPermaLink="false">http://www.microsoft.com/technet/technetmag/issues/2007/05/GroupPolicy/default.aspx</guid><author>ironfroggy</author><source url="http://feeds.delicious.com/rss/tag/toread">Delicious/tag/toread</source><ng:postId>2535861152</ng:postId><ng:feedId>81266</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows Management Instrumentation Command-line</title><link>http://technet2.microsoft.com/WindowsServer/en/library/ea5d7f04-07e8-4b96-bda3-a2b2cc15391e1033.mspx?mfr=true</link><description /><pubDate>Sun, 06 May 2007 23:59:39 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536290065</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>2536290065</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Windows Management Instrumentation Command-line</title><link>http://technet2.microsoft.com/WindowsServer/en/library/ea5d7f04-07e8-4b96-bda3-a2b2cc15391e1033.mspx?mfr=true</link><description /><pubDate>Sun, 06 May 2007 23:59:39 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536290065</guid><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302478</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Command-line reference A-Z</title><link>http://technet2.microsoft.com/windowsserver/en/library/552ed70a-208d-48c4-8da8-2e27b530eac71033.mspx?mfr=true</link><description /><pubDate>Sun, 06 May 2007 23:59:01 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536286819</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>2536286819</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Command-line reference A-Z</title><link>http://technet2.microsoft.com/windowsserver/en/library/552ed70a-208d-48c4-8da8-2e27b530eac71033.mspx?mfr=true</link><description /><pubDate>Sun, 06 May 2007 23:59:01 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536286819</guid><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302458</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>John Howard : WMIC Samples</title><link>http://blogs.technet.com/jhoward/archive/2005/02/23/378726.aspx</link><description /><pubDate>Sun, 06 May 2007 23:58:15 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536282050</guid><source url="http://services.newsgator.com/urlclippedposts.aspx">URL clipped post</source><ng:postId>2536282050</ng:postId><ng:feedId>-1</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>John Howard : WMIC Samples</title><link>http://blogs.technet.com/jhoward/archive/2005/02/23/378726.aspx</link><description /><pubDate>Sun, 06 May 2007 23:58:15 GMT</pubDate><guid isPermaLink="false">tag:newsgator.com,2006:Feed.aspx/-1/2536282050</guid><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302439</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Creating an AD Shell</title><link>http://blogs.technet.com/benp/archive/2007/04/10/creating-an-ad-shell.aspx</link><description>&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Hello Again&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;This is my third post in the Active Directory and PowerShell series.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this post I want to talk about how to create your own pseudo-cmdlets to manage the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I`m going to talk about how to present scripts to PowerShell that behave in a similar way to Cmdlets, that then allow easy administration of the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You may well think I`m mad, but how cool would it be to do this in a shell:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;get-dn benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;'LDAP://CN=benp,OU=Admins,DC=umpadom,DC=com'&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;enable-user benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;User: benp enabled&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;disable-user benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;User: benp disabled&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;Set-ADProp benp GivenName Ben&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;GivenName property set for user benp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;Get-ADProp benp GivenName&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;Ben&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Wait a minute!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There is no native support for Active Directory that does this.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What magic is this!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Well in this post I`m going to show you how to create these example pseudo-cmdlets, and show you that whilst they are mighty cool, there is nothing that difficult or clever about them.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;FONT face=Calibri&gt;Creating the Pseudo-Cmdlets&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;First thing I want to be clear about is that these commands are not real Cmdlets.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They have not been added via a snapin, and do not behave in the same way as Cmdlets.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The command “get-dn” is simply a function that calls a script, and passes in some arguments.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The script then does some stuff and returns some text.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It does not return an object!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Cmdlets normally return objects – these don’t.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;However, we can use them to create a shell like interface to do common tasks.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-bidi-font-size: 11.0pt"&gt;&lt;FONT face=Calibri&gt;The Script&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Let’s take Enable-User as an example.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Probably best you read my previous 2 posts before you look at this, might make it a bit easier to understand:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to enable user&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$Error.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$ErrorActionPreference = "silentlycontinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "False")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error enabling user: " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"User: " + $Args[0] + " enabled"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Most of this code is the same as get-dn, which I explained in my previous post.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There only difference is what we do to the AD, and a bit of basic error checking.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Let’s go through what happens in the code once we have the path to the user object we want to manipulate:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "False")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;All we do is create an object with the user object path as a constructor.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Once we have this we simply set the user property AccountDisabled to be False.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Then we commit the change to the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Simple! &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;I use the invokeset method here, because it’s really easy to use.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you use the ADSI provider its actually a bit harder than the .Net Framework method.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;The error handling here is very basic.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I might write a post on error handling soon.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The basic algorithm for error handling is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Clear the $error.count&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Do Stuff&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;If the $error.count is greater than 0 (we had an error)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Output anerror message&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Else&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Output operation successful text&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;Turning the script to a Pseudo-Cmdlet&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;To make the script accessible from just typing “enable-user”, all we need to do is create a function that utilises that script.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To create a function we use the new-item Cmdlet.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here’s the code I use:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;new-item -path function:enable-user -value {&amp;amp; 'C:\scripts\enable-user.ps1' $args[0]}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;There we go. An easy way to enable user accounts.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;That function will be loaded in PowerShell until the instance of PowerShell closes.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So how can we make the function persistent?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Well there are 2 ways.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The simple way is to add this line to your profile.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The profile file can be found by typing $profile in the shell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That means that every time you load PowerShell the function will be loaded.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;However, I don’t really want that.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I want to be able to load a script with all these functions when I want to administer the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Therefore I collected all my function definitions into 1 file: ADSupport.ps1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This file contains this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:get-dn -value {&amp;amp; 'C:\scripts\getuserdn.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:get-adprop -value {&amp;amp; 'C:\scripts\get-adprop.ps1' $args[0] $args[1]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:set-adprop -value {&amp;amp; 'C:\scripts\set-adprop.ps1' $args[0] $args[1] $args[2]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:disable-user -value {&amp;amp; 'C:\scripts\disable-user.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:enable-user -value {&amp;amp; 'C:\scripts\enable-user.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Problem:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;if I run .\adsupport.ps1 it does not import these functions.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you try it you’ll find that none the functions are available.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is because by default the script is executed in a different scope.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We want it executed in the PowerShell scope and therefore we must use an extra full stop (period if you live across the atlantic).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;. .\adsupport.ps1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Now all your functions will be available to use.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;Other Scripts&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Here is the code to get all the above functions working.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Get-DN&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;See previous &lt;A class="" title=http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx href="http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx" mce_href="http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx"&gt;post&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Disable User&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to disable user&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$error.psbase.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$erroractionpreference = "silentlycontinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "True")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error disabling user: " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"User: " + $Args[0] + " disabled"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Get-ADProp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to query AD Object Properties&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM, Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$Error.psbase.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$ErrorActionPreference = "SilentlyContinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#Use the below line in the profile to assign to get-adprop&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#new-item -path function:get-adprop -value {&amp;amp; 'C:\store\ps scripts\get-adprop.ps1' $args[0] $args[1]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$username = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $username&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.Get($Args[1])&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error getting property " + $Args[1] + " for " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Set-ADProp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to set AD Object Properties&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM, Property, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#Use the below line in the profile to assign to get-adprop&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#new-item -path function:set-adprop -value {&amp;amp; 'C:\store\ps scripts\set-adprop.ps1' $args[0] $args[1] $args[2]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$username = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $username&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.put($Args[1], $Args[2])&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error setting " + $Args[1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;$Args[1] + " property set for user" + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Well ladies and gents.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Hope you enjoyed this.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Coding errors on a post card please &lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;&lt;SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;That is all&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;BenP&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=744868" width="1" height="1"&gt;</description><pubDate>Tue, 10 Apr 2007 15:28:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:744868</guid><comments>http://blogs.technet.com/benp/comments/744868.aspx</comments><author>benp</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302424</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Creating an AD Shell</title><link>http://blogs.technet.com/benp/archive/2007/04/10/creating-an-ad-shell.aspx</link><description>&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Hello Again&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;This is my third post in the Active Directory and PowerShell series.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;In this post I want to talk about how to create your own pseudo-cmdlets to manage the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;I`m going to talk about how to present scripts to PowerShell that behave in a similar way to Cmdlets, that then allow easy administration of the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You may well think I`m mad, but how cool would it be to do this in a shell:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;get-dn benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;'LDAP://CN=benp,OU=Admins,DC=umpadom,DC=com'&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;enable-user benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;User: benp enabled&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;disable-user benp&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;User: benp disabled&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;Set-ADProp benp GivenName Ben&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;GivenName property set for user benp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;PS C:\&amp;gt; &lt;B style="mso-bidi-font-weight: normal"&gt;Get-ADProp benp GivenName&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="COLOR: #943634; FONT-FAMILY: 'Courier New'; mso-themecolor: accent2; mso-themeshade: 191"&gt;&lt;FONT size=3&gt;Ben&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Wait a minute!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There is no native support for Active Directory that does this.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;What magic is this!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Well in this post I`m going to show you how to create these example pseudo-cmdlets, and show you that whilst they are mighty cool, there is nothing that difficult or clever about them.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;FONT face=Calibri&gt;Creating the Pseudo-Cmdlets&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;First thing I want to be clear about is that these commands are not real Cmdlets.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;They have not been added via a snapin, and do not behave in the same way as Cmdlets.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The command “get-dn” is simply a function that calls a script, and passes in some arguments.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The script then does some stuff and returns some text.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It does not return an object!&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Cmdlets normally return objects – these don’t.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;However, we can use them to create a shell like interface to do common tasks.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-bidi-font-size: 11.0pt"&gt;&lt;FONT face=Calibri&gt;The Script&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Let’s take Enable-User as an example.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Probably best you read my previous 2 posts before you look at this, might make it a bit easier to understand:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to enable user&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$Error.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$ErrorActionPreference = "silentlycontinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "False")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error enabling user: " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"User: " + $Args[0] + " enabled"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Most of this code is the same as get-dn, which I explained in my previous post.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;There only difference is what we do to the AD, and a bit of basic error checking.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Let’s go through what happens in the code once we have the path to the user object we want to manipulate:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "False")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;All we do is create an object with the user object path as a constructor.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Once we have this we simply set the user property AccountDisabled to be False.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Then we commit the change to the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Simple! &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;I use the invokeset method here, because it’s really easy to use.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you use the ADSI provider its actually a bit harder than the .Net Framework method.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;The error handling here is very basic.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I might write a post on error handling soon.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The basic algorithm for error handling is:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Clear the $error.count&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Do Stuff&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;If the $error.count is greater than 0 (we had an error)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Output anerror message&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Else&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Output operation successful text&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;Turning the script to a Pseudo-Cmdlet&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;To make the script accessible from just typing “enable-user”, all we need to do is create a function that utilises that script.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;To create a function we use the new-item Cmdlet.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here’s the code I use:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;new-item -path function:enable-user -value {&amp;amp; 'C:\scripts\enable-user.ps1' $args[0]}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;There we go. An easy way to enable user accounts.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;That function will be loaded in PowerShell until the instance of PowerShell closes.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;So how can we make the function persistent?&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Well there are 2 ways.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The simple way is to add this line to your profile.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The profile file can be found by typing $profile in the shell.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That means that every time you load PowerShell the function will be loaded.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;However, I don’t really want that.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;I want to be able to load a script with all these functions when I want to administer the AD.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Therefore I collected all my function definitions into 1 file: ADSupport.ps1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This file contains this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:get-dn -value {&amp;amp; 'C:\scripts\getuserdn.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:get-adprop -value {&amp;amp; 'C:\scripts\get-adprop.ps1' $args[0] $args[1]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:set-adprop -value {&amp;amp; 'C:\scripts\set-adprop.ps1' $args[0] $args[1] $args[2]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:disable-user -value {&amp;amp; 'C:\scripts\disable-user.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;new-item -path function:enable-user -value {&amp;amp; 'C:\scripts\enable-user.ps1' $args[0]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Problem:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;if I run .\adsupport.ps1 it does not import these functions.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;If you try it you’ll find that none the functions are available.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is because by default the script is executed in a different scope.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;We want it executed in the PowerShell scope and therefore we must use an extra full stop (period if you live across the atlantic).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;. .\adsupport.ps1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Now all your functions will be available to use.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 16pt; mso-bidi-font-size: 11.0pt"&gt;Other Scripts&lt;/SPAN&gt;&lt;/B&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 12pt; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;Here is the code to get all the above functions working.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Get-DN&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT face=Calibri size=3&gt;See previous &lt;A class="" title=http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx href="http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx" mce_href="http://blogs.technet.com/benp/archive/2007/03/26/searching-the-active-directory-with-powershell.aspx"&gt;post&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Disable User&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to disable user&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM Name&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$error.psbase.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$erroractionpreference = "silentlycontinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$userdn = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $userdn &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.psbase.invokeset("AccountDisabled", "True")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error disabling user: " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"User: " + $Args[0] + " disabled"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Get-ADProp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/B&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to query AD Object Properties&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM, Property&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$Error.psbase.clear()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$ErrorActionPreference = "SilentlyContinue"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#Use the below line in the profile to assign to get-adprop&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#new-item -path function:get-adprop -value {&amp;amp; 'C:\store\ps scripts\get-adprop.ps1' $args[0] $args[1]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$username = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $username&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.Get($Args[1])&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error getting property " + $Args[1] + " for " + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Set-ADProp&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid black .5pt; mso-border-themecolor: text1" cellSpacing=0 cellPadding=0 border=1 class="MsoTableGrid"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes"&gt;
&lt;TD class="" style="BORDER-RIGHT: #f0f0f0; PADDING-RIGHT: 5.4pt; BORDER-TOP: #f0f0f0; PADDING-LEFT: 5.4pt; BACKGROUND: #d9d9d9; PADDING-BOTTOM: 0cm; BORDER-LEFT: #f0f0f0; WIDTH: 462.1pt; PADDING-TOP: 0cm; BORDER-BOTTOM: #f0f0f0; mso-background-themecolor: background1; mso-background-themeshade: 217" vAlign=top width=616&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Function to set AD Object Properties&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;# Takes SAM, Property, Value&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#Use the below line in the profile to assign to get-adprop&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;#new-item -path function:set-adprop -value {&amp;amp; 'C:\store\ps scripts\set-adprop.ps1' $args[0] $args[1] $args[2]}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;function get-dn ($SAMName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$root = [ADSI]''&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher = new-object System.DirectoryServices.DirectorySearcher($root)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$searcher.filter = ("(sAMAccountName= $SAMName)")&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$user = $searcher.findall()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;if ($user.count -gt 1)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;foreach($i in $user)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;write-host $count ": " $i.path &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$count = $count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$selection = Read-Host "Please select item: "&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[$selection].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return $user[0].path&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$username = get-dn $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user = [ADSI] $username&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.put($Args[1], $Args[2])&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;$user.setinfo()&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;if ($error.count -ne 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;"Error setting " + $Args[1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;$error[0].exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;$Args[1] + " property set for user" + $Args[0]&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;FONT size=3&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Well ladies and gents.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Hope you enjoyed this.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Coding errors on a post card please &lt;/FONT&gt;&lt;SPAN style="FONT-FAMILY: Wingdings; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;&lt;SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;That is all&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0cm 0cm 0pt"&gt;&lt;BR&gt;&lt;FONT face=Calibri size=3&gt;BenP&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=744868" width="1" height="1"&gt;</description><pubDate>Tue, 10 Apr 2007 15:28:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:744868</guid><comments>http://blogs.technet.com/benp/comments/744868.aspx</comments><author>benp</author><source url="http://blogs.technet.com/benp/rss.xml">Benp's Guide to Stuff</source><ng:postId>2388839826</ng:postId><ng:feedId>1293790</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Updated Event Log Check</title><link>http://blog.sapien.com/current/2007/4/6/updated-event-log-check.html</link><description>A few months ago, I wrote an entry about using Powershell to look at recent event logs. Since then, I&amp;#8217;ve decided to make a minor improvement. The new function lets you specify the number of event logs to retrieve.
</description><pubDate>Tue, 10 Apr 2007 11:00:00 GMT</pubDate><guid isPermaLink="false">http://blog.sapien.com/current/2007/4/6/updated-event-log-check.html</guid><author>Jeffery Hicks</author><source url="http://blog.sapien.com/current/atom.xml">The SAPIEN Scripting Blog</source><ng:postId>2389620165</ng:postId><ng:feedId>1221029</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>Updated Event Log Check</title><link>http://blog.sapien.com/current/2007/4/6/updated-event-log-check.html</link><description>A few months ago, I wrote an entry about using Powershell to look at recent event logs. Since then, I&amp;#8217;ve decided to make a minor improvement. The new function lets you specify the number of event logs to retrieve.
</description><pubDate>Tue, 10 Apr 2007 11:00:00 GMT</pubDate><guid isPermaLink="false">http://blog.sapien.com/current/2007/4/6/updated-event-log-check.html</guid><author>Jeffery Hicks</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2460535227</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>get-datatable.ps1</title><link>http://blogs.msdn.com/mwilbur/archive/2007/03/10/get-datatable-ps1.aspx</link><description>&lt;p&gt;get-datatable.ps1 is an improvement on the get-dataset.ps1 from an &lt;a href="http://blogs.msdn.com/mwilbur/archive/2007/02/25/updating-a-dataset-with-powershell-and-saving-changes-back-to-sql.aspx"&gt;earlier post&lt;/a&gt;. Instead of returning a dataset it returns a DataTable; and a UpdateSql method is added to the object returned, so you don't need a separate script to send the changes back to sql.&lt;/p&gt; &lt;p&gt;This allows updates to a small table&amp;nbsp;to look like:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;$t = datatable "select * from stuff" -db foo&lt;br&gt;$t | %{ .... update the data rows ...&amp;nbsp;}&lt;br&gt;$t.UpdateSql()&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Get-DataTable.ps1:&lt;/p&gt; &lt;div class="code" style="overflow: auto"&gt;&lt;pre&gt;param (&lt;span style="color: #35687d"&gt;$sql&lt;/span&gt;,&lt;span style="color: #35687d"&gt;$server&lt;/span&gt;=&lt;span style="color: maroon"&gt;"."&lt;/span&gt;,&lt;span style="color: #35687d"&gt;$db&lt;/span&gt;) 

&lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt;= &lt;span style="color: maroon"&gt;"Server=$server;database=$db;trusted_connection=yes;"&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;new-object&lt;/span&gt; data.DataTable 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;New-Object&lt;/span&gt; system.data.sqlclient.sqldataadapter &lt;span style="color: #35687d"&gt;$sql&lt;/span&gt;, &lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$null&lt;/span&gt; = &lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.Fill(&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;) 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"sql"&lt;/span&gt;]= &lt;span style="color: #35687d"&gt;$sql&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"connectionstring"&lt;/span&gt;]= &lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt; 

&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;add-member&lt;/span&gt; ScriptMethod UpdateSql { 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;New-Object&lt;/span&gt; system.data.sqlclient.sqldataadapter &lt;span style="color: #35687d"&gt;$this&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"sql"&lt;/span&gt;], &lt;span style="color: #35687d"&gt;$this&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"connectionstring"&lt;/span&gt;] 

&lt;span style="color: #35687d"&gt;$cb&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;new-object&lt;/span&gt; system.data.sqlclient.sqlcommandbuilder &lt;span style="color: #35687d"&gt;$da&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.UpdateCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetUpdateCommand() 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.InsertCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetInsertCommand() 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.DeleteCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetDeleteCommand() 
&lt;span style="color: #35687d"&gt;$null&lt;/span&gt; = &lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.Update(&lt;span style="color: #35687d"&gt;$this&lt;/span&gt;) 
} -&lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; -pass 

&lt;span style="color: green"&gt;#return data table in array so table doesn't get decomposed into an array of data rows.&lt;/span&gt; 
,&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1855167" width="1" height="1"&gt;</description><pubDate>Sat, 10 Mar 2007 20:40:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1855167</guid><comments>http://blogs.msdn.com/mwilbur/comments/1855167.aspx</comments><author>mwilbur</author><source url="http://blogs.msdn.com/mwilbur/rss.xml">Mike Wilbur's Blog</source><ng:postId>2227662323</ng:postId><ng:feedId>1266454</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>get-datatable.ps1</title><link>http://blogs.msdn.com/mwilbur/archive/2007/03/10/get-datatable-ps1.aspx</link><description>&lt;p&gt;get-datatable.ps1 is an improvement on the get-dataset.ps1 from an &lt;a href="http://blogs.msdn.com/mwilbur/archive/2007/02/25/updating-a-dataset-with-powershell-and-saving-changes-back-to-sql.aspx"&gt;earlier post&lt;/a&gt;. Instead of returning a dataset it returns a DataTable; and a UpdateSql method is added to the object returned, so you don't need a separate script to send the changes back to sql.&lt;/p&gt; &lt;p&gt;This allows updates to a small table&amp;nbsp;to look like:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;$t = datatable "select * from stuff" -db foo&lt;br&gt;$t | %{ .... update the data rows ...&amp;nbsp;}&lt;br&gt;$t.UpdateSql()&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Get-DataTable.ps1:&lt;/p&gt; &lt;div class="code" style="overflow: auto"&gt;&lt;pre&gt;param (&lt;span style="color: #35687d"&gt;$sql&lt;/span&gt;,&lt;span style="color: #35687d"&gt;$server&lt;/span&gt;=&lt;span style="color: maroon"&gt;"."&lt;/span&gt;,&lt;span style="color: #35687d"&gt;$db&lt;/span&gt;) 

&lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt;= &lt;span style="color: maroon"&gt;"Server=$server;database=$db;trusted_connection=yes;"&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;new-object&lt;/span&gt; data.DataTable 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;New-Object&lt;/span&gt; system.data.sqlclient.sqldataadapter &lt;span style="color: #35687d"&gt;$sql&lt;/span&gt;, &lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$null&lt;/span&gt; = &lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.Fill(&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;) 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"sql"&lt;/span&gt;]= &lt;span style="color: #35687d"&gt;$sql&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"connectionstring"&lt;/span&gt;]= &lt;span style="color: #35687d"&gt;$connectionstring&lt;/span&gt; 

&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;add-member&lt;/span&gt; ScriptMethod UpdateSql { 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;New-Object&lt;/span&gt; system.data.sqlclient.sqldataadapter &lt;span style="color: #35687d"&gt;$this&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"sql"&lt;/span&gt;], &lt;span style="color: #35687d"&gt;$this&lt;/span&gt;.ExtendedProperties[&lt;span style="color: maroon"&gt;"connectionstring"&lt;/span&gt;] 

&lt;span style="color: #35687d"&gt;$cb&lt;/span&gt; = &lt;span style="color: #2b91af"&gt;new-object&lt;/span&gt; system.data.sqlclient.sqlcommandbuilder &lt;span style="color: #35687d"&gt;$da&lt;/span&gt; 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.UpdateCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetUpdateCommand() 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.InsertCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetInsertCommand() 
&lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.DeleteCommand = &lt;span style="color: #35687d"&gt;$cb&lt;/span&gt;.GetDeleteCommand() 
&lt;span style="color: #35687d"&gt;$null&lt;/span&gt; = &lt;span style="color: #35687d"&gt;$da&lt;/span&gt;.Update(&lt;span style="color: #35687d"&gt;$this&lt;/span&gt;) 
} -&lt;span style="color: blue"&gt;in&lt;/span&gt; &lt;span style="color: #35687d"&gt;$dt&lt;/span&gt; -pass 

&lt;span style="color: green"&gt;#return data table in array so table doesn't get decomposed into an array of data rows.&lt;/span&gt; 
,&lt;span style="color: #35687d"&gt;$dt&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1855167" width="1" height="1"&gt;</description><pubDate>Sat, 10 Mar 2007 20:40:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1855167</guid><comments>http://blogs.msdn.com/mwilbur/comments/1855167.aspx</comments><author>mwilbur</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2540974846</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>My Powershell Profile Script</title><link>http://www.peterprovost.org/archive/2007/01/29/22118.aspx</link><description>&lt;p&gt;The other day a friend asked me for my Powershell profile script. It reminded me of when we used to pass csh/ksh/bash scripts around... but now I'm showing my age.&lt;/p&gt; &lt;p&gt;So, here is mine. Unlike Brad Wilson, I decided to put most of my stuff in this file and not to separate out things into separate .ps1 files. To each his own. There is basically no difference.&lt;/p&gt; &lt;p&gt;(Download link is at the bottom)&lt;/p&gt;&lt;pre&gt;&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Peter's PowerShell Profile (peter@provost.org)&lt;/font&gt;
&lt;font color="green"&gt;#  v2.0 (2007-01-13)&lt;/font&gt;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Aliases&lt;/font&gt;
set-alias grep select-string;
set-alias wide format-wide;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Environment variables&lt;/font&gt;
set-content env:\VISUAL &lt;font color="maroon"&gt;'"C:\Program Files\Vim\Vim70\gvim.exe"'&lt;/font&gt;;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Helper Functions&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; ff ([&lt;font color="blue"&gt;string&lt;/font&gt;] $glob) { get-childitem -recurse -include $glob }
&lt;font color="blue"&gt;function&lt;/font&gt; osr { shutdown -r -t &lt;font color="maroon"&gt;5&lt;/font&gt; }
&lt;font color="blue"&gt;function&lt;/font&gt; osh { shutdown -h -t &lt;font color="maroon"&gt;5&lt;/font&gt; }
&lt;font color="blue"&gt;function&lt;/font&gt; rmd ([&lt;font color="blue"&gt;string&lt;/font&gt;] $glob) { remove-item -recurse -force $glob }
&lt;font color="blue"&gt;function&lt;/font&gt; whoami { (get-content env:\userdomain) + &lt;font color="maroon"&gt;"\"&lt;/font&gt; + (get-content env:\username); }
&lt;font color="blue"&gt;function&lt;/font&gt; strip-extension ([&lt;font color="blue"&gt;string&lt;/font&gt;] $filename) { &lt;br&gt;	[system.io.path]::getfilenamewithoutextension($filename)&lt;br&gt;} 
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Prompt&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; prompt {
	$nextId = (get-history -count &lt;font color="maroon"&gt;1&lt;/font&gt;).Id + &lt;font color="maroon"&gt;1&lt;/font&gt;;
	$promptText = &lt;font color="maroon"&gt;"["&lt;/font&gt; + $nextId + &lt;font color="maroon"&gt;"] ?"&lt;/font&gt;;

	$wi = [System.Security.Principal.WindowsIdentity]::GetCurrent()
		$wp = new-object &lt;font color="maroon"&gt;'System.Security.Principal.WindowsPrincipal'&lt;/font&gt; $wi

		&lt;font color="blue"&gt;if&lt;/font&gt; ( $wp.IsInRole(&lt;font color="maroon"&gt;"Administrators"&lt;/font&gt;) -eq &lt;font color="maroon"&gt;1&lt;/font&gt; )
		{
			$color = &lt;font color="maroon"&gt;"Red"&lt;/font&gt;
				$title = &lt;font color="maroon"&gt;"**ADMIN** - "&lt;/font&gt; + (get-location).Path;
		}
		&lt;font color="blue"&gt;else&lt;/font&gt;
		{
			$color = &lt;font color="maroon"&gt;"Green"&lt;/font&gt;
				$title = (get-location).Path;
		}

	write-host $promptText -NoNewLine -ForegroundColor $color
		$host.UI.RawUI.WindowTitle = $title;

	&lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="maroon"&gt;" "&lt;/font&gt;
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom 'cd' command to maintain directory history&lt;/font&gt;
&lt;font color="blue"&gt;if&lt;/font&gt;( test-path alias:\cd ) { remove-item alias:\cd }
$GLOBAL:PWD = get-location;
$GLOBAL:CDHIST = [System.Collections.Arraylist]::Repeat($PWD, &lt;font color="maroon"&gt;1&lt;/font&gt;);
&lt;font color="blue"&gt;function&lt;/font&gt; cd {
	$cwd = get-location;
	$l = $GLOBAL:CDHIST.count;

	&lt;font color="blue"&gt;if&lt;/font&gt; ($args.length -eq &lt;font color="maroon"&gt;0&lt;/font&gt;) { 
		set-location $HOME;
		$GLOBAL:PWD = get-location;
		$GLOBAL:CDHIST.Remove($GLOBAL:PWD);
		&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;] -ne $GLOBAL:PWD) {
			$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		}
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -like &lt;font color="maroon"&gt;"-[0-9]*"&lt;/font&gt;) {
		$num = $args[&lt;font color="maroon"&gt;0&lt;/font&gt;].Replace(&lt;font color="maroon"&gt;"-"&lt;/font&gt;,&lt;font color="maroon"&gt;""&lt;/font&gt;);
		$GLOBAL:PWD = $GLOBAL:CDHIST[$num];
		set-location $GLOBAL:PWD;
		$GLOBAL:CDHIST.RemoveAt($num);
		$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -eq &lt;font color="maroon"&gt;"-l"&lt;/font&gt;) {
		&lt;font color="blue"&gt;for&lt;/font&gt; ($i = $l-&lt;font color="maroon"&gt;1&lt;/font&gt;; $i -ge &lt;font color="maroon"&gt;0&lt;/font&gt; ; $i--) { 
			&lt;font color="maroon"&gt;"{0,6}  {1}"&lt;/font&gt; -f $i, $GLOBAL:CDHIST[$i];
		}
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -eq &lt;font color="maroon"&gt;"-"&lt;/font&gt;) { 
		&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:CDHIST.count -gt &lt;font color="maroon"&gt;1&lt;/font&gt;) {
			$t = $CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;];
			$CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;] = $CDHIST[&lt;font color="maroon"&gt;1&lt;/font&gt;];
			$CDHIST[&lt;font color="maroon"&gt;1&lt;/font&gt;] = $t;
			set-location $GLOBAL:CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;];
			$GLOBAL:PWD = get-location;
		}
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;else&lt;/font&gt; { 
		set-location &lt;font color="maroon"&gt;"$args"&lt;/font&gt;;
		$GLOBAL:PWD = pwd; 
		&lt;font color="blue"&gt;for&lt;/font&gt; ($i = ($l - &lt;font color="maroon"&gt;1&lt;/font&gt;); $i -ge &lt;font color="maroon"&gt;0&lt;/font&gt;; $i--) { 
			&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:PWD -eq $CDHIST[$i]) {
				$GLOBAL:CDHIST.RemoveAt($i);
			}
		}

		$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		$GLOBAL:PWD;
	}

	$GLOBAL:PWD = get-location;
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom PS-only path settings&lt;/font&gt;
&lt;font color="green"&gt;#   use this for directories that contain PS1 &lt;/font&gt;
&lt;font color="green"&gt;#   files since they generally can't be run &lt;/font&gt;
&lt;font color="green"&gt;#   outside of PowerShell&lt;/font&gt;
&lt;font color="green"&gt;#&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; script:append-path {
	$oldPath = get-content Env:\Path;
	$newPath = $oldPath + &lt;font color="maroon"&gt;";"&lt;/font&gt; + $args;
	set-content Env:\Path $newPath;
}

append-path (resolve-path &lt;font color="maroon"&gt;'~/PowerShell Scripts'&lt;/font&gt;).Path
&lt;font color="green"&gt;########################################################&lt;/font&gt;


&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom format filters&lt;/font&gt;
&lt;font color="blue"&gt;filter&lt;/font&gt; Format-Bytes {
	$units = &lt;font color="maroon"&gt;'B  '&lt;/font&gt;, &lt;font color="maroon"&gt;'KiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'MiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'GiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'TiB'&lt;/font&gt;;
	$ln = [Int64]&lt;font color="maroon"&gt;0&lt;/font&gt; + $_;
	$u = &lt;font color="maroon"&gt;0&lt;/font&gt;;

	&lt;font color="blue"&gt;if&lt;/font&gt;($ln -eq &lt;font color="maroon"&gt;0&lt;/font&gt;) {
		&lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="maroon"&gt;'0    '&lt;/font&gt;;
	}

	&lt;font color="blue"&gt;while&lt;/font&gt;(($ln -gt &lt;font color="maroon"&gt;1024&lt;/font&gt;) -and ($u -lt $units.Length)) {
		$ln /= &lt;font color="maroon"&gt;1024&lt;/font&gt;;
		$u++;
	}

	&lt;font color="maroon"&gt;'{0,7:0.###} {1}'&lt;/font&gt; -f $ln, $units[$u];
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# 'go' command and targets&lt;/font&gt;
&lt;font color="blue"&gt;if&lt;/font&gt;( $GLOBAL:go_locations -eq $&lt;font color="blue"&gt;null&lt;/font&gt; ) {
	$GLOBAL:go_locations = @{};
}

&lt;font color="blue"&gt;function&lt;/font&gt; go ([&lt;font color="blue"&gt;string&lt;/font&gt;] $location) {
	&lt;font color="blue"&gt;if&lt;/font&gt;( $go_locations.ContainsKey($location) ) {
		set-location $go_locations[$location];
	} &lt;font color="blue"&gt;else&lt;/font&gt; {
		write-output &lt;font color="maroon"&gt;"The following locations are defined:"&lt;/font&gt;;
		write-output $go_locations;
	}
}

$go_locations.Add(&lt;font color="maroon"&gt;"home"&lt;/font&gt;, &lt;font color="maroon"&gt;"~"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"dl"&lt;/font&gt;, &lt;font color="maroon"&gt;"~\Desktop\Downloads"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"dev"&lt;/font&gt;, &lt;font color="maroon"&gt;"C:\Development"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"scripts"&lt;/font&gt;, &lt;font color="maroon"&gt;"~\PowerShell Scripts"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"addons"&lt;/font&gt;, &lt;font color="maroon"&gt;"C:\World of Warcraft\Interface\Addons"&lt;/font&gt;)
&lt;font color="green"&gt;########################################################&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.peterprovost.org/Files/Microsoft.PowerShell_profile.ps1.txt"&gt;Download Microsoft.PowerShell_profile.ps1.txt here&lt;/a&gt;. You will need to rename the file and put it where $profile is set.&lt;/p&gt;&lt;img src ="http://www.peterprovost.org/aggbug/22118.aspx" width = "1" height = "1" /&gt;</description><pubDate>Mon, 29 Jan 2007 19:25:00 GMT</pubDate><guid isPermaLink="false">http://www.peterprovost.org/archive/2007/01/29/22118.aspx</guid><author>Peter Provost</author><source url="http://www.peterprovost.org/Atom.aspx">Geek Noise</source><ng:postId>2029841317</ng:postId><ng:feedId>17392</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item><item><title>My Powershell Profile Script</title><link>http://www.peterprovost.org/archive/2007/01/29/22118.aspx</link><description>&lt;p&gt;The other day a friend asked me for my Powershell profile script. It reminded me of when we used to pass csh/ksh/bash scripts around... but now I'm showing my age.&lt;/p&gt; &lt;p&gt;So, here is mine. Unlike Brad Wilson, I decided to put most of my stuff in this file and not to separate out things into separate .ps1 files. To each his own. There is basically no difference.&lt;/p&gt; &lt;p&gt;(Download link is at the bottom)&lt;/p&gt;&lt;pre&gt;&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Peter's PowerShell Profile (peter@provost.org)&lt;/font&gt;
&lt;font color="green"&gt;#  v2.0 (2007-01-13)&lt;/font&gt;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Aliases&lt;/font&gt;
set-alias grep select-string;
set-alias wide format-wide;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Environment variables&lt;/font&gt;
set-content env:\VISUAL &lt;font color="maroon"&gt;'"C:\Program Files\Vim\Vim70\gvim.exe"'&lt;/font&gt;;
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Helper Functions&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; ff ([&lt;font color="blue"&gt;string&lt;/font&gt;] $glob) { get-childitem -recurse -include $glob }
&lt;font color="blue"&gt;function&lt;/font&gt; osr { shutdown -r -t &lt;font color="maroon"&gt;5&lt;/font&gt; }
&lt;font color="blue"&gt;function&lt;/font&gt; osh { shutdown -h -t &lt;font color="maroon"&gt;5&lt;/font&gt; }
&lt;font color="blue"&gt;function&lt;/font&gt; rmd ([&lt;font color="blue"&gt;string&lt;/font&gt;] $glob) { remove-item -recurse -force $glob }
&lt;font color="blue"&gt;function&lt;/font&gt; whoami { (get-content env:\userdomain) + &lt;font color="maroon"&gt;"\"&lt;/font&gt; + (get-content env:\username); }
&lt;font color="blue"&gt;function&lt;/font&gt; strip-extension ([&lt;font color="blue"&gt;string&lt;/font&gt;] $filename) { &lt;br&gt;	[system.io.path]::getfilenamewithoutextension($filename)&lt;br&gt;} 
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Prompt&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; prompt {
	$nextId = (get-history -count &lt;font color="maroon"&gt;1&lt;/font&gt;).Id + &lt;font color="maroon"&gt;1&lt;/font&gt;;
	$promptText = &lt;font color="maroon"&gt;"["&lt;/font&gt; + $nextId + &lt;font color="maroon"&gt;"] ?"&lt;/font&gt;;

	$wi = [System.Security.Principal.WindowsIdentity]::GetCurrent()
		$wp = new-object &lt;font color="maroon"&gt;'System.Security.Principal.WindowsPrincipal'&lt;/font&gt; $wi

		&lt;font color="blue"&gt;if&lt;/font&gt; ( $wp.IsInRole(&lt;font color="maroon"&gt;"Administrators"&lt;/font&gt;) -eq &lt;font color="maroon"&gt;1&lt;/font&gt; )
		{
			$color = &lt;font color="maroon"&gt;"Red"&lt;/font&gt;
				$title = &lt;font color="maroon"&gt;"**ADMIN** - "&lt;/font&gt; + (get-location).Path;
		}
		&lt;font color="blue"&gt;else&lt;/font&gt;
		{
			$color = &lt;font color="maroon"&gt;"Green"&lt;/font&gt;
				$title = (get-location).Path;
		}

	write-host $promptText -NoNewLine -ForegroundColor $color
		$host.UI.RawUI.WindowTitle = $title;

	&lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="maroon"&gt;" "&lt;/font&gt;
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom 'cd' command to maintain directory history&lt;/font&gt;
&lt;font color="blue"&gt;if&lt;/font&gt;( test-path alias:\cd ) { remove-item alias:\cd }
$GLOBAL:PWD = get-location;
$GLOBAL:CDHIST = [System.Collections.Arraylist]::Repeat($PWD, &lt;font color="maroon"&gt;1&lt;/font&gt;);
&lt;font color="blue"&gt;function&lt;/font&gt; cd {
	$cwd = get-location;
	$l = $GLOBAL:CDHIST.count;

	&lt;font color="blue"&gt;if&lt;/font&gt; ($args.length -eq &lt;font color="maroon"&gt;0&lt;/font&gt;) { 
		set-location $HOME;
		$GLOBAL:PWD = get-location;
		$GLOBAL:CDHIST.Remove($GLOBAL:PWD);
		&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;] -ne $GLOBAL:PWD) {
			$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		}
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -like &lt;font color="maroon"&gt;"-[0-9]*"&lt;/font&gt;) {
		$num = $args[&lt;font color="maroon"&gt;0&lt;/font&gt;].Replace(&lt;font color="maroon"&gt;"-"&lt;/font&gt;,&lt;font color="maroon"&gt;""&lt;/font&gt;);
		$GLOBAL:PWD = $GLOBAL:CDHIST[$num];
		set-location $GLOBAL:PWD;
		$GLOBAL:CDHIST.RemoveAt($num);
		$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -eq &lt;font color="maroon"&gt;"-l"&lt;/font&gt;) {
		&lt;font color="blue"&gt;for&lt;/font&gt; ($i = $l-&lt;font color="maroon"&gt;1&lt;/font&gt;; $i -ge &lt;font color="maroon"&gt;0&lt;/font&gt; ; $i--) { 
			&lt;font color="maroon"&gt;"{0,6}  {1}"&lt;/font&gt; -f $i, $GLOBAL:CDHIST[$i];
		}
	}
	&lt;font color="blue"&gt;elseif&lt;/font&gt; ($args[&lt;font color="maroon"&gt;0&lt;/font&gt;] -eq &lt;font color="maroon"&gt;"-"&lt;/font&gt;) { 
		&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:CDHIST.count -gt &lt;font color="maroon"&gt;1&lt;/font&gt;) {
			$t = $CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;];
			$CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;] = $CDHIST[&lt;font color="maroon"&gt;1&lt;/font&gt;];
			$CDHIST[&lt;font color="maroon"&gt;1&lt;/font&gt;] = $t;
			set-location $GLOBAL:CDHIST[&lt;font color="maroon"&gt;0&lt;/font&gt;];
			$GLOBAL:PWD = get-location;
		}
		$GLOBAL:PWD;
	}
	&lt;font color="blue"&gt;else&lt;/font&gt; { 
		set-location &lt;font color="maroon"&gt;"$args"&lt;/font&gt;;
		$GLOBAL:PWD = pwd; 
		&lt;font color="blue"&gt;for&lt;/font&gt; ($i = ($l - &lt;font color="maroon"&gt;1&lt;/font&gt;); $i -ge &lt;font color="maroon"&gt;0&lt;/font&gt;; $i--) { 
			&lt;font color="blue"&gt;if&lt;/font&gt; ($GLOBAL:PWD -eq $CDHIST[$i]) {
				$GLOBAL:CDHIST.RemoveAt($i);
			}
		}

		$GLOBAL:CDHIST.Insert(&lt;font color="maroon"&gt;0&lt;/font&gt;,$GLOBAL:PWD);
		$GLOBAL:PWD;
	}

	$GLOBAL:PWD = get-location;
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom PS-only path settings&lt;/font&gt;
&lt;font color="green"&gt;#   use this for directories that contain PS1 &lt;/font&gt;
&lt;font color="green"&gt;#   files since they generally can't be run &lt;/font&gt;
&lt;font color="green"&gt;#   outside of PowerShell&lt;/font&gt;
&lt;font color="green"&gt;#&lt;/font&gt;
&lt;font color="blue"&gt;function&lt;/font&gt; script:append-path {
	$oldPath = get-content Env:\Path;
	$newPath = $oldPath + &lt;font color="maroon"&gt;";"&lt;/font&gt; + $args;
	set-content Env:\Path $newPath;
}

append-path (resolve-path &lt;font color="maroon"&gt;'~/PowerShell Scripts'&lt;/font&gt;).Path
&lt;font color="green"&gt;########################################################&lt;/font&gt;


&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# Custom format filters&lt;/font&gt;
&lt;font color="blue"&gt;filter&lt;/font&gt; Format-Bytes {
	$units = &lt;font color="maroon"&gt;'B  '&lt;/font&gt;, &lt;font color="maroon"&gt;'KiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'MiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'GiB'&lt;/font&gt;, &lt;font color="maroon"&gt;'TiB'&lt;/font&gt;;
	$ln = [Int64]&lt;font color="maroon"&gt;0&lt;/font&gt; + $_;
	$u = &lt;font color="maroon"&gt;0&lt;/font&gt;;

	&lt;font color="blue"&gt;if&lt;/font&gt;($ln -eq &lt;font color="maroon"&gt;0&lt;/font&gt;) {
		&lt;font color="blue"&gt;return&lt;/font&gt; &lt;font color="maroon"&gt;'0    '&lt;/font&gt;;
	}

	&lt;font color="blue"&gt;while&lt;/font&gt;(($ln -gt &lt;font color="maroon"&gt;1024&lt;/font&gt;) -and ($u -lt $units.Length)) {
		$ln /= &lt;font color="maroon"&gt;1024&lt;/font&gt;;
		$u++;
	}

	&lt;font color="maroon"&gt;'{0,7:0.###} {1}'&lt;/font&gt; -f $ln, $units[$u];
}
&lt;font color="green"&gt;########################################################&lt;/font&gt;

&lt;font color="green"&gt;########################################################&lt;/font&gt;
&lt;font color="green"&gt;# 'go' command and targets&lt;/font&gt;
&lt;font color="blue"&gt;if&lt;/font&gt;( $GLOBAL:go_locations -eq $&lt;font color="blue"&gt;null&lt;/font&gt; ) {
	$GLOBAL:go_locations = @{};
}

&lt;font color="blue"&gt;function&lt;/font&gt; go ([&lt;font color="blue"&gt;string&lt;/font&gt;] $location) {
	&lt;font color="blue"&gt;if&lt;/font&gt;( $go_locations.ContainsKey($location) ) {
		set-location $go_locations[$location];
	} &lt;font color="blue"&gt;else&lt;/font&gt; {
		write-output &lt;font color="maroon"&gt;"The following locations are defined:"&lt;/font&gt;;
		write-output $go_locations;
	}
}

$go_locations.Add(&lt;font color="maroon"&gt;"home"&lt;/font&gt;, &lt;font color="maroon"&gt;"~"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"dl"&lt;/font&gt;, &lt;font color="maroon"&gt;"~\Desktop\Downloads"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"dev"&lt;/font&gt;, &lt;font color="maroon"&gt;"C:\Development"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"scripts"&lt;/font&gt;, &lt;font color="maroon"&gt;"~\PowerShell Scripts"&lt;/font&gt;)
$go_locations.Add(&lt;font color="maroon"&gt;"addons"&lt;/font&gt;, &lt;font color="maroon"&gt;"C:\World of Warcraft\Interface\Addons"&lt;/font&gt;)
&lt;font color="green"&gt;########################################################&lt;/font&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.peterprovost.org/Files/Microsoft.PowerShell_profile.ps1.txt"&gt;Download Microsoft.PowerShell_profile.ps1.txt here&lt;/a&gt;. You will need to rename the file and put it where $profile is set.&lt;/p&gt;&lt;img src ="http://www.peterprovost.org/aggbug/22118.aspx" width = "1" height = "1" /&gt;</description><pubDate>Mon, 29 Jan 2007 19:25:00 GMT</pubDate><guid isPermaLink="false">http://www.peterprovost.org/archive/2007/01/29/22118.aspx</guid><author>Peter Provost</author><source url="http://feeds.feedburner.com/PowerShellClippings">Powershell on NewsGator Online</source><ng:postId>2536302406</ng:postId><ng:feedId>1382338</ng:feedId><ng:folderId>3408475</ng:folderId><ng:folder ng:id="3408475" ng:flagState="0" ng:annotation="" /></item></channel></rss>