Querying and Updating the WMI Repository

05/30/2009

You can use Windows Management Instrumentation (WMI) to view and update a running application's configuration data when you use the Manageable Configuration Source to expose your Enterprise Library configuration. The Manageable Configuration Source reads information from the configuration file, applies any applicable Group Policy overrides, and exposes the configuration information to applications as a series of configuration class instances in the same way as the other Enterprise Library configuration sources.

However, the Manageable Configuration Source also exposes the configuration information through the .NET WMI 2.0 API and to the WMI Repository as a set of WMI classes that you can query and view. This allows administrators and users to examine configuration information using standard Windows-based management tools or code.

In addition, administrators and users can update the values of the WMI objects using standard Windows-based management tools or code. These changes update the configuration information exposed to the application by the Manageable Configuration Source, which also raises a ConfigurationChanged event that allows the application to react to the changes and reload the new configuration values.

Note:
You must have the relevant Windows permissions to update WMI objects. In addition, as changes pass back to the Manageable Configuration Source, it reapplies any relevant Group Policy overrides. If the change conflicts with a Group Policy setting, the Manageable Configuration Source will ignore the change and continue to expose the Group Policy-applied value.

Changes you make to the configuration exposed by the WMI objects are exposed by the Manageable Configuration Source and are visible in the application. However, they do not change the contents of the original configuration file. When the application restarts, or if you make changes to the configuration file contents, any updates made through WMI are lost. 

The following table lists the ways you can query and update values in the WMI Repository.

Posted in: .Net Programming| Tags: Application Configuration Enterprise Library Group Manageable Policy Query Repository Source Update WMI file information management

Understanding Important Windows PowerShell Concepts

05/27/2009

The Windows PowerShell design integrates concepts from many different environments. Several of them are familiar to people with experience in specific shells or programming environments, but very few people will know about all of them. Looking at some of these concepts provides a useful overview of the shell.

Commands are not Text-based

Unlike traditional command-line interface commands, Windows PowerShell cmdlets are designed to deal with objects - structured information that is more than just a string of characters appearing on the screen. Command output always carries along extra information that you can use if you need it. We will discuss this topic in depth in this document.

If you have used text-processing tools to process command-line data in the past, you will find that they behave differently if you try to use them in Windows PowerShell. In most cases, you do not need text-processing tools to extract specific information. You can access portions of the data directly by using standard Windows PowerShell object manipulation commands.

The Command Family is Extensible

Interfaces such as Cmd.exe do not provide a way for you to directly extend the built-in command set. You can create external command-line tools that run in Cmd.exe, but these external tools do not have services, such as help integration, and Cmd.exe does not automatically know that they are valid commands.

The native binary commands in Windows PowerShell, known as cmdlets (pronounced command-lets), can be augmented by cmdlets that you create and that you add to Windows PowerShell by using snap-ins. Windows PowerShell snap-ins are compiled, just like binary tools in any other interface. You can use them to add Windows PowerShell providers to the shell, as well as new cmdlets.

Because of the special nature of the Windows PowerShell internal commands, we will refer to them as cmdlets.

Posted in: Internet Topic| Tags: Interface PowerShell Windows Concept Important command information toc name exe cmd shell

How to: Set Log Sink Levels (Code) (Velocity)

05/24/2009

On the server side, log sinks can only be configured in the cache host configuration file. For more information about these settings, see Log Sink Settings (Velocity).

To programmatically enable log sinks on the cache client, use the DataCacheFactory class static methods CreateLogSinks or EnableAllAvailableSinks. To disable log sinks programmatically, use the DisableLogSinks static method. For more information about log sink settings, see Log Sink Settings (Velocity).

Note 
These procedures assume that you have already prepared your development environment and set references to the "Velocity" assemblies, and so on. For more information, see How to: Prepare the Development Environment (Velocity)

To create log sinks programmatically on the cache client
Create a list of type DataCacheLogSink to contain the log sinks you want to enable.

Create a DataCacheLogSink object for each log sink you want to enable.

Specify the type of log sink you want by using the DataCacheSinkType enumeration in the sinkType parameter of the DataCacheLogSink constructor.

Specify the trace level of the log sink by using the System.Diagnostics.TraceLevel enumeration in the logLevel parameter of the DataCacheLogSink constructor.

(optional) If you are creating a file-based log sink, and you want to change the log file naming convention and storage location, define the log file naming convention with the sinkParam parameter of the DataCacheLogSink constructor. For more information about the file naming convention, see Log Sink Settings (Velocity).

Add each log sink that you created to the list you created in the first step.

Pass the list of log sinks to the sinkList parameter of the CreateLogSinks method to enable the log sinks on your cache client.

To enable all available log sinks programmatically on the cache client
Call the EnableAllAvailableSinks static method to enable the log sinks on your cache client.

To disable all log sinks programmatically on the cache client
Call the DisableLogSinks static method to enable the log sinks on your cache client.

Posted in: .Net Programming| Tags: .net 4.0 CTP CTP 3 Microsoft Velocity cache code set use sink settings log information levels

Hot Posts

Latest posts

Tags

Others

Sponsors