Windows Management Framework are v4 includes a new feature; Desired State configuration. This is the second in a series of articles handed a drink instead of a fire hose desired state configuration with the intention to describe you get into it.
In the previous post I made an attempt to move all the introduction of parts of the desired state configuration. This is an introduction to the basics of ability it brings, and I'll explain how it works to walk through a very simple example.
Just to avoid confusion, I will follow the pattern that you see in many of the blogs, with a lot of words around him. That is, it is rare to find a discussion of the MOF document itself. Most articles focus on the MOF configuration generating and applying it then. But I want to be clear to you that there is a separation.
In my example, I work in the PowerShell ISE instead of a console. It's still just a PowerShell session running in my security context.
I assume that you know what localhost is (runs the machine where I am commands).
First, I have a PowerShell script (a series of commands), which creates a configuration in the memory, writes the configuration to a MOF document, and then apply that configuration to localhost. MSFT referred to this configuration as configuration data at this point. No configuration until it is written to the MOF
Here is the sample that refers to this product .:
Lets first look at lines 2 - 14 special function "configuration" is used to explain a configuration called "sample" in square brackets
Within the configuration "sample" is a node element, it is named 'localhost' .. This node is the computer (s) the configuration is valid. It must match / solve be applied for configuring a computer name. I could quickly get here complex and I deliberately tried to avoid that. Lets just keep it at the moment on the local computer *.
within the node is a state of a DSC resource. In this case, the file resource, which is incorporated. I called this file state 'citrixFolder' (each defined state has a name, I'll mention that later more).
The file resource parameters. I have determined that ensure "presence" (there is) the way (so that they do not think I'm a file definition) as "directory" and the path. If I'd said this to say: "to ensure that a directory named" Easy Button "exists in the path C: Program Files Citrix Easy Button"
I then connect each element of the configuration
on 17 line I call the configuration named example - would call a function in the same way
What that means is a folder create sample and within that a MOF document -... sample localhost.mof (note the '. ' in the way. I have not defined a literal way for the exit).
If I localhost.mof look, I can see how this looks in the format MOF.
you can see that it was created by me, and my work is called Roller, and the time and date and the configuration that I defined for the node localhost ,
Now lets apply this configuration - it is a reality. That's where line 20 of the sample script comes into play.
I start the DSC-configuration engine and say it to the configurations. Sample found on the computer localhost apply. I force the action, I urge the verbose output, and I want to wait. At length comes in handy to show you what happens. Wait makes the configuration in the session are carried out, instead of getting a job thread from. Useful for debugging.
As the first thing from the detailed output that has happened, can see that the current state is evaluated. Then the local configuration manager will decide whether it needs to make a change. In this case, the test is "the directory C: Program Files Citrix EasyButton available" returned false. So the sentence is called that change to make. The change is a success and the local Configuration Manager continues.
The behavior of the local configuration manager and can be changed. Since a configuration (make the changes) can be applied, or applied and enforced (make the changes and ensure that nothing changes), or applied and monitored (make the changes and to throw an event when something changes) , Later more.
* I'm sure some can think of you more than one node name, or more node elements all to them fed with the same title (a large document defined nodes). Then, only the configuration that is used matches the machine name.
Like what you read here? Read other posts about desired state configuration
0 Komentar