<?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 'functions' and 'WMI'</title><link>http://powershell.com/cs/search/SearchResults.aspx?q=app:weblogs&amp;tag=functions,WMI&amp;orTags=0&amp;o=DateDescending</link><description>Search results for 'app:weblogs' matching tags 'functions' and 'WMI'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 (Build: 30929.2835)</generator><item><title>Find Files with PowerShell 3.0</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2013/02/07/find-files-with-powershell-3-0.aspx</link><pubDate>Thu, 07 Feb 2013 06:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:21472</guid><dc:creator>Anonymous</dc:creator><description>My last few articles have looked at using WMI and CIM_DATAFILE class to find files, primarily using Get-WmiObject in PowerShell. But now that we have PowerShell 3.0 at our disposal, we can use the new CIM cmdlets. So I took my most recent version of Get-CIMFile and revised it specifically to use Get-CimInstance. I also [...]</description></item><item><title>Scripting with PSCredential</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2012/04/10/scripting-with-pscredential.aspx</link><pubDate>Tue, 10 Apr 2012 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:15889</guid><dc:creator>Anonymous</dc:creator><description>
I see this question often: how can I pass a parameter value for a PSCredential that might be a credential object or it might be a user name? In the past I&amp;#8217;ve used code like this: begin &amp;#123; &amp;#160; &amp;#160; &amp;#8230; &lt;a href="http://jdhitsolutions.com/blog/2012/04/scripting-with-pscredential/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;</description></item><item><title>Use a PowerShell Function to Find Specific WMI Classes</title><link>http://powershell.com/cs/blogs/hey-scriptingguy/archive/2011/10/22/use-a-powershell-function-to-find-specific-wmi-classes.aspx</link><pubDate>Sat, 22 Oct 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:12873</guid><dc:creator>Anonymous</dc:creator><description>&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt; Use a Windows PowerShell function to find WMI classes with specific qualifiers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Microsoft Scripting Guy Ed Wilson here. In &lt;a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/10/20/use-the-set-wmiinstance-powershell-cmdlet-to-ease-configuration.aspx"&gt;Thursday&amp;rsquo;s article&lt;/a&gt;, I talked about using the &lt;b&gt;Set-WmiInstance&lt;/b&gt; cmdlet to work with WMI classes. One of the parameters, the &lt;i&gt;class &lt;/i&gt;parameter, works with WMI singleton objects. Now, it is certainly possible to use WBEMTest to find singleton WMI classes. Such a WMI class is shown in the following figure in the WBEMTest utility.&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/5383.hsg_2D00_10_2D00_22_2D00_11_2D00_1.png"&gt;&lt;img title="Image of a WMI singleton class" alt="Image of a WMI singleton class" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/5383.hsg_2D00_10_2D00_22_2D00_11_2D00_1.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But with 1,085 WMI classes in Root\Cimv2, it is faster and more fun to use a WMI schema query. WMI schema queries are &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa393278(v=vs.85).aspx"&gt;mentioned on MSDN&lt;/a&gt;, but there are no Windows PowerShell examples. I decided I needed to write a Windows PowerShell function that would query the schema to find the singleton classes for which I was looking. In addition, there are other class qualifiers I was interested in seeing as well. For example, there is a &lt;b&gt;supportsupdate&lt;/b&gt;&lt;i&gt; &lt;/i&gt;qualifier that lets me know that I can use that class to make modifications to a computer. There are other qualifiers that are even more important: &lt;b&gt;abstract&lt;/b&gt; and &lt;b&gt;dynamic&lt;/b&gt;. As an IT pro, I want to query &lt;i&gt;dynamic &lt;/i&gt;WMI classes, and not the abstracts. For ease of use, I uploaded the script to the &lt;a href="http://gallery.technet.microsoft.com/scriptcenter/Get-WMI-Class-qualifiers-239970e7"&gt;Scripting Guys Script Repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I ended up writing a function I could use to find classes with specific qualifiers. As shown in the following figure, there are a few &lt;b&gt;singleton&lt;/b&gt;&lt;i&gt; &lt;/i&gt;WMI classes. I opened the function in the Windows PowerShell ISE, ran the script once to load the function into memory, and then I went to the command pane and typed the following command:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Get-WMIClassesWithQualifiers -qualifier singleton&lt;/p&gt;
&lt;p&gt;The command and associated output are shown in the following figure.&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/7120.hsg_2D00_10_2D00_22_2D00_11_2D00_2.png"&gt;&lt;img title="Image of command and associated output" alt="Image of command and associated output" src="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-76-18/7120.hsg_2D00_10_2D00_22_2D00_11_2D00_2.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A WMI schema query queries the &lt;b&gt;meta_class&lt;/b&gt; WMI class. It uses the &lt;b&gt;isa&lt;/b&gt;&lt;i&gt; &lt;/i&gt;keyword to specify from which WMI class I want to return the schema information. That part is rather simple. The difficult part was getting the quotation marks placed in the right position to enable automatic querying. Here is the query line I derived:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$query = &amp;quot;select * from meta_class where __this isa &amp;quot;&amp;quot;$($class.name)&amp;quot;&amp;quot; &amp;quot;&lt;/p&gt;
&lt;p&gt;I am interested in the qualifiers; therefore, I choose only the name of the WMI class and the qualifiers. This line appears is shown here:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;$a = gwmi -Query $query -Namespace $namespace |&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; select -Property __class, qualifiers&lt;/p&gt;
&lt;p&gt;If the qualifiers contain the qualifier I am looking for, I return the WMI class name:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;if($a.qualifiers | % { $_ | ? { $_.name -match &amp;quot;$qualifier&amp;quot; }})&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $a.__class }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The core portion of the script, with the aliases removed is shown here:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Param([string]$qualifier = &amp;quot;dynamic&amp;quot;,&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; [string]$namespace = &amp;quot;root\cimv2&amp;quot;)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;$classes = Get-WmiObject -list -namespace $namespace&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;foreach($class in $classes)&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;{&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; $query = &amp;quot;Select * from meta_class where __this isa &amp;quot;&amp;quot;$($class.name)&amp;quot;&amp;quot; &amp;quot;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; $a = Get-WmiObject -Query $query -Namespace $namespace |&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; Select-Object -Property __class, qualifiers&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp; if($a.qualifiers | ForEach-Object { $_ | Where-Object { $_.name -match &amp;quot;$qualifier&amp;quot; }})&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $a.__class }&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&amp;nbsp; } #end foreach $class&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Well, that is about it for today. I hope you enjoy the function, and have an awesome weekend.&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"&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;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Ed Wilson, Microsoft Scripting Guy&lt;/b&gt;&lt;/p&gt;
&lt;p&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=3459745" width="1" height="1" alt="" /&gt;</description></item><item><title>Get Local Administrators with WMI and PowerShell</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2011/07/01/get-local-administrators-with-wmi-and-powershell.aspx</link><pubDate>Fri, 01 Jul 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:11158</guid><dc:creator>Anonymous</dc:creator><description>Earlier this week I was helping someone out on a problem working with the local administrators group. There are a variety of ways to enumerate the members of a local group. The code he was using involved WMI. I hadn&amp;#8217;t &amp;#8230; &lt;a href="http://jdhitsolutions.com/blog/2011/07/get-local-administrators-with-wmi-and-powershell/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=Krmnu9bt2WI:pEd3ZLmoce0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=yIl2AUoC8zA" border="0" alt="" /&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=Krmnu9bt2WI:pEd3ZLmoce0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=7Q72WNTAKBA" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JeffsScriptingBlogAndMore/~4/Krmnu9bt2WI" height="1" width="1" alt="" /&gt;</description></item><item><title>Get WMI Namespace</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2011/06/16/get-wmi-namespace.aspx</link><pubDate>Thu, 16 Jun 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10874</guid><dc:creator>Anonymous</dc:creator><description>PowerShell and WMI just seem to go together like peanut butter and jelly, beer and pretzels, or salt and pepper. However, discovering things about WMI isn&amp;#8217;t always so easy. There are plenty of tools and scripts that will help you &amp;#8230; &lt;a href="http://jdhitsolutions.com/blog/2011/06/get-wmi-namespace/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=wU2tNFGjIhI:OUw_J1J4ClE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=yIl2AUoC8zA" border="0" alt="" /&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=wU2tNFGjIhI:OUw_J1J4ClE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=7Q72WNTAKBA" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JeffsScriptingBlogAndMore/~4/wU2tNFGjIhI" height="1" width="1" alt="" /&gt;</description></item><item><title>Get Registry Size and Age</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2011/05/04/get-registry-size-and-age.aspx</link><pubDate>Wed, 04 May 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10317</guid><dc:creator>Anonymous</dc:creator><description>I&amp;#8217;m not sure why the registry has been on my mind lately. I probably need a vacation to get out more. But I put together a relatively simple Windows PowerShell function to retrieve registry statistics that you might find useful. &amp;#8230; &lt;a href="http://jdhitsolutions.com/blog/2011/05/get-registry-size-and-age/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=TqpqKfuCpqk:657tKIqiFEM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=yIl2AUoC8zA" border="0" alt="" /&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=TqpqKfuCpqk:657tKIqiFEM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=7Q72WNTAKBA" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JeffsScriptingBlogAndMore/~4/TqpqKfuCpqk" height="1" width="1" alt="" /&gt;</description></item><item><title>Scripting Games 2011 Beginner Event 5 Commentary</title><link>http://powershell.com/cs/blogs/lonelyadministrator/archive/2011/04/25/scripting-games-2011-beginner-event-5-commentary.aspx</link><pubDate>Mon, 25 Apr 2011 05:00:00 GMT</pubDate><guid isPermaLink="false">f421715f-7aba-45f0-8a8d-44de5318a3a7:10324</guid><dc:creator>Anonymous</dc:creator><description>My commentary for Beginner Event 5 in the 2011 Scripting Games is now available. One item that seems to be missing on the ScriptingGuys site is my complete solution so I thought I would share it here, plus a variation. &amp;#8230; &lt;a href="http://jdhitsolutions.com/blog/2011/04/scripting-games-2001-beginner-event-5-commentary/"&gt;Continue reading &lt;span class="meta-nav"&gt;&amp;#8594;&lt;/span&gt;&lt;/a&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=CByveXYppcs:eWw6wNJWKoE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=yIl2AUoC8zA" border="0" alt="" /&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?a=CByveXYppcs:eWw6wNJWKoE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/JeffsScriptingBlogAndMore?d=7Q72WNTAKBA" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/JeffsScriptingBlogAndMore/~4/CByveXYppcs" height="1" width="1" alt="" /&gt;</description></item></channel></rss>