{"id":8491,"date":"2014-12-24T06:00:00","date_gmt":"2014-12-24T14:00:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=8491"},"modified":"2016-04-08T16:38:45","modified_gmt":"2016-04-08T23:38:45","slug":"find-variables-with-class","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/","title":{"rendered":"Find variables with class"},"content":{"rendered":"<p><a class=\"twitter-follow-button\" href=\"https:\/\/twitter.com\/juneb_get_help\" data-lang=\"en\">Follow @juneb_get_help<\/a><\/p>\n<p>I&#8217;ve been playing with the Windows PowerShell 5.0 preview and especially with its new <a href=\"http:\/\/www.sapien.com\/blog\/2014\/12\/02\/beyond-custom-objects-create-a-net-class\/\" target=\"_new\">class<\/a> feature. After I create my class, I often create several <em>instances<\/em> of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I saved each Wine instance in a variable.<\/p>\n<pre lang=\"PowerShell\">$PSWine = [Wine]::new(\"PSCabernet\")\r\n$Shiraz = [Wine]::new()\r\n...<\/pre>\n<p>After playing with the instances for a while (and enjoying a few sips of PSWine), I couldn&#8217;t remember all of the Wine objects that I&#8217;d created in my session. They were all in variables, so I used the Get-Variable cmdlet to find the $PSWine variable.<\/p>\n<pre class=\"output\">PS C:\\&gt; Get-Variable \u2013Name PSWine\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\r\n----\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ------\r\nPSWine\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine<\/pre>\n<p>Excellent! The value of the variable is the name of the class. This should make it easy to find the other variables.<\/p>\n<pre class=\"output\">PS C:\\&gt; Get-Variable | Where Value \u2013eq \"Wine\"\r\n\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\r\n----\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -----\r\n?\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 True\r\ntrue\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 True<\/pre>\n<p>That didn&#8217;t work, because the value of the Value property appears to contain &#8220;Wine&#8221;, but that&#8217;s just a display artifact. The Value of the variable is the entire Wine object.<\/p>\n<pre class=\"output\">PS C:\\&gt; (Get-Variable -Name PSWine).Value\r\n\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : PSCabernet\r\nWinery\u00a0\u00a0\u00a0\u00a0\u00a0 : Chateau Snover\r\nYear\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : 2012\r\nisSparkling : False\r\nColor\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : Red\r\nSweetness\u00a0\u00a0 : VeryDry\r\nDescription : Pithy\r\nRating\u00a0\u00a0\u00a0\u00a0\u00a0 : {96, 94}<\/pre>\n<p>To get Wine objects in the session, or objects of any particular type, such as strings or integers, call the <strong>GetType()<\/strong> method of the value and then take its <strong>Name<\/strong> property.<\/p>\n<pre class=\"output\">PS C:\\&gt; Get-Variable | where\u00a0 {$_.value.gettype().Name -eq \"Wine\"}\r\n\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\r\n----\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -----\r\nDuck\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine\r\n\r\nYou cannot call a method on a null-valued expression.\r\nAt line:1 char:24\r\n+ Get-Variable | where\u00a0 {$_.value.gettype().Name -eq \"Wine\"}\r\n+\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n+ CategoryInfo\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 : InvalidOperation: (:) [], RuntimeException\r\n+ FullyQualifiedErrorId : InvokeMethodOnNull\r\n\r\nPSWine\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine\r\nShiraz\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine<\/pre>\n<p>Oops! You have to account for variables that don&#8217;t have a value. I&#8217;ll use the <strong>AND<\/strong> operator to make sure that the variable has a value before I try to get the name of its value type. Windows PowerShell has a &#8220;lazy&#8221; <strong>AND<\/strong> operator, which means that if the first part of the <strong>AND<\/strong> statement isn&#8217;t true, since both parts must be true, it doesn&#8217;t even check the second part.<\/p>\n<pre class=\"output\">PS C:\\ps-test&gt; Get-Variable | where {$_.Value -and $_.Value.GetType().Name -eq \"Wine\"}\r\n\r\nName\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Value\r\n----\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -----\r\nDuck\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine\r\nPSWine\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine\r\nShiraz\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wine<\/pre>\n<p>It works on all types.<\/p>\n<pre class=\"output\">PS C:\\ps-test&gt; Get-Variable | \r\nwhere {$_.Value -and $_.Value.GetType().Name -eq \"ActionPreference\"}\r\n\r\nName                           Value\r\n----                           -----\r\nErrorActionPreference          Continue\r\nProgressPreference             Continue\r\nWarningPreference              Continue<\/pre>\n<p>Let&#8217;s turn this into a function:<\/p>\n<pre lang=\"PowerShell\">function Get-VariableOfType ($Type)\r\n{\r\n    Get-Variable | where {$_.Value -and $_.Value.GetType().Name -eq\u00a0 $type}\r\n}<\/pre>\n<p>Now, back to that Wine glass &#8212;\u00a0 I mean class!<\/p>\n<p><em>June Blender is a technology evangelist at SAPIEN Technologies, Inc. You can reach her at <\/em><a href=\"mailto:juneb@sapien.com\"><em>juneb@sapien.com<\/em><\/a><em> or follow her on Twitter at <\/em><a href=\"https:\/\/twitter.com\/juneb_get_help\"><em>@juneb_get_help<\/em><\/a><em>.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Follow @juneb_get_help I&#8217;ve been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1033,941,25],"tags":[934,28],"class_list":["post-8491","post","type-post","status-publish","format-standard","hentry","category-classes-in-powershell-5-0","category-powershell-5-0","category-windows-powershell","tag-juneb","tag-powershell"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Follow @juneb_get_help I&#039;ve been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"June Blender\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Find variables with class - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Follow @juneb_get_help I&#039;ve been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2014-12-24T14:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-04-08T23:38:45+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Find variables with class - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Follow @juneb_get_help I&#039;ve been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#blogposting\",\"name\":\"Find variables with class - DEV SAPIEN Blog\",\"headline\":\"Find variables with class\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-12-24T06:00:00-08:00\",\"dateModified\":\"2016-04-08T16:38:45-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#webpage\"},\"articleSection\":\"Classes in PowerShell 5.0, PowerShell 5.0, Windows PowerShell, juneb, powershell\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"position\":2,\"name\":\"Windows PowerShell\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#listItem\",\"name\":\"Find variables with class\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#listItem\",\"position\":3,\"name\":\"Find variables with class\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/\",\"name\":\"June Blender\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/\",\"name\":\"Find variables with class - DEV SAPIEN Blog\",\"description\":\"Follow @juneb_get_help I've been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2014\\\/12\\\/24\\\/find-variables-with-class\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"datePublished\":\"2014-12-24T06:00:00-08:00\",\"dateModified\":\"2016-04-08T16:38:45-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Find variables with class - DEV SAPIEN Blog","description":"Follow @juneb_get_help I've been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I","canonical_url":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#blogposting","name":"Find variables with class - DEV SAPIEN Blog","headline":"Find variables with class","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"datePublished":"2014-12-24T06:00:00-08:00","dateModified":"2016-04-08T16:38:45-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#webpage"},"articleSection":"Classes in PowerShell 5.0, PowerShell 5.0, Windows PowerShell, juneb, powershell"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","position":2,"name":"Windows PowerShell","item":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#listItem","name":"Find variables with class"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#listItem","position":3,"name":"Find variables with class","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/","name":"June Blender"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/","name":"Find variables with class - DEV SAPIEN Blog","description":"Follow @juneb_get_help I've been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"datePublished":"2014-12-24T06:00:00-08:00","dateModified":"2016-04-08T16:38:45-07:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"Find variables with class - DEV SAPIEN Blog","og:description":"Follow @juneb_get_help I've been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I","og:url":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/","article:published_time":"2014-12-24T14:00:00+00:00","article:modified_time":"2016-04-08T23:38:45+00:00","twitter:card":"summary_large_image","twitter:title":"Find variables with class - DEV SAPIEN Blog","twitter:description":"Follow @juneb_get_help I've been playing with the Windows PowerShell 5.0 preview and especially with its new class feature. After I create my class, I often create several instances of the class and experiment with them in my session. For example, I created a Wine class and then created several instances of my wine class. I"},"aioseo_meta_data":{"post_id":"8491","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 15:54:21","updated":"2026-08-28 15:54:21"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/\" title=\"Windows PowerShell\">Windows PowerShell<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tFind variables with class\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"Windows PowerShell","link":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/"},{"label":"Find variables with class","link":"https:\/\/dev.sapien.com\/blog\/2014\/12\/24\/find-variables-with-class\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/8491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=8491"}],"version-history":[{"count":12,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/8491\/revisions"}],"predecessor-version":[{"id":8504,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/8491\/revisions\/8504"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=8491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=8491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=8491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}