Windows PowerShell & WMI win32_classes
To start to fully realize the Administrative power of WPS we are going to look at Windows Management Instrumentation (WMI). WMI classes are a good way to both manage and report on your servers, and to get to know the power of WPS. One way to get a jump on the WMI classes is to download this amazing WMI browsing tool from the powershell guy – http://thepowershellguy.com/blogs/posh/archive/2007/03/22/powershell-wmi-explorer-part-1.aspx, the entire tool is one big powershell script and very useful for exploring WMI classes. But I hear you saying takes too long, just show me the classes, well I have put together a very quick little script for pulling WMI classes in groups by first letter in powershell. Just copy the WMI_win32_classes.ps1 script from the WPS scripts page, save with a PS1 extention and run in powershell, make sure your execution policy is set to allow you to run scripts. I work in powershell directly to get the results I need and to quickly learn what it is capable of, it is the best way to explore the script. The WMI_win32_classes script will allow you to explore all the Win32 classes by first letter. HINT: want to see Win32 class for logicaldisk – just enter an “l”. The script will also give you some insigt on how to use a do until loop. Also if you want to see all the properties and methods of any particular class just pipe the class into the cmdlet get-member, (This cmdlet will soon be your friend for life). Here is quick example of how this works. Once you have looked around at some of the various WMI classes, just enter this at the WPS prompt: “gwmi win32_logicaldisk” (without quotes). You have found the win32_logicaldisk class using the quick little script tool you just loaded, and now you are calling it directly using the get-wmiobject alias (gwmi). the output you see are all the logical disks and their basic information on your machine. Now hit the up arrow to see the command you typed and add this to the command “| get-member”. you have just seen all the logical disks on you machine and then taken that same command and “piped” it into the get-member commandlet which shows you all the properties and methods of the WMI win32_logical disk class. The object properties hold all the information regrading the WMI object, and the object methods are the actions you can perform with the WMI object, in this case the logical disks on your machine. I am sure you are begining to see how powerful these classes are.
Here is another must have MS tool for WMI: WMI Administtrative tools http://www.microsoft.com/downloads/details.aspx?familyid=6430F853-1120-48DB-8CC5-F2ABDC3ED314&displaylang=en
In the next post we will be exploring how to create multiple server reports using WPS and WMI win32_classes.
Happy New Year!! Happy New Blog and Welcome!!
Enter Right Designs, the newest PowerShell & Best of Windows Technologies Blog. It is the beginning of a new decade in the first century of a new millennium. Ten years hence we may be talking with quantum technical devices in an, as yet, undiscovered language. This is without a doubt one of the most interesting and challenging times in all of human history, with both unprecedented opportunities, and possible pitfalls ahead.
This blog is dedicated to the free thinkers and creative geniuses who will architect the solutions for the future! To that end, join and help to build empowering solutions and dynamic, well managed infrastructures for the next generation. Windows PowerShell delivers unprecedented access, configurability, and control to every server that makes up your enterprise infrastructure. Look for new PowerShell resources, scripting techniques and scripts for managing, reporting, and automating your infrastructure in the coming weeks. Create the new paradigm of the 21st century managed enterprise, become a member, ask questions, make comments and suggestions, help to create the Right Designs! To start, I would like to ask you, what you think the top ten most needed automation scripts for your enterprise are (or would be). Let the discussion begin. I truly hope you enjoy your time here and find (and share) the resources you need! Regards – Michael

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Void « Default
Life
Earth
Wind
Water
Fire
Light 