<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://powershell.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results for 'app:weblogs' matching tags 'Weekend Scripter' and '.NET Framework'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:weblogs&amp;tag=Weekend+Scripter,.NET+Framework&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags 'Weekend Scripter' and '.NET Framework'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Weekend Scripter: Use PowerShell to Find and Explore .NET Framework Classes</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/07/22/weekend-scripter-use-powershell-to-find-and-explore-net-framework-classes.aspx</link><pubDate>Sun, 22 Jul 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:17876</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;:&amp;nbsp;&lt;span&gt;The Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to find and to explore .NET Framework classes.&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;PoshReflectionExplorer? Or not.&lt;/h2&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. Well the day finally arrived. This morning the Scripting Wife dropped me off at the airport, and I begin my trek across the United States to Seattle Washington for the Microsoft internal conference, TechReady 15. I do not know if I have mentioned it or not, but there are 38 Windows PowerShell sessions going on this week at TechReady 15. Dude, I can tell you that I will have my work cut out for me attempting to see all of them. So I have my laptop running the latest build of Windows 8, and the customer preview of Office 2013, and I got a free upgrade to First Class, and 5 &amp;frac12; hours of free time during the flight to enjoy. Sweet.&lt;/p&gt;
&lt;p&gt;I seem to remember an email or a comment on a recent Hey, Scripting Guy! Blog post about exploring .NET Framework classes via Windows PowerShell. I wrote a Windows PowerShell script to do this very thing more than four years ago when I was working on the Windows PowerShell Scripting Guide book for Microsoft Press. I am not going to show you the script (which is a rather ugly Windows PowerShell 1.0 script), but I will show you the techniques that I used in the script to create my explorer.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;First find the current appdomain&lt;/h2&gt;
&lt;p&gt;The first thing to do is to find the current appdomain. There is one used by the Windows PowerShell console, and a different one used for the Windows PowerShell ISE. To find the current appdomain, use the static &lt;strong&gt;currentdomain&lt;/strong&gt; property from the system.appdomain .NET Framework class. (By the way, this works in Windows PowerShell 3.0 as well). First, the current appdomain for the Windows PowerShell console.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::CurrentDomain&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FriendlyName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : DefaultDomain&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Id&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;&amp;nbsp;&amp;nbsp; : 1&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ApplicationDescription :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;BaseDirectory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : C:\WINDOWS\system32\WindowsPowerShell\v1.0\&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;DynamicDirectory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RelativeSearchPath&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;SetupInformation&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : System.AppDomainSetup&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ShadowCopyFiles&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now, using the same command in the Windows PowerShell ISE, you can see different results.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\Users\ed.IAMMRED&amp;gt; [appdomain]::currentdomain&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FriendlyName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : PowerShell_ISE.exe&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Id&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;&amp;nbsp;&amp;nbsp; : 1&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ApplicationDescription :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;BaseDirectory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : C:\Windows\system32\WindowsPowerShell\v1.0\&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;DynamicDirectory&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;RelativeSearchPath&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;SetupInformation&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : System.AppDomainSetup&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ShadowCopyFiles&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : False&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;currentdomain&lt;/strong&gt; static property returns a system.appdomain object. This object contains a number of methods in addition to the displayed properties. I can find this information by piping the results from the &lt;strong&gt;currentdomain&lt;/strong&gt; static property to the &lt;strong&gt;Get-Member&lt;/strong&gt; cmdlet. This command is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;[appdomain]::CurrentDomain | get-member&lt;/p&gt;
&lt;p&gt;The method I want to use is the &lt;strong&gt;getassemblies &lt;/strong&gt;method. The &lt;strong&gt;getassemblies &lt;/strong&gt;method is not a static method, but because the &lt;strong&gt;currentdomain&lt;/strong&gt; static property returns a system.appdomain object. I can call the method directly from that object. Here is the command and associated output from the Windows PowerShell console (on a Windows PowerShell 2.0 machine. In Windows PowerShell 3.0, the versions are all v4.0.xxxxx).&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::currentdomain.GetAssemblies()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GAC &amp;nbsp;&amp;nbsp;&amp;nbsp;Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Location&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;---&amp;nbsp;&amp;nbsp;&amp;nbsp; -------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --------&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.dll&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.ConsoleHo...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e0...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Management.Automation\1...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.Commands....&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Configuration.Install\2...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.WSMan.Management\1.0...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_64\System.Transactions\2.0.0.0__b77...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.Commands....&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.Commands....&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.Security\...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c5619...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Management\2.0.0.0__b03...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.DirectoryServices\2.0.0...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c56193...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Security\2.0.0.0__b03f5...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0__b7...&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;getassemblies&lt;/strong&gt; method returns instances of the System.Reflection.Assembly .NET Framework class. This class contains a number of very interesting methods and properties. The output from &lt;strong&gt;Get-Member&lt;/strong&gt; on the returned system.reflection.assembly .NET framework class is shown here.&lt;i&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::currentdomain.GetAssemblies() | Get-Member&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp; TypeName: System.Reflection.Assembly&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Name&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; MemberType Definition&lt;/p&gt;
&lt;p style="padding-left:30px;"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------- ----------&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ModuleResolve&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Event&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.ModuleResolveEventHandler ...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;CreateInstance&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object CreateInstance(string typeName...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Equals&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;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool Equals(System.Object o)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetCustomAttributes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Object[] GetCustomAttributes(bool inh...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetExportedTypes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type[] GetExportedTypes()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetFile&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;Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.FileStream GetFile(string name)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetFiles&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.FileStream[] GetFiles(), System.IO...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetHashCode&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int GetHashCode()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetLoadedModules&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Module[] GetLoadedModules(...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetManifestResourceInfo&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.ManifestResourceInfo GetMa...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetManifestResourceNames&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] GetManifestResourceNames()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetManifestResourceStream Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.IO.Stream GetManifestResourceStream(t...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetModule&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Module GetModule(string name)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetModules&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Module[] GetModules(), Sys...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetName&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.AssemblyName GetName(), Sy...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetObjectData&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Void GetObjectData(System.Runtime.Ser...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetReferencedAssemblies&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.AssemblyName[] GetReferenc...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetSatelliteAssembly&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Assembly GetSatelliteAssem...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetType&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type GetType(string name), type GetType(stri...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GetTypes&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type[] GetTypes()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;IsDefined&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; Method &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bool IsDefined(type attributeType, bool inhe...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;LoadModule&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Module LoadModule(string m...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ToString&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; Method&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ToString()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;CodeBase&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; Property&amp;nbsp;&amp;nbsp; System.String CodeBase {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;EntryPoint&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; Property&amp;nbsp;&amp;nbsp; System.Reflection.MethodInfo EntryPoint {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;EscapedCodeBase&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Property&amp;nbsp;&amp;nbsp; System.String EscapedCodeBase {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Evidence&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; Property&amp;nbsp;&amp;nbsp; System.Security.Policy.Evidence Evidence {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;FullName&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;Property&amp;nbsp;&amp;nbsp; System.String FullName {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GlobalAssemblyCache&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Property&amp;nbsp;&amp;nbsp; System.Boolean GlobalAssemblyCache {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;HostContext&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; Property&amp;nbsp;&amp;nbsp; System.Int64 HostContext {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ImageRuntimeVersion&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Property&amp;nbsp;&amp;nbsp; System.String ImageRuntimeVersion {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Location&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; Property&amp;nbsp;&amp;nbsp; System.String Location {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ManifestModule&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Property&amp;nbsp;&amp;nbsp; System.Reflection.Module ManifestModule {get;}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;ReflectionOnly&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Property&amp;nbsp;&amp;nbsp; System.Boolean ReflectionOnly {get;}&lt;/p&gt;
&lt;p&gt;For instance, one thing you might be interested in finding out is if the assembly resides in the Global Assembly Cache (GAC). In the Windows PowerShell 2.0 console, all assemblies are in fact in the GAC. But in the Windows PowerShell 2.0 ISE, and in the Windows PowerShell 3.0 console, this is not the case. If you find yourself using an assembly very often, you might want the assembly in the GAC. Here is how to find assemblies from the current appdomain that are not in the GAC.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::currentdomain.GetAssemblies() | where {!($_.globalassemblycache)}&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;GAC&amp;nbsp;&amp;nbsp;&amp;nbsp; Version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Location&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;&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;&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;&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;/p&gt;
&lt;p style="padding-left:30px;"&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe&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;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp; v2.0.50727&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C:\Windows\system32\WindowsPowerShell\v1.0\CompiledComposition.Microsoft.Po...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Each loaded .NET Framework assembly contributes .NET Framework classes. To see the classes exposed by the assembly, you can use the &lt;i&gt;gettypes &lt;/i&gt;method from the System.Reflection.Assembly class returned by the &lt;i&gt;GetAssemblies &lt;/i&gt;method from the &lt;i&gt;appdomain &lt;/i&gt;class. As you might expect, there are numerous .NET Framework classes. Interestingly enough, the &lt;i&gt;more &lt;/i&gt;filter does not appear to work consistently when working interactively via the Windows PowerShell console, and it does not work at all in the Windows PowerShell ISE. So you might want to consider redirecting the output to a text file. One thing that will help is to sort the output by basetype. Here is the command to do that.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::currentdomain.GetAssemblies() | Foreach-Object {$_.gettypes()} | sort basetype&lt;/p&gt;
&lt;p&gt;Do not expect to quickly find exotic, little known, unused .NET Framework classes. Most of the output, for the IT Pro will be rather pedestrian, lots of error classes, lots of enum, lots of structures, and the like. The output headings appear here:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;IsPublic IsSerial Name&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;&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; BaseType&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;/p&gt;
&lt;p style="padding-left:30px;"&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;&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;&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;/p&gt;
&lt;p&gt;The first couple of pages of output do not event list a base type. Then, when we get to the first grouping of types that do expose a base type, the output is disappointing. Here are the first three lines from that section.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp;&amp;nbsp;&amp;nbsp; True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModuleLoadExceptionHandlerException&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;CrtImplementationDeta...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp;&amp;nbsp;&amp;nbsp; False&amp;nbsp;&amp;nbsp;&amp;nbsp; CSharpMemberAttributeConverter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft.CSharp.CShar...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp;&amp;nbsp;&amp;nbsp; False&amp;nbsp;&amp;nbsp;&amp;nbsp; CSharpTypeAttributeConverter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Microsoft.CSharp.CShar...&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;False&amp;nbsp;&amp;nbsp;&amp;nbsp; False&amp;nbsp;&amp;nbsp;&amp;nbsp; WmiAsyncCmdletHelper&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;&amp;nbsp;&amp;nbsp; Microsoft.PowerShell.C...&lt;/p&gt;
&lt;p&gt;What is going on here? Remember that last year, I wrote a Hey Scripting Guy! blog entitled, &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/20/change-a-powershell-preference-variable-to-reveal-hidden-data.aspx" target="_blank"&gt;Change a PowerShell Preference Variable to Reveal Hidden Data&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&amp;nbsp;Well, if you do not remember it, don&amp;rsquo;t worry, I did not remember the title either. But I did a search for &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;a href="http://blogs.technet.com/controlpanel/blogs/posteditor.asp"&gt;&lt;a&gt;preference variables&lt;/a&gt;,&amp;quot; target=&amp;quot;_blank&amp;quot;&amp;gt;preference variables,&lt;/a&gt;&lt;/span&gt; &lt;/span&gt;and I found it on the first try.&lt;i&gt; &lt;/i&gt;Basically, what you need to do is change the $FormatEnumerationLimit preference variable. By default, the enumeration limit value is 4; and so after four items. it does not use any more space. I like to change it to 20.&lt;/p&gt;
&lt;p&gt;But unfortunately, this does not solve the problem. The problem here is that the .NET Framework class names are extremely long...in some cases, really long. Therefore, using the basic redirection arrow does not help capture all the output. In this case, you need to move beyond the defaults and specify a custom width for the output. The best way to do this is to use the &lt;strong&gt;Out-File&lt;/strong&gt; cmdlet. By setting the width to 180, you will capture most (but not all) of the really long .NET Framework class names. (Each time you make the file wider, you also increase the file size and make the file a bit more difficult to use.) For example, a width of 500 characters will create a file about 8 MB in size. A width of 180 will be around 3.5 MB in size (with over 10,000 lines in it). Here is the command I used.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [appdomain]::currentdomain.GetAssemblies() | % {$_.gettypes()} | sort basetype | Out-File -FilePath c:\fso\gettypes.txt -Width 180 &amp;ndash;Append&lt;/p&gt;
&lt;p&gt;Now that you have the list, you can peruse it at your leisure. Use &lt;strong&gt;Get-Member&lt;/strong&gt; or MSDN to help you find things. I can tell you, from experience that it can spend a very long time looking through stuff. Have fun, and I will talk to you on Monday.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;&lt;span style="color:#0000ff;"&gt;Twitter&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;&lt;span style="color:#0000ff;"&gt;Facebook&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;. If you have any questions, send email to me at &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;&lt;span style="color:#0000ff;"&gt;scripter@microsoft.com&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;, or post your questions on the &lt;span style="font-family:arial, helvetica, sans-serif;"&gt;&lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;&lt;span style="color:#0000ff;"&gt;Official Scripting Guys Forum&lt;/span&gt;&lt;/a&gt;.&lt;/span&gt; See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p style="margin-left:0in;"&gt;&lt;b&gt;&lt;span style="font-family:&amp;#39;Segoe UI&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;"&gt;Ed Wilson, Microsoft Scripting Guy&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510036" width="1" height="1" alt="" /&gt;</description></item><item><title>Use .NET Framework Classes to Augment PowerShell when Required</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/02/12/use-net-framework-classes-to-augment-powershell-when-required.aspx</link><pubDate>Sun, 12 Feb 2012 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:14585</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Microsoft Scripting Guy, Ed Wilson, talks about using Windows PowerShell classes to augment the native functionality of Windows PowerShell.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. It seems like the conference season is gearing up. Keep an eye on my upcoming appearances page so hopefully you can catch the Scripting Wife and me at a venue near you. My good friend &lt;a href="http://blogs.technet.com/search/searchresults.aspx?q=aaron%20nelson&amp;amp;sections=7618" target="_blank"&gt;Aaron Nelson (aka SQLVariant)&lt;/a&gt; succeeded in getting us to come speak at the SQL Server Saturday event in Atlanta. He tried last year, but we were already booked to go somewhere else. Therefore, he immediately issued an invitation for this year, and that got it on our schedule. If you are anywhere in the area of Atlanta, you should make your reservation now so not miss this star-studded event. Even if you are a pure Windows PowerShell person who does not care for SQL Server, you should still attend because there will be some great Windows PowerShell sessions there.&lt;/p&gt;
&lt;p&gt;I received several emails after yesterday&amp;rsquo;s blog, &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2012/02/11/why-use-net-framework-classes-from-within-powershell.aspx" target="_blank"&gt;Why Use .NET Framework Classes from Within PowerShell?&lt;/a&gt; People were asking why I do not like using .NET Framework classes in scripts.&lt;/p&gt;
&lt;p&gt;I did not mean to imply that there is no reason to use .NET Framework classes from within Windows PowerShell. What I meant to say was that given a choice between two equivalent commands, you should always use the native Windows PowerShell cmdlet, unless there is a sufficient reason for not using the Windows PowerShell command (such as performance or need for a specific capability).&lt;/p&gt;
&lt;p&gt;For example, the following command returns an instance of a &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx" target="_blank"&gt;System.Diagnostics.Process class&lt;/a&gt;.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;[diagnostics.process]::GetProcesses()&lt;/p&gt;
&lt;p&gt;The output from the &lt;a href="http://msdn.microsoft.com/en-us/library/1f3ys1f9.aspx" target="_blank"&gt;GetProcesses&lt;i&gt; &lt;/i&gt;static method&lt;/a&gt; is exactly the same as the output from the &lt;b&gt;Get-Process &lt;/b&gt;cmdlet. This is shown in the image that follows.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/4237.hsg_2D00_2_2D00_12_2D00_12_2D00_01.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/4237.hsg_2D00_2_2D00_12_2D00_12_2D00_01.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So, why use the &lt;b&gt;GetProcesses&lt;/b&gt; static method from the System.Diagnostics.Process class? Well, in Windows PowerShell&amp;nbsp;1.0, the &lt;b&gt;Get-Process&lt;/b&gt; cmdlet did not have a &lt;i&gt;ComputerName &lt;/i&gt;parameter. Therefore, if one wanted to obtain process information from a remote computer, the options were to use the Win32_Process WMI class, or to use the GetProcesses&lt;i&gt; &lt;/i&gt;static method. In this case, the need to retrieve process information from a remote computer clearly called for something other than use of the native &lt;b&gt;Get-Process &lt;/b&gt;cmdlet.&lt;/p&gt;
&lt;p&gt;In Windows PowerShell&amp;nbsp;2.0, however, this is no longer the case. Of course, if you have an old Windows PowerShell&amp;nbsp;1.0 script lying around that is working perfectly fine, there is no need to change it just because a new version of Windows PowerShell came out. We invest a lot of time and energy in backward compatibility to avoid the need to rewrite perfectly good Windows PowerShell scripts.&lt;/p&gt;
&lt;p&gt;Another reason for using a .NET Framework class, is because it might be easier than using a Windows PowerShell cmdlet. For example, it is possible to create an arbitrary date by using the &lt;i&gt;Month, Day, &lt;/i&gt;and &lt;i&gt;Year &lt;/i&gt;parameters from the &lt;b&gt;Get-Date &lt;/b&gt;cmdlet. This technique is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Get-Date -Day 23 -Month 1 -Year 2011&lt;/p&gt;
&lt;p&gt;On the other hand, it is also possible to use the System.Datetime .NET Framework class to cast a string into a datetime object. This technique is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;[datetime]&amp;quot;1/23/11&amp;quot;&lt;/p&gt;
&lt;p&gt;The difference between the commands is that the &lt;b&gt;Get-Date &lt;/b&gt;command creates a datetime object with the current time, and the [datetime] cast creates a datetime object with a time at midnight. These two techniques are shown in the following image.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8030.hsg_2D00_2_2D00_12_2D00_12_2D00_02.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/8030.hsg_2D00_2_2D00_12_2D00_12_2D00_02.png" alt="Image of command output" title="Image of command output" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is, of course, possible to use a [datetime] cast. To do this, place a space after the date, and then type a time value. This technique is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; [datetime]&amp;quot;1/23/11 3:17:42 pm&amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Sunday, January 23, 2011 3:17:42 PM&lt;/p&gt;
&lt;p&gt;If no timestamp is required, the [datetime] cast works great and is more efficient than using the &lt;b&gt;Get-Date &lt;/b&gt;cmdlet. On the other hand, if the current time is also required, I prefer to use the &lt;b&gt;Get-Date &lt;/b&gt;cmdlet because it seems easier to do.&lt;/p&gt;
&lt;p&gt;On the other hand, it is possible to use the &lt;b&gt;Get-Date &lt;/b&gt;cmdlet, and directly feed it a date to create. This technique is shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; get-date 1/1/11&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Saturday, January 01, 2011 12:00:00 AM&lt;/p&gt;
&lt;p&gt;So the question is, &amp;ldquo;What is easier?&amp;rdquo; When working with Windows PowerShell, it is great to have choices. Most of the time, especially when working interactively from the Windows PowerShell console, I try to use the technique that is easiest to use. If a .NET Framework class is easiest to use, or if it does exactly what you want, use it. In the end, it is all about getting the job done with a minimum of effort. Do not get stuck in a rut&amp;mdash;use Windows PowerShell to its fullest. That is what it is there for.&lt;/p&gt;
&lt;p&gt;I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3479486" width="1" height="1" alt="" /&gt;</description></item><item><title>Why Use .NET Framework Classes from Within PowerShell?</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2012/02/11/why-use-net-framework-classes-from-within-powershell.aspx</link><pubDate>Sat, 11 Feb 2012 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:14566</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;: Microsoft Scripting Guy, Ed Wilson, talks about the need to use .NET Framework classes from within Windows PowerShell code.&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy, Ed Wilson, is here. The Scripting Wife and I had a great meeting with the &lt;a href="http://powershellgroup.org/charlotte.nc" target="_blank"&gt;Windows PowerShell Users Group&lt;/a&gt; in Charlotte, North Carolina. It was a script club format, so there was no set agenda, nor was there a formal presentation. This provided a great chance to talk to people, find out what they were working on, and in general, have a lot of fun. Speaking of a lot of fun, make sure you check out the first ever &lt;a href="http://powershellgroup.org/content/powershell-saturday" target="_blank"&gt;Windows PowerShell Saturday&lt;/a&gt; that will be held in Columbus Ohio on March 10, 2012. This event, limited to 100 persons, is nearly sold out. So you need to hurry if you want to take advantage of a unique opportunity to network with a great bunch of Windows PowerShell people. The Scripting Wife and I will be there, as will an all-star group of other Windows PowerShell luminaries.&lt;/p&gt;
&lt;p&gt;One of the questions I had from a group member was about using the .NET Framework from within Windows PowerShell. I have written quite a bit about &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/-net+framework/" target="_blank"&gt;using .NET Framework classes&lt;/a&gt; from within Windows PowerShell. Those blogs cover working with methods, discovering properties, finding documentation, and other bread-and-butter types of issues.&lt;/p&gt;
&lt;p&gt;One of the things that I have not talked much about is why one needs to use .NET Framework classes inside of Windows PowerShell. Keep in mind, that as a best practice, I recommend using a native Windows PowerShell cmdlet when it exists&amp;mdash;unless there are compelling reasons for not doing so. For example, I have seen a number of Windows PowerShell scripts (for example, when I was grading the Scripting Games submissions for the last three years), where participants use .NET Framework classes when there is a perfectly good Windows PowerShell option available. Here are two equivalent commands:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;[datetime]::now&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Get-Date&lt;/p&gt;
&lt;p&gt;In the image that follows, I run both commands, and you can see that the output is essentially the same. (That the time indicated is three seconds later is a feature of the fact that for some reason it took me three seconds to run the second command.)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1106.hsg_2D00_2_2D00_11_2D00_12_2D00_01.png"&gt;&lt;img src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/1106.hsg_2D00_2_2D00_11_2D00_12_2D00_01.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I can use the &lt;b&gt;GetType&lt;/b&gt;&lt;i&gt; &lt;/i&gt;method to verify that both commands return a &lt;a href="http://msdn.microsoft.com/en-us/library/system.datetime.aspx"&gt;System.Datetime object&lt;/a&gt;. These two commands are shown here.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; ([datetime]::now).gettype()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;IsPublic IsSerial Name&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;&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; BaseType&lt;/p&gt;
&lt;p style="padding-left:30px;"&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;&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; --------&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime&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;&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; System.ValueType&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt; (Get-Date).gettype()&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;IsPublic IsSerial Name&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;&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; BaseType&lt;/p&gt;
&lt;p style="padding-left:30px;"&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;&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; --------&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime&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;&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; System.ValueType&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;PS C:\&amp;gt;&lt;/p&gt;
&lt;p&gt;Because both commands return a DateTime .NET Framework class object, there is no advantage to the first command. Some may ask, what does the first command actually do? The command that appears here calls the static &lt;a href="http://msdn.microsoft.com/en-us/library/system.datetime.now.aspx" target="_blank"&gt;DateTime.Now property&lt;/a&gt; from the System.DateTime .NET Framework class.&lt;/p&gt;
&lt;p&gt;[datetime]::now&lt;/p&gt;
&lt;p&gt;The static &lt;b&gt;Now&lt;/b&gt;&lt;i&gt; &lt;/i&gt;property returns a System.DateTime object that represents the current local date and time&amp;mdash;this is the same thing that the &lt;b&gt;Get-Date&lt;/b&gt; cmdlet does. The difference? Well, the command &lt;b&gt;Get-Date &lt;/b&gt;is much easier to read than [datetime]::now. So why do people use the static &lt;b&gt;Now&lt;/b&gt;&lt;i&gt; &lt;/i&gt;property? Well, I am convinced there are two reasons.&lt;/p&gt;
&lt;p&gt;The first reason, I feel is legitimate: .NET developers may not know that the &lt;b&gt;Get-Date &lt;/b&gt;cmdlet exists, and they have learned that to call a static member, they put the class name in square brackets and use the double colon before the member name. As I said, this is completely legitimate. Windows PowerShell is flexible enough, that you can write Windows PowerShell code as if it were C#, VB.NET, or even as if it were VBScript or Perl. Anything that helps you get the job done is fine with me&amp;mdash;after all, Windows PowerShell is simply a tool for the vast majority of network administrators.&lt;/p&gt;
&lt;p&gt;The second reason is more insidious. I think there are some people who simply want to use .NET Framework classes because they think it is cool, and that it makes the code appear to be more complex. Maybe they are attempting to impress their coworkers or their boss. Maybe they think that if people see things like &lt;b&gt;Get-Date&lt;/b&gt; in a Windows PowerShell script, they will realize how easy Windows PowerShell is to use and to learn, and then they will no longer have the mantle as the &amp;ldquo;PowerShell guru.&amp;rdquo; I am all for job security, but I prefer to ensure job security by helping others maximize their potential. I prefer to show people how easy it is to use Windows PowerShell to become more productive than to attempt to obscure that fact by deliberately writing confusing code.&lt;/p&gt;
&lt;p&gt;What do you think? I would love to hear from you. I invite you to follow me on &lt;a href="http://bit.ly/scriptingguystwitter" target="_blank"&gt;Twitter&lt;/a&gt; and &lt;a href="http://bit.ly/scriptingguysfacebook" target="_blank"&gt;Facebook&lt;/a&gt;. If you have any questions, send email to me at &lt;a href="mailto:scripter@microsoft.com" target="_blank"&gt;scripter@microsoft.com&lt;/a&gt;, or post your questions on the &lt;a href="http://bit.ly/scriptingforum" target="_blank"&gt;Official Scripting Guys Forum&lt;/a&gt;. See you tomorrow. Until then, peace.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3479483" width="1" height="1" alt="" /&gt;</description></item></channel></rss>