Skip to content

5000+ Great Articles

Best Articles & Essays: Interesting Articles to Read Online

  • How To Set Up a VPN With Cisco How-To
  • Opinion: Why Smart Home Industry needs to look above the walls of their Gardens? How-To
  • Disable the built-in pdf viewer in firefox Computer Tips
  • When Was The Internet Invented? 10 Facts You Probably Didn’t Know technology
  • Best ti-30xa calculator 2020

    Best ti-30xa calculator 2020. 1 - Texas Instruments TI30XA TI-30Xa Scientific Calculator, 10-Digit LCD Top Reviews Very pl

  • How To Remove Stubborn Malware How-To
  • Remove File Type Associations in Windows 7 Windows 7
  • Easy Ways to Change Fonts in WordPress Wordpress

Desired State Configuration in PowerShell

Posted on October 9, 2020 By blog_786 No Comments on Desired State Configuration in PowerShell

Hello everyone and welcome to a new and interesting article on PowerShell. This time we will learn how to implement DSC using PowerShell.

DSC is basically configuration as code, where we customize certain aspects of the system using some type of manifest, or better yet, a configuration file.

DSC is a PowerShell alternative to other technologies that provide DSC capability.

Desired State Configuration in PowerShell

What DSC does for us is helps us prevent configuration drift by making sure the settings stay the same, and it can also help us define environments like production and testing without really needing to separate them in terms of infrastructure.

Now I’m sure you are wondering what configuration drift is. Let’s say you are creating a server template with specific configuration like roles, shares, etc.

You then grant access to that server to another team, such as the QA group, and that group starts removing roles and shares or making changes that shouldn’t be made due to policy. Well, DSC helps you keep all of your configuration in place.

Every time someone makes changes to a configuration that you configured in DSC, DSC will revert that configuration to its original state that you defined in the configuration file.

Now let’s take a look at an example DSC config block and how we use it.

To define the DSC block, we use the Configuration parameter.

Configuration RoleConfiguration {
MYSERVER Node {
WindowsFeature FeatureIwantToKeep {
Ensure = ‘Present’
Name = ‘FS-FileServer’
}
}
}
RoleConfiguration

This is now a configuration block that basically ensures that the FileServer role is always installed on the system of our choice. In my case, the server name is MYSERVER .

Now let’s take a look at the above script block and see what’s what.

Configuration states that we are performing DSC configuration.

The Host is the server or servers to which we want to apply this DSC configuration.

WindowsFeature we tell the config block that the required configuration belongs to the Windows Server role.

Ensure along with Present speaks for itself. We want to make sure the role is present, installed.

Name is the name of the Windows role or feature we want to test.

The last line runs a configuration named RoleConfiguration .

Now the next step is to compile the configuration. To do this, we simply run a script named RoleConfiguration.ps1

This will create an mof file and place it in this computer’s configuration store.

The local configuration manager responsible for DSC configuration will now read this mof file and apply the configuration at 15 minute intervals.

That’s all!

There are now a lot more configurable parameters like arguments, arrays, etc. to make it more dynamic. We can also create multiple mofs with multiple configurations and use them centrally in PULL mode instead of PUSH, which is used when the DSC LCM is local.

But this is all for another more complex article.

Thanks for reading this article and I hope it helped you get a basic understanding of DSC and why it’s a really cool feature.

Share this:

  • Twitter
  • Facebook
Script Tags:Desired State Configuration in PowerShell

Post navigation

Previous Post: How to Upgrade Microsoft SQL Server the Right Way
Next Post: How to Remove a Hyper-V VM Snapshot using PowerShell

Related Posts

  • Best Practices for Signing a Windows PowerShell Script Script
  • Calculadora Paypal : Calcular Comisiones de Paypal Calculator
  • How to Use the Microsoft Anti-Malware Script Interface Script

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Archives

  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • March 2021
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • December 2019
  • July 2019
  • May 2019
  • April 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018

Categories

  • AI Tools & Guides
  • Amazon Web Services
  • Apple Watch
  • Computer Tips
  • Cool Websites
  • Featured Posts
  • Free Software Downloads
  • Gadgets
  • Gaming
  • General Software
  • Google Software/Tips
  • Hardware
  • Help Desk
  • How-To
  • iOS
  • iPad
  • iPhone
  • islamic Books
  • Linux
  • Linux Tips
  • Mac OS X
  • macOS
  • MS Office Tips
  • Networking
  • Office Tips
  • OS X
  • Product Reviews
  • Reviews
  • Safari
  • Smart Home
  • Smartphones
  • Software Reviews
  • technology
  • text
  • Tools Review
  • Troubleshooting
  • Tutorials
  • Uncategorized
  • Urdu Books PDF
  • Web Site Tips
  • Windows
  • Windows 10
  • Windows 7
  • Windows XP Tips
  • Wordpress
  • How to Get 2 Free Audiobooks From Audible Trial Instead of 1
  • 10 Things to Check Before Publishing a YouTube Video
  • A Simple Trick to Get 50% Discount on Audible for Three Months
  • How to reset your SIM card
  • This Simple Trick Lets You Play YouTube in the Background on iOS
DMCA.com Protection Status

Recent Posts

  • How to Get 2 Free Audiobooks From Audible Trial Instead of 1
  • 10 Things to Check Before Publishing a YouTube Video
  • MailTag: Real-time Email Tracking, Made Easy
  • Pokemon Sleep: what is it and how to play
  • How to Respond to Messages on Instagram (Mobile and PC)

Recent Comments

  1. This Simple Trick Lets You Play YouTube in the Background on iOS on YouTube Not Working? Here Are Quick Fixes To Try
  2. How to Bypass Chromecast DNS and Circumvent Geo Blocking on 5 Cool Websites to Find Good Movies and TV Shows on Netflix
  3. 5 Cool Websites to Find Good Movies and TV Shows on Netflix on check netflix video quality internet explorer
  4. SmartDNS vs VPN “What’s the Difference?” on How to Watch Apple TV on Roku
  5. How to go Back to the old YouTube Layout (2013) on 10 Things to Check Before Publishing a YouTube Video
  • How to Enable System Restore in Windows 7 Windows 7
  • Airbnb alternatives Canada in 2021 Cool Websites
  • 6 Easy Ways To Speed Up Your Ubuntu Installation Linux Tips
  • 5 Ways To Secure Your WiFi Networking
  • How to Troubleshoot Chromecast Audio Issues Computer Tips
  • Ultimate Troubleshooting Guide for Windows 7 Hanging Issues Featured Posts
  • How to Fix an IP Address Conflict Computer Tips
  • Your Windows 10 PC Did Not Start Correctly 2021 Windows

Copyright © 2023 How To Blog.

Powered by PressBook News WordPress theme

Go to mobile version