1. Introduction of Windows PowerShell “Desired State Configuration”
2. Installing Windows PowerShell 4.0 [Windows Management Framework 4.0]
3. Getting Started With Desired State Configuration: DSC Syntax
4. Review of Desired State Configuration: The 3 easy steps.
5. Write your First Desired State Configuration Script using ROLE Resource.
In my previous blog post we have written our first “DSC” script.
Now it time to run that script.
Before running the script, let’s check manually if, “XPS-Viewer” and “PowerShell-ISE” are installed or not on our “Posh-Demo” server.
To check this, we can run Get-WindowsFeature -Name 'XPS-Viewer’, 'PowerShell-ISE’ to check if both of these applications are already installed or not.
You can see in the below screenshot, that these two features are not yet installed.
Ok, OK, you can check the “Start Menu” too for cross verification.
Happy? There are no “XPS Viewer” and “PowerShell-ISe” installed.
Now, let’s back to our PowerShell ISe and run the script.
When we run the “DSC” script, it creates a folder in the Module folder (we have to change to the module folder manually, we did this in our previous blog post), and it create a MOF file for the server which we have mentioned in the NODE block inside that folder.
The folder will be create same as the name of our Configuration file. and the MOF file created as the name of Node script block.
For example, if you have mentioned 3 nodes in the script block 'Server-1, DC-4 , File-Server', then DSC script will generate 3 files in under the same folder.
In our script code the name of the configuration is “myServerRoles” and you can see, that script create a new folder exact as the name of the configuration NAME value.
We can see the folder crated inside my Windows PowerShell modules folder,
Let’s check what is inside it.
You will find the MOF file inside that folder. You should notice that, the name of the file is same as the Server name, which we provided in the NODE block.
.
Cool!
Now, come back to our PowerShell-ISE again.
And run the Start-DscConfiguration cmdlet with the path to our configuration folder with –wait and –verbose parameters to deploy this MOF file, this method is known and PUSH method.
Start-DscConfiguration .\myServerRoles -Wait -Verbose
And you see, something is started.
And
It’s doing something.
And it finishing done something.
So, it’s finished, the script. And it’s time to verify that what Something has done?
I am Going to our server again and run the same command of “Get-WindowsFeature -Name 'XPS-Viewer’, 'PowerShell-ISE’”
And you can see a cute [X] in the front of “XPS Viewer” and “PowerShell ISe” J and both service are installed.
And let’s check our start menu too. And ha. It’s there, it’s there and it’s there J
Congratulations! We have successfully written, configured and deployed our first “DSC” Script J
Thanks for reading and your time, see you in my next blog posts.
Regards
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube” channel for PowerShell video tutorials. You can download all of my scripts from “Microsoft TechNet Gallery”.
This comment has been removed by a blog administrator.
ReplyDelete