Skip to content

How To Blog

how to

  • what is android auto and how does it work Software Reviews
  • vat calculator south africa – vat calculator sars Help Desk
  • How To Create a Retweet Twitter Bot Cool Websites
  • How To Quickly Unfollow a Game Channel On Nintendo Switch Gaming
  • Best calculator watch 2020 Calculator
  • Fix “Security Code Invalid” Error in iTunes Mac OS X
  • Best ti-84 plus c silver edition graphing calculator 2020

    Best ti-84 plus c silver edition graphing calculator 2020

  • How To Set Up & Use Find My Device On Android Smartphones

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.

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

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

Leave a Reply Cancel reply

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

  • Apple Watch
  • Computer Tips
  • Cool Websites
  • Free Software Downloads
  • Gadgets
  • Gaming
  • General Software
  • Google Software/Tips
  • Hardware
  • How-To
  • iOS
  • iPad
  • iPhone
  • Linux Tips
  • macOS
  • MS Office Tips
  • Networking
  • Product Reviews
  • Reviews
  • Safari
  • Smart Home
  • Smartphones
  • Software Reviews
  • technology
  • text
  • Tutorials
  • Uncategorized
  • Urdu Books PDF
  • Web Site Tips
  • Windows
  • Windows 10
  • January 2023
  • December 2022
  • 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
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • 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

2021 Android ) Apple apps Best browser change Chrome Closing words Concluding remarks Download Error Facebook From Google Image Internet Keyboard Mac make Movies Music online Packaging phone? Photos Print Search Shortcuts sites Switch Time Tips Tricks turn using Video Videos Watch What With Word Working? your YouTube

  • How to Play Retro Games on Steam Using Steam ROM Manager? How-To
  • The Best Telemedicine Apps of 2022 That Most Likely Accept Your Insurance Cool Websites
  • How To Plan a Custom PC Build – The Ultimate Guide for Dummies How-To
  • 7 Best Apple TV 4K Settings and Tricks 2022 Gadgets
  • 9 Best Linux Distros For Hacking Linux Tips
  • How to Send Files Too Big for Email How-To
  • Tribal noise – cancellation headphones Product Reviews
  • Is JBL Flip 6 loud? Gadgets

Copyright © 2023 How To Blog.

Powered by PressBook News WordPress theme

Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage vendors Read more about these purposes
View preferences
{title} {title} {title}
Go to mobile version