{"id":17840,"date":"2008-12-13T10:55:56","date_gmt":"2008-12-13T18:55:56","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17840"},"modified":"2019-06-07T11:01:19","modified_gmt":"2019-06-07T19:01:19","slug":"explore-your-environment","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/explore-your-environment\/","title":{"rendered":"Explore Your [Environment]"},"content":{"rendered":"<p>This topic is a little long but I strongly encourage you to walk through it and master the techniques it illustrates.&#160; I can assure you that you&#8217;ll will use them a couple thousand times in the next couple of years.<\/p>\n<p>.Net provides a wonderful class called System.Environment that tells you all about your environment.&#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.&#160; That way when a relevant issue comes up, you&#8217;ll know that there is very simple way to get the answer.&#160; <\/p>\n<p>First thing to remember is that they way you specify a type in PowerShell is with square brackets:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [System.Environment]<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">IsPublic IsSerial Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseType      <br \/>&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211;       <br \/>True&#160;&#160;&#160;&#160; False&#160;&#160;&#160; Environment&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Object<\/font><\/p>\n<p>&#160;<\/p>\n<p>The next thing to remember is that PowerShell allows you to drop the &quot;SYSTEM&quot; from types:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[System.Diagnostics.Process]<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">IsPublic IsSerial Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseType      <br \/>&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211;       <br \/>True&#160;&#160;&#160;&#160; False&#160;&#160;&#160; Process&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.ComponentModel.Component <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [Diagnostics.Process]<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">IsPublic IsSerial Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseType      <br \/>&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211;       <br \/>True&#160;&#160;&#160;&#160; False&#160;&#160;&#160; Process&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.ComponentModel.Component <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [Environment]<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">IsPublic IsSerial Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseType      <br \/>&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211;       <br \/>True&#160;&#160;&#160;&#160; False&#160;&#160;&#160; Environment&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Object<\/font><\/p>\n<p>&#160;<\/p>\n<p>The next thing to remember is that types can have STATIC properties and methods.&#160; What are a &quot;static properties and methods&quot;?&#160; Most properties are methods that you deal with are OBJECT properties and methods which is to say that they are the &quot;properties of THAT object&quot; or the &quot;methods that can be invoked on THAT object&quot;.&#160; Static properties and methods do not require an object to be invoked.&#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.&#160; Not all types have statics in fact most don&#8217;t but those that do are often super useful so it is worth the explore. <\/p>\n<p>So how do you explore?&#160; Well with PowerShell of course.&#160; Remember that PowerShell is designed to allow you to explore the system.&#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.&#160; So the tool to explore Statics is Get-Member.&#160;&#160; Here is what you need to know:<\/p>\n<p>1) Get-Member has a -STATIC parameter.    <br \/>2) You can pipe INSTANCES or TYPES to get-member     <br \/>3) &quot;Get-Member -Static&quot; can be invoked as &quot;gm -s&quot;<\/p>\n<p>Let&#8217;s explore:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> Get-Date |Get-Member -Static<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160; TypeName: System.DateTime <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType Definition      <br \/>&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br \/>Compare&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int Compare(System.DateTime t1, System.DateTime t2)       <br \/>DaysInMonth&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int DaysInMonth(int year, int month)       <br \/>Equals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq       <br \/>FromBinary&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromBinary(long dateData)       <br \/>FromFileTime&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTime(long fileTime)       <br \/>FromFileTimeUtc Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTimeUtc(long fileTime)       <br \/>FromOADate&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromOADate(double d)       <br \/>IsLeapYear&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool IsLeapYear(int year)       <br \/>Parse&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin       <br \/>ParseExact&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime ParseExact(string s, string format, System.IFormatP       <br \/>ReferenceEquals Method&#160;&#160;&#160;&#160; static bool ReferenceEquals(System.Object objA, System.Object objB)       <br \/>SpecifyKind&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK       <br \/>TryParse&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParse(string s, System.DateTime&amp;, mscorlib, Version=2.0.0.0       <br \/>TryParseExact&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParseExact(string s, string format, System.IFormatProvider       <br \/>MaxValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MaxValue {get;}       <br \/>MinValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MinValue {get;}       <br \/>Now&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Now {get;}       <br \/>Today&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Today {get;}       <br \/>UtcNow&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime UtcNow {get;} <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>Get-Date |gm -s<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160; TypeName: System.DateTime <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType Definition      <br \/>&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br \/>Compare&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int Compare(System.DateTime t1, System.DateTime t2)       <br \/>DaysInMonth&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int DaysInMonth(int year, int month)       <br \/>Equals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq       <br \/>FromBinary&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromBinary(long dateData)       <br \/>FromFileTime&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTime(long fileTime)       <br \/>FromFileTimeUtc Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTimeUtc(long fileTime)       <br \/>FromOADate&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromOADate(double d)       <br \/>IsLeapYear&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool IsLeapYear(int year)       <br \/>Parse&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin       <br \/>ParseExact&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime ParseExact(string s, string format, System.IFormatP       <br \/>ReferenceEquals Method&#160;&#160;&#160;&#160; static bool ReferenceEquals(System.Object objA, System.Object objB)       <br \/>SpecifyKind&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK       <br \/>TryParse&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParse(string s, System.DateTime&amp;, mscorlib, Version=2.0.0.0       <br \/>TryParseExact&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParseExact(string s, string format, System.IFormatProvider       <br \/>MaxValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MaxValue {get;}       <br \/>MinValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MinValue {get;}       <br \/>Now&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Now {get;}       <br \/>Today&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Today {get;}       <br \/>UtcNow&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime UtcNow {get;} <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[DateTime] |gm -s<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160; TypeName: System.DateTime <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType Definition      <br \/>&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br \/>Compare&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int Compare(System.DateTime t1, System.DateTime t2)       <br \/>DaysInMonth&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static int DaysInMonth(int year, int month)       <br \/>Equals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool Equals(System.DateTime t1, System.DateTime t2), static bool Eq       <br \/>FromBinary&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromBinary(long dateData)       <br \/>FromFileTime&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTime(long fileTime)       <br \/>FromFileTimeUtc Method&#160;&#160;&#160;&#160; static System.DateTime FromFileTimeUtc(long fileTime)       <br \/>FromOADate&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime FromOADate(double d)       <br \/>IsLeapYear&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool IsLeapYear(int year)       <br \/>Parse&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime Parse(string s), static System.DateTime Parse(strin       <br \/>ParseExact&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime ParseExact(string s, string format, System.IFormatP       <br \/>ReferenceEquals Method&#160;&#160;&#160;&#160; static bool ReferenceEquals(System.Object objA, System.Object objB)       <br \/>SpecifyKind&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeK       <br \/>TryParse&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParse(string s, System.DateTime&amp;, mscorlib, Version=2.0.0.0       <br \/>TryParseExact&#160;&#160; Method&#160;&#160;&#160;&#160; static bool TryParseExact(string s, string format, System.IFormatProvider       <br \/>MaxValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MaxValue {get;}       <br \/>MinValue&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.DateTime MinValue {get;}       <br \/>Now&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Now {get;}       <br \/>Today&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime Today {get;}       <br \/>UtcNow&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; System.DateTime UtcNow {get;}<\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>Now lets explore&#160; how you access these.&#160; You use &quot;::&quot; on types to invoke statics:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Datetime]::Today<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Saturday, December 13, 2008 12:00:00 AM <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Datetime]::IsLeapYear(2008)<\/strong>       <br \/>True<\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>So with that background, let&#8217;s explore some of SYSTEM.ENVIRONMENT properties:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [Environment] |gm -s<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160; TypeName: System.Environment <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType Definition      <br \/>&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br \/>Equals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool Equals(System.Object o&#8230;       <br \/>Exit&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Void Exit(int exitCode)       <br \/>ExpandEnvironmentVariables Method&#160;&#160;&#160;&#160; static string ExpandEnvironmentVar&#8230;       <br \/>FailFast&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Void FailFast(string&#8230;       <br \/>GetCommandLineArgs&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.String[] GetCommandL&#8230;       <br \/>GetEnvironmentVariable&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static string GetEnvironmentVariab&#8230;       <br \/>GetEnvironmentVariables&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Collections.IDiction&#8230;       <br \/>GetFolderPath&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static string GetFolderPath(System&#8230;       <br \/>GetLogicalDrives&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.String[] GetLogicalD&#8230;       <br \/>ReferenceEquals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool ReferenceEquals(System&#8230;       <br \/>SetEnvironmentVariable&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Void SetEnvironmentV&#8230;       <br \/>CommandLine&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String CommandLine {&#8230;       <br \/>CurrentDirectory&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String CurrentDirect&#8230;       <br \/>ExitCode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Int32 ExitCode {get;&#8230;       <br \/>HasShutdownStarted&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Boolean HasShutdownS&#8230;       <br \/>MachineName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String MachineName {&#8230;       <br \/>NewLine&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String NewLine {get;}       <br \/>OSVersion&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.OperatingSystem OSVe&#8230;       <br \/>ProcessorCount&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Int32 ProcessorCount&#8230;       <br \/>StackTrace&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String StackTrace {g&#8230;       <br \/>SystemDirectory&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String SystemDirecto&#8230;       <br \/>TickCount&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Int32 TickCount {get;}       <br \/>UserDomainName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String UserDomainNam&#8230;       <br \/>UserInteractive&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Boolean UserInteract&#8230;       <br \/>UserName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.String UserName {get;}       <br \/>Version&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Version Version {get;}       <br \/>WorkingSet&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160; static System.Int64 WorkingSet {get;} <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Environment]::MachineName        <br \/><\/strong>JPSW7-5       <br \/>PS<strong>&gt; [Environment]::OSVersion<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Platform ServicePack&#160;&#160;&#160;&#160;&#160;&#160;&#160; Version&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; VersionString      <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8211;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;&#8212;-       <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Win32NT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6.1.7004.0&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Microsoft Windo&#8230; <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Environment]::ProcessorCount<\/strong>       <br \/>2       <br \/>PS&gt; <strong>[Environment]::UserInteractive<\/strong>       <br \/>True       <br \/>PS&gt; <strong>[Environment]::UserDomainName<\/strong>       <br \/>NTDEV       <br \/>PS&gt; <strong>[Environment]::UserName        <br \/><\/strong>jsnover       <br \/>PS&gt; <strong>[Environment]::SystemDirectory<\/strong>       <br \/>C:\\Windows\\system32       <br \/>PS&gt;<\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>Now let&#8217;s explore some methods:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [Environment]::GetLogicalDrives()        <br \/><\/strong>C:\\       <br \/>D:\\       <br \/>E:\\       <br \/>PS&gt; <strong>[Environment]::GetEnvironmentVariable(&quot;PATH&quot;)<\/strong>       <br \/>%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\system32;C:\\Window       <br \/>s;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\P       <br \/>rogram Files\\WTT 2.2\\Client\\;C:\\PROGRA~1\\CA\\SHARED~1\\SCANEN~1;C:\\Program Fi       <br \/>les\\CA\\eTrust Antivirus;c:\\ps       <br \/>PS&gt; <strong>[Environment]::GetFolderPath()<\/strong>       <br \/><font color=\"#ff0000\">Cannot find an overload for &quot;GetFolderPath&quot; and the argument count: &quot;0&quot;.        <br \/>At line:1 char:29         <br \/>+ [Environment]::GetFolderPath &lt;&lt;&lt;&lt; ()         <br \/>&#160;&#160;&#160; + CategoryInfo&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : NotSpecified: (:) [], MethodException         <br \/>&#160;&#160;&#160; + FullyQualifiedErrorId : MethodCountCouldNotFindBest<\/font> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>Notice the error I got for GetFolderPath() &#8211; it&#8217;s complaining about the number of arguments it got.&#160; So now let&#8217;s learn the technique to discover method signatures.&#160; If you specify a method and use &quot;()&quot;, it invokes the method. If you don&#8217;t provide the &quot;()&quot; and just specify the name, it give you information about the method:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Environment]::GetFolderPath<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">MemberType&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : Method      <br \/>OverloadDefinitions :<font color=\"#ff0000\"> {static string GetFolderPath(System.Environment+Speci        <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; alFolder folder)}         <br \/><\/font>TypeNameOfValue&#160;&#160;&#160;&#160; : System.Management.Automation.PSMethod       <br \/>Value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : static string GetFolderPath(System.Environment+Specia       <br \/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lFolder folder)       <br \/>Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : GetFolderPath       <br \/>IsInstance&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : True<\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"><\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"><\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"><\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\"><\/font><\/p>\n<p>This tells you that the method takes one argument whose name is &quot;folder&quot; and whose type is System.Environment+SpecialFolder.&#160; What the heck is that?&#160; <\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[System.Environment+SpecialFolder]<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">IsPublic IsSerial Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; BaseType      <br \/>&#8212;&#8212;&#8211; &#8212;&#8212;&#8211; &#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8211;       <br \/>False&#160;&#160;&#160; True&#160;&#160;&#160;&#160; SpecialFolder&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color=\"#ff0000\">System.Enum<\/font><\/font><\/p>\n<p>&#160;<\/p>\n<p>Notice that it is an ENUM.&#160; The great things about ENUMS is that when you specify an invalid value &#8211; it tells you what the valid values are:<\/p>\n<p><font color=\"#0000ff\" size=\"2\"><font face=\"Consolas\">PS&gt; <\/font><strong><font face=\"Consolas\">[Environment]::GetFolderPath(&quot;burp&quot;)          <br \/><\/font><\/strong><font color=\"#ff0000\" face=\"Consolas\">Cannot convert argument &quot;0&quot;, with value: &quot;burp&quot;, for &quot;GetFolderPath&quot; to typ        <br \/>e &quot;System.Environment+SpecialFolder&quot;: &quot;Cannot convert value &quot;burp&quot; to type         <br \/>&quot;System.Environment+SpecialFolder&quot; due to invalid enumeration values. Speci         <br \/>fy one of the following enumeration values and try again. The possible enum         <br \/>eration values are<\/font><font face=\"Consolas\"><font color=\"#ff0000\"><strong><em><font size=\"3\"><u> <\/u>&quot;Desktop, Programs, Personal, MyDocuments, Favorites, St                 <br \/>artup, Recent, SendTo, StartMenu, MyMusic, DesktopDirectory, MyComputer, Te                 <br \/>mplates, ApplicationData, LocalApplicationData, InternetCache, Cookies, His                 <br \/>tory, CommonApplicationData, System, ProgramFiles, MyPictures, CommonProgra                 <br \/>mFiles&quot;.&quot;<\/font><\/em><\/strong>           <br \/>At line:1 char:29           <br \/>+ [Environment]::GetFolderPath &lt;&lt;&lt;&lt; (&quot;burp&quot;)           <br \/>&#160;&#160;&#160; + CategoryInfo&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : NotSpecified: (:) [], MethodException           <br \/>&#160;&#160;&#160; + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument<\/font><\/font><\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>So let&#8217;s try some of those values:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"con\">PS&gt;<strong> [Environment]::GetFolderPath(&quot;cookies&quot;)<\/strong>       <br \/>C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\Cookies       <br \/>PS&gt; <strong>[Environment]::GetFolderPath(&quot;mypictures&quot;)<\/strong>       <br \/>C:\\Users\\jsnover\\Pictures<\/font><\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>But wait &#8211; it&#8217;s gets even better!&#160; <\/p>\n<p>Now let&#8217;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:<\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt;<strong> [Enum] |gm -s<\/strong> <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">&#160;&#160; TypeName: System.Enum <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType Definition      <br \/>&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;-       <br \/>Equals&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool Equals(System.Object objA, Syst&#8230;       <br \/>Format&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static string Format(type enumType, System&#8230;.       <br \/>GetName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static string GetName(type enumType, System&#8230;       <br \/>GetNames&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.String[] GetNames(type enumType)       <br \/>GetUnderlyingType Method&#160;&#160;&#160;&#160; static type GetUnderlyingType(type enumType)       <br \/>GetValues&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static array GetValues(type enumType)       <br \/>IsDefined&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static bool IsDefined(type enumType, System&#8230;       <br \/>Parse&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Object Parse(type enumType, s&#8230;       <br \/>ReferenceEquals&#160;&#160; Method&#160;&#160;&#160;&#160; static bool ReferenceEquals(System.Object o&#8230;       <br \/>ToObject&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160; static System.Object ToObject(type enumType&#8230; <\/font><\/p>\n<p><font color=\"#0000ff\" size=\"2\" face=\"Consolas\">PS&gt; <strong>[Enum]::GetValues([System.Environment+SpecialFolder])        <br \/><\/strong>Desktop       <br \/>Programs       <br \/>Personal       <br \/>Personal       <br \/>Favorites       <br \/>Startup       <br \/>Recent       <br \/>SendTo       <br \/>StartMenu       <br \/>MyMusic       <br \/>DesktopDirectory       <br \/>MyComputer       <br \/>Templates       <br \/>ApplicationData       <br \/>LocalApplicationData       <br \/>InternetCache       <br \/>Cookies       <br \/>History       <br \/>CommonApplicationData       <br \/>System       <br \/>ProgramFiles       <br \/>MyPictures       <br \/>CommonProgramFiles       <\/p>\n<p>PS&gt; <strong>foreach ($f in [Enum]::GetValues([System.Environment+SpecialFolder])) {       <br \/>&gt;&gt; &quot;{0,-20} &#8211; {1}&quot; -f $f, [Environment]::GetFolderPath($f) }         <br \/><\/strong>&gt;&gt;       <br \/>Desktop&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Desktop       <br \/>Programs&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\S       <br \/>tart Menu\\Programs       <br \/>Personal&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Documents       <br \/>Personal&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Documents       <br \/>Favorites&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Favorites       <br \/>Startup&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\S       <br \/>tart Menu\\Programs\\Startup       <br \/>Recent&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\R       <br \/>ecent       <br \/>SendTo&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\S       <br \/>endTo       <br \/>StartMenu&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\S       <br \/>tart Menu       <br \/>MyMusic&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Music       <br \/>DesktopDirectory&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Desktop       <br \/>MyComputer&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211;       <br \/>Templates&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\T       <br \/>emplates       <br \/>ApplicationData&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming       <br \/>LocalApplicationData &#8211; C:\\Users\\jsnover\\AppData\\Local       <br \/>InternetCache&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Local\\Microsoft\\Windows\\Tem       <br \/>porary Internet Files       <br \/>Cookies&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Roaming\\Microsoft\\Windows\\C       <br \/>ookies       <br \/>History&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\AppData\\Local\\Microsoft\\Windows\\His       <br \/>tory       <br \/>CommonApplicationData &#8211; C:\\ProgramData       <br \/>System&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Windows\\system32       <br \/>ProgramFiles&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Program Files       <br \/>MyPictures&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8211; C:\\Users\\jsnover\\Pictures       <br \/>CommonProgramFiles&#160;&#160; &#8211; C:\\Program Files\\Common Files<\/font><\/p>\n<p>&#160;<\/p>\n<p>Is that cool or what?<\/p>\n<p>Enjoy!<\/p>\n<p>&#160;<\/p>\n<p>Jeffrey Snover [MSFT]    <br \/>Windows Management Partner Architect     <br \/>Visit the Windows PowerShell Team blog at:&#160;&#160;&#160; <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a>     <br \/>Visit the Windows PowerShell ScriptCenter at:&#160; <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This topic is a little long but I strongly encourage you to walk through it and master the techniques it illustrates.&#160; I can assure you that you&#8217;ll will use them a couple thousand times in the next couple of years. .Net provides a wonderful class called System.Environment that tells you all about your environment.&#160; It [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[177,4,325],"class_list":["post-17840","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-get-member","tag-howto","tag-system-environment"],"acf":[],"blog_post_summary":"<p>This topic is a little long but I strongly encourage you to walk through it and master the techniques it illustrates.&#160; I can assure you that you&#8217;ll will use them a couple thousand times in the next couple of years. .Net provides a wonderful class called System.Environment that tells you all about your environment.&#160; It [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17840"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17840\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}