{"id":6441,"date":"2015-04-25T11:59:00","date_gmt":"2015-04-25T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/04\/25\/powertip-determine-if-property-is-member-of-object\/"},"modified":"2019-02-18T10:29:46","modified_gmt":"2019-02-18T17:29:46","slug":"powertip-determine-if-property-is-member-of-object","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-determine-if-property-is-member-of-object\/","title":{"rendered":"PowerTip: Determine if Property is Member of Object"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Determine if a property is a member of an object in Windows PowerShell.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;How can I determine if a specific property is actually a member of an object in my Windows PowerShell script?<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Use the&nbsp;<b>Get-Member<\/b>&nbsp;cmdlet, and cast the response into a Boolean data type by using the&nbsp;<b>[bool]<\/b>&nbsp;type <br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accelerator, for example:<\/p>\n<p style=\"margin-left:90px\">[bool](Get-member -Name time -InputObject (get-date) -MemberType Property)<\/p>\n<p style=\"margin-left:60px\"><b>Note&nbsp;<\/b>&nbsp;I got this idea from Microsoft PFE, Clint Huffman. He uses it in his PAL data collector. He has a note <br \/>in that script that says he got the idea from Jeffery Snover. Cool&hellip;<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" alt=\" \" \/><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Determine if a property is a member of an object in Windows PowerShell. &nbsp;How can I determine if a specific property is actually a member of an object in my Windows PowerShell script? &nbsp;Use the&nbsp;Get-Member&nbsp;cmdlet, and cast the response into a Boolean data type by using the&nbsp;[bool]&nbsp;type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accelerator, [&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":[356,3,4,45,247],"class_list":["post-6441","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-scripting-techniques","tag-windows-powershell","tag-writing-scripts"],"acf":[],"blog_post_summary":"<p>Summary: Determine if a property is a member of an object in Windows PowerShell. &nbsp;How can I determine if a specific property is actually a member of an object in my Windows PowerShell script? &nbsp;Use the&nbsp;Get-Member&nbsp;cmdlet, and cast the response into a Boolean data type by using the&nbsp;[bool]&nbsp;type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; accelerator, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/6441","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=6441"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/6441\/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=6441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=6441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=6441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}