Click to Rate and Give Feedback
Tips
Understand when SQL Server uses parallel processing and learn how to configure parallel processing for your database. ...

Read more!

Windows Vista offers built-in support for more control over screenshots. Find out what you can do with the Snipping Tool. ...

Read more!

Are you familiar with the Wbadmin Backup Command Line Utility? Wbadmin is the command-line counterpart to Windows Server Backup. You use Wbadmin to manage all aspects of backup configuration that you would otherwise manage in Windows Server Backup. For more info, read on. ...

Read more!

Are you hesitant to install the Windows 7 beta on your system? It's actually quite easy to prep your Windows Vista system to dual boot both operating systems--and all the tools you need are readily available in Windows Vista. Find out how. ...

Read more!

Think part of your database is missing or corrupted? Find out how you can perform a partial restore to recover the missing or corrupted data. ...

Read more!

Related Articles

Don Jones continues his look at how you can use Windows PowerShell to automate user provisioning. In this installment, Don details the function that will create a mail-enabled user in Active Directory.

Don Jones

TechNet Magazine April 2009

...

Read more!

You need to calculate server downtime in order to report on server uptime. The Scripting Guys have a Windows PowerShell script that can do this for you.

The Microsoft Scripting Guys

TechNet Magazine December 2008

...

Read more!

Don Jones kicks off a four part series that will look at how you can use Windows PowerShell to create a real-world user provisioning script.

Don Jones

TechNet Magazine March 2009

...

Read more!

With Windows Vista, the UserAccounts.CommonDialog ActiveX control for opening a file open dialog box no longer exists. Here's a look at how you can solve that problem using Visual Basic Express Edition.

The Microsoft Scripting Guys

TechNet Magazine August 2008

...

Read more!

Don Jones discusses filtering functions, the pipeline, custom objects, and how ping-pong balls hold the secret to understanding Windows PowerShell.

Don Jones

TechNet Magazine July 2008

...

Read more!

Popular Articles

See how the free Microsoft USB Flash Drive Manager can help you easily copy, delete, and back up files from a flash drive, as well as perform other useful tasks.

Lance Whitney

TechNet Magazine January 2009

...

Read more!

Why do attachment sizes increase when sending and receiving e-mail messages? How can you ensure databases on a passive node in a CCR cluster are defragmented during online maintenance? Can you use an external trust between forests? We answer these questions and more.

Henrik Walther

TechNet Magazine January 2009

...

Read more!

Windows Vista SP1 and Windows Server 2008 introduce important changes to BitLocker, including support for data volumes and improved protection against cryptographic attacks. Byron Hynes explores the new features, demonstrates how to use BitLocker on a server, and discusses some of the recent media coverage affecting BitLocker.

Byron Hynes

TechNet Magazine June 2008

...

Read more!

Greg Steen discusses recovering from system crashes with Replay RA - Recovery Accelerator, managing compressed archives with WinRAR, using TortoiseSVN to simplify source control, measuring disk I/O with Iometer, as well as rebooting servers remotely with the APC Switched Rack PDU, and looks at the book "Windows Group Policy: Windows Server 2008 and Windows Vista".

Greg Steen

TechNet Magazine January 2009

...

Read more!

Raymond Chen looks at the skewed relationship bugs have to errors, and explains why it's important that programmers suffer as well as give results.

Raymond Chen

TechNet Magazine October 2008

...

Read more!

Our Blog

NAP monitors the health of specified computers when they attempt to connect to a network and includes a number of mechanisms to enforce health requirements. In this article, Geek of All Trades Greg Shields gives readers an overview of these enforcement mechanisms and, as an example, takes a closer look at setting ...

Read more!

Use Windows PowerShell to Manage Virtual Machines Here are a few examples of how you can use Windows PowerShell scripts to manage virtual machines running on a Server Core installation. Note that these scripts are presented as samples and may need to be customized to work in your environment.

Create a New ...

Read more!

Disabling an Unused Part of Group Policy Objects One way to disable a policy is to disable an unused part of the GPO. By disabling part of a policy that isn’t used, the application of GPOs and security will be faster.

Administer Windows Server 2008 Server Core from the Command Prompt ...

Read more!

In the August 2008 issue of TechNet Magazine, Paul Randal wrote an article Top Tips for Effective Database Maintenance.  It was geared toward "involuntary  DBAs" (IT pros who inadvertently wind up responsible for a SQL Server instance).  The article had a great response from our readers so Paul has written another ...

Read more!

Microsoft Forefront is designed to deliver an integrated security solution that makes it much easier to deploy and manage security across an organization’s IT infrastructure. In this, our annual security issue, we feature two articles that describe how Forefront Security protects instant messaging and e-mail.

Protect ...

Read more!

Utility Spotlight WMI Code Creator
Chris Scoville

Download the code for this article: WMI Code Creator (122KB)

As a systems administrator you’re surely no stranger to Windows®Management Instrumentation (WMI), which gives you access to a wealth of management information and allows you to automate administrative tasks. To take full advantage of WMI you have to write queries to extract the information you need. And if you don’t have the ready-made queries already floating around in your head, you just might want to take the WMI Code Creator for a spin. It’s a recently released tool that generates custom code to use WMI so you can get the most from the myriad of computer management options that WMI has to offer.
The WMI Code Creator can generate code in VBScript, C#, and Visual Basic® .NET; you can run the code directly from the tool. You can generate code to query for management information, execute a management task, or receive event notifications.
For example, suppose you want to get a list of all the services running on a computer. You can use the WMI Code Creator to query for this information by selecting the WMI class you want to query (Win32_Service) and the properties that contain the information you are interested in accessing. And you can do more than just execute queries. Let’s say you want to start a service that isn’t running. You can use the WMI Code Creator to generate a script to do that too. All the code is generated for you based on a few selections you make. Plus, the tool contains step-by-step help to teach you how to use it to get the information you want.
The WMI Code Creator generates code that you can point at remote computers as well. You can query for the same kind of data you can get on local computers, receive event notifications, and even execute tasks remotely. All you need to do is enter the domain and name of the remote computer, and the code is generated automatically.
Figure 1 shows an example of event notification code generated by the WMI Code Creator. Note that you can set the frequency at which WMI should poll for the specified events, and you can edit or execute the code as well.
Figure 1 WMI Code Creator Generating Event Notification Code 
If you aren’t familiar with all of the WMI classes and their uses, the WMI Code Creator lets you browse through the available WMI classes on your computer, and displays descriptions of these classes, their properties, and methods. The WMI Code Creator also lets you quickly access the documentation for a WMI class by linking you to the specific class page in the MSDN® WMI documentation online.
The WMI Code Creator download also includes the source code, which serves as a really handy tool for learning how to use the System.Management classes in the Microsoft® .NET Framework to access WMI. The tool was built using WMI, and the source code provides many examples for how to use WMI to add functionality to an application.
Use the tool to open up a world of WMI functionality and all the computer management possibilities it provides. It will save you time writing administrative scripts and code, and provide you with excellent examples and solutions. You can download the utility from WMI Code Creator.

Chris Scoville is a programming writer in the Windows Server Developer Documentation group at Microsoft. He writes documentation and code examples for management technologies. He developed the WMI Code Creator tool.  Chris can be reached at chscovil@microsoft.com
© 2008 Microsoft Corporation and CMP Media, LLC. All rights reserved; reproduction in part or in whole without permission is prohibited.
Page view tracker