{"id":73181,"date":"2015-09-23T00:01:00","date_gmt":"2015-09-23T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/09\/23\/extending-objects-with-powershell-week-of-the-year\/"},"modified":"2019-02-18T09:35:09","modified_gmt":"2019-02-18T16:35:09","slug":"extending-objects-with-powershell-week-of-the-year","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/extending-objects-with-powershell-week-of-the-year\/","title":{"rendered":"Extending Objects with PowerShell: Week of the Year"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Ed Wilson talks about adding members to an object with Windows PowerShell to get the week of the year.<\/span><\/p>\n<p>Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it is configurable. Not merely configurable, but amazingly flexible. For example, when I look at a <b>DateTime<\/b> object, I see the following:<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\mredw&gt; Get-Date | fl *<\/p>\n<p style=\"margin-left:30px\">DisplayHint : DateTime<\/p>\n<p style=\"margin-left:30px\">DateTime&nbsp;&nbsp;&nbsp; : Tuesday, September 22, 2015 11:48:25 AM<\/p>\n<p style=\"margin-left:30px\">Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 9\/22\/2015 12:00:00 AM<\/p>\n<p style=\"margin-left:30px\">Day&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 22<\/p>\n<p style=\"margin-left:30px\">DayOfWeek&nbsp;&nbsp; : Tuesday<\/p>\n<p style=\"margin-left:30px\">DayOfYear&nbsp;&nbsp; : 265<\/p>\n<p style=\"margin-left:30px\">Hour&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 11<\/p>\n<p style=\"margin-left:30px\">Kind&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Local<\/p>\n<p style=\"margin-left:30px\">Millisecond : 230<\/p>\n<p style=\"margin-left:30px\">Minute&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 48<\/p>\n<p style=\"margin-left:30px\">Month&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 9<\/p>\n<p style=\"margin-left:30px\">Second&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 25<\/p>\n<p style=\"margin-left:30px\">Ticks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 635785193052307708<\/p>\n<p style=\"margin-left:30px\">TimeOfDay&nbsp;&nbsp; : 11:48:25.2307708<\/p>\n<p style=\"margin-left:30px\">Year&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 2015<\/p>\n<p>There are a lot of properties exposed. The <b>DayOfYear<\/b> and the <b>DayOfWeek<\/b> are a couple of useful properties that I might not be expecting. There are also a lot of methods available. I mean, there are a huge number of methods. Everything from adding days and hours to finding out if it is daylight savings time. These methods are shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\mredw&gt; get-date | Get-Member -MemberType method<\/p>\n<p style=\"margin-left:30px\">&nbsp;&nbsp; TypeName: System.DateTime<\/p>\n<p style=\"margin-left:30px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MemberType Definition<\/p>\n<p style=\"margin-left:30px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8212;&#8212;-<\/p>\n<p style=\"margin-left:30px\">Add&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime Add(timespan value)<\/p>\n<p style=\"margin-left:30px\">AddDays&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddDays(double value)<\/p>\n<p style=\"margin-left:30px\">AddHours&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddHours(double value)<\/p>\n<p style=\"margin-left:30px\">AddMilliseconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddMilliseconds(double value)<\/p>\n<p style=\"margin-left:30px\">AddMinutes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddMinutes(double value)<\/p>\n<p style=\"margin-left:30px\">AddMonths&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddMonths(int months)<\/p>\n<p style=\"margin-left:30px\">AddSeconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddSeconds(double value)<\/p>\n<p style=\"margin-left:30px\">AddTicks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddTicks(long value)<\/p>\n<p style=\"margin-left:30px\">AddYears&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime AddYears(int value)<\/p>\n<p style=\"margin-left:30px\">CompareTo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; int CompareTo(System.Object value), int CompareTo&#8230;<\/p>\n<p style=\"margin-left:30px\">Equals&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; bool Equals(System.Object value), bool Equals(dat&#8230;<\/p>\n<p style=\"margin-left:30px\">GetDateTimeFormats&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string[] GetDateTimeFormats(), string[] GetDateTi&#8230;<\/p>\n<p style=\"margin-left:30px\">GetHashCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; int GetHashCode()<\/p>\n<p style=\"margin-left:30px\">GetObjectData&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; void ISerializable.GetObjectData(System.Runtime.S&#8230;<\/p>\n<p style=\"margin-left:30px\">GetType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; type GetType()<\/p>\n<p style=\"margin-left:30px\">GetTypeCode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; System.TypeCode GetTypeCode(), System.TypeCode IC&#8230;<\/p>\n<p style=\"margin-left:30px\">IsDaylightSavingTime Method&nbsp;&nbsp;&nbsp;&nbsp; bool IsDaylightSavingTime()<\/p>\n<p style=\"margin-left:30px\">Subtract&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; timespan Subtract(datetime value), datetime Subtr&#8230;<\/p>\n<p style=\"margin-left:30px\">ToBinary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; long ToBinary()<\/p>\n<p style=\"margin-left:30px\">ToBoolean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; bool IConvertible.ToBoolean(System.IFormatProvide&#8230;<\/p>\n<p style=\"margin-left:30px\">ToByte&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; byte IConvertible.ToByte(System.IFormatProvider p&#8230;<\/p>\n<p style=\"margin-left:30px\">ToChar&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; char IConvertible.ToChar(System.IFormatProvider p&#8230;<\/p>\n<p style=\"margin-left:30px\">ToDateTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime IConvertible.ToDateTime(System.IFormatPr&#8230;<\/p>\n<p style=\"margin-left:30px\">ToDecimal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; decimal IConvertible.ToDecimal(System.IFormatProv&#8230;<\/p>\n<p style=\"margin-left:30px\">ToDouble&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; double IConvertible.ToDouble(System.IFormatProvid&#8230;<\/p>\n<p style=\"margin-left:30px\">ToFileTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; long ToFileTime()<\/p>\n<p style=\"margin-left:30px\">ToFileTimeUtc &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Method&nbsp;&nbsp;&nbsp;&nbsp; long ToFileTimeUtc()<\/p>\n<p style=\"margin-left:30px\">ToInt16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; int16 IConvertible.ToInt16(System.IFormatProvider&#8230;<\/p>\n<p style=\"margin-left:30px\">ToInt32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; int IConvertible.ToInt32(System.IFormatProvider p&#8230;<\/p>\n<p style=\"margin-left:30px\">ToInt64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; long IConvertible.ToInt64(System.IFormatProvider &#8230;<\/p>\n<p style=\"margin-left:30px\">ToLocalTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime ToLocalTime()<\/p>\n<p style=\"margin-left:30px\">ToLongDateString&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string ToLongDateSt\nring()<\/p>\n<p style=\"margin-left:30px\">ToLongTimeString&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string ToLongTimeString()<\/p>\n<p style=\"margin-left:30px\">ToOADate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; double ToOADate()<\/p>\n<p style=\"margin-left:30px\">ToSByte&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; sbyte IConvertible.ToSByte(System.IFormatProvider&#8230;<\/p>\n<p style=\"margin-left:30px\">ToShortDateString&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string ToShortDateString()<\/p>\n<p style=\"margin-left:30px\">ToShortTimeString&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string ToShortTimeString()<\/p>\n<p style=\"margin-left:30px\">ToSingle&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; float IConvertible.ToSingle(System.IFormatProvide&#8230;<\/p>\n<p style=\"margin-left:30px\">ToString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; string ToString(), string ToString(string format)&#8230;<\/p>\n<p style=\"margin-left:30px\">ToType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; System.Object IConvertible.ToType(type conversion&#8230;<\/p>\n<p style=\"margin-left:30px\">ToUInt16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; uint16 IConvertible.ToUInt16(System.IFormatProvid&#8230;<\/p>\n<p style=\"margin-left:30px\">ToUInt32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; uint32 IConvertible.ToUInt32(System.IFormatProvid&#8230;<\/p>\n<p style=\"margin-left:30px\">ToUInt64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; uint64 IConvertible.ToUInt64(System.IFormatProvid&#8230;<\/p>\n<p style=\"margin-left:30px\">ToUniversalTime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Method&nbsp;&nbsp;&nbsp;&nbsp; datetime ToUniversalTime()<\/p>\n<h2>If I want to know how many weeks are left&hellip;<\/h2>\n<p>Even with all of those methods, if I want to know how many weeks are left in the year&mdash;well, it is not there. Strangely enough, Windows PowerShell seems to know this answer anyway. If I use a <b>UFormat<\/b> of <b>%V<\/b> (this is case sensitive), I can get the week of the year, and then I can easily subtract it from 52 and find out how many weeks I have left in the current year. The use of the <b>UFormat<\/b> is shown here:<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\mredw&gt; Get-Date -UFormat %V<\/p>\n<p style=\"margin-left:30px\">38<\/p>\n<p>I would like to have this available as a property. I can do the following, and add it temporarily:<\/p>\n<p style=\"margin-left:30px\">PS C:\\Users\\mredw&gt; get-date | Add-Member -MemberType NoteProperty -Name WeekOfYear -V<\/p>\n<p style=\"margin-left:30px\">alue (Get-Date -UFormat %V) -PassThru | fl *<\/p>\n<p style=\"margin-left:30px\">DisplayHint : DateTime<\/p>\n<p style=\"margin-left:30px\">WeekOfYear&nbsp; : 38<\/p>\n<p style=\"margin-left:30px\">DateTime&nbsp;&nbsp;&nbsp; : Tuesday, September 22, 2015 11:48:36 AM<\/p>\n<p style=\"margin-left:30px\">Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 9\/22\/2015 12:00:00 AM<\/p>\n<p style=\"margin-left:30px\">Day&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 22<\/p>\n<p style=\"margin-left:30px\">DayOfWeek&nbsp;&nbsp; : Tuesday<\/p>\n<p style=\"margin-left:30px\">DayOfYear&nbsp;&nbsp; : 265<\/p>\n<p style=\"margin-left:30px\">Hour&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 11<\/p>\n<p style=\"margin-left:30px\">Kind&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Local<\/p>\n<p style=\"margin-left:30px\">Millisecond : 700<\/p>\n<p style=\"margin-left:30px\">Minute&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 48<\/p>\n<p style=\"margin-left:30px\">Month&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 9<\/p>\n<p style=\"margin-left:30px\">Second&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 36<\/p>\n<p style=\"margin-left:30px\">Ticks&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 635785193167005123<\/p>\n<p style=\"margin-left:30px\">TimeOfDay&nbsp;&nbsp; : 11:48:36.7005123<\/p>\n<p style=\"margin-left:30px\">Year&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 2015<\/p>\n<p>The key &ldquo;trick&rdquo; is to use <b>Add-Member<\/b> to add something to the object. I can add a <b>NoteProperty<\/b>, and give it the name of <b>WeekOfYear<\/b>. I then make my value the result of <b>Get-Date &ndash;Uformat $V<\/b>. The essential code is shown here:<\/p>\n<p style=\"margin-left:30px\">get-date | Add-Member -MemberType NoteProperty -Name WeekOfYear -Value (Get-Date -UFormat %V)<\/p>\n<p>Now of course, this does not help too much because it simply displays nothing. That is why I added <b>&ndash;PassThru<\/b>. As shown here, with <b>&ndash;PassThru<\/b>, the output is simply the default display from the <b>Get-Date<\/b> cmdlet:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; get-date | Add-Member -MemberType NoteProperty -Name WeekOfYear -Value (Get-D<\/p>\n<p style=\"margin-left:30px\">ate -UFormat %V) -PassThru<\/p>\n<p style=\"margin-left:30px\">Tuesday, September 22, 2015 1:27:09 PM<\/p>\n<p>Using <b>Format-List *<\/b> adds the property set to the output, and I can then see the newly created <b>WeekOfYear<\/b> property.<\/p>\n<p>If I store the results back into a variable, I can use it later, for example:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $dte = get-date | Add-Member -MemberType NoteProperty -Name WeekOfYear -Value<\/p>\n<p style=\"margin-left:30px\">&nbsp;(Get-Date -UFormat %V) -PassThru<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $dte<\/p>\n<p style=\"margin-left:30px\">Tuesday, September 22, 2015 1:29:01 PM<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; $dte.WeekOfYear<\/p>\n<p style=\"margin-left:30px\">38<\/p>\n<p>I could use it later to find the remaining weeks in the year by subtracting from 52:<\/p>\n<p style=\"margin-left:30px\">PS C:\\&gt; 52 &#8211; $dte.WeekOfYear<\/p>\n<p style=\"margin-left:30px\">14<\/p>\n<p>That is all there is to using Windows PowerShell to add a number-of-weeks property to a <b>DateTime<\/b> object. Join me tomorrow when I will talk about more cool Windows PowerShell stuff.<\/p>\n<p>I invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b><span style=\"font-size:12px\">&nbsp;<\/span><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Ed Wilson talks about adding members to an object with Windows PowerShell to get the week of the year. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it is configurable. Not merely configurable, but amazingly flexible. For example, when I look at a DateTime object, [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[333,409,3,4,45],"class_list":["post-73181","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-dates","tag-objects","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Ed Wilson talks about adding members to an object with Windows PowerShell to get the week of the year. Microsoft Scripting Guy, Ed Wilson, is here. One of the cool things about Windows PowerShell is that it is configurable. Not merely configurable, but amazingly flexible. For example, when I look at a DateTime object, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/73181","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=73181"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/73181\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=73181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=73181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=73181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}