Code Monkey home page Code Monkey logo

cwindowsos's Introduction

DSCResources

Custom DSC resource modules for managing Windows OS configuration (miscellaneous) by PowerShell Magazine.


This module contains a collection of miscellaneous DSC custom and composite resources for some generic Windows OS configuration tasks.

At present, this DSC resource module includes 4 resources.

  • cHostsFile is used to manage Hosts file entries.
  • cAutoAdminLogon is used to add or remove auto administrator logon configuration. This is a composite resource.
  • cLoopBackCheck is used to enable or disable Loopback Check registry setting for web servers such as SharePoint Front End servers. This is a composite resource.
  • cDiskImage is used to mount or dismount ISO images.

Before you can use any of these resources in a configuration script, you must first import the cWindowsOS module or a specific resource from this module.

Import-DscResource -Module cWindowsOS
Import-DscResource -Module cWindowsOS -Name cHostsFile
Import-DscResource -Name cAutoAdminLogon

####Using cHostsFile resource#### The cHostsFile resource can used to manage the host file entries in Windows Operating System. This can be used to add or delete IPv4 and IPv6 hosts file entries.

The HostName and IPAddress properties are both mandatory. This resource will check for this pair in the hosts file and then decide if it needs to be added or removed.

cHostsFile HostsDemo {
    IPAddress = '10.10.10.1'
    HostName = 'Test10'
    Ensure = 'Present'
}

####Using cDiskImage resource#### The cDiskImage resource can be used to mount or dismount ISO images on the target systems.

When using this resource, both the DriveLetter and the ImagePath (ISO) must be specified. If the ISO image is already mounted with a different drive letter, this resource modifies it to the drive letter specified in the configuration script.

cDiskImage DiskImageDemo {
    ImagePath = 'C:\Software\WS12R2.ISO'
    DriveLetter = 'F'
    Ensure = 'Present'
}

The value specified for ImagePath can be an UNC path too. At present, there is no support for providing credentials to access the UNC path.

####Using cAutoAdminLogon resource#### The cAutoAdminLogon is a composite resource that enables or disables auto administrator logon.

The only mandatory parameter in this resource is the AutoAdminCredential. This takes a PSCredential object and therefore can be gathered using the Get-Credential cmdlet.

$Credential = Get-Credential
cAutoAdminLogon AutoAdminDemo {
    AutoAdminCredential = $Credential
    Ensure = 'Present'
}

Make a note that when using Credentials in DSC configuration scripts, you must encrypt them using certificates. If the certificates cannot be deployed in a test or development environment, you can use the PsDscAllowPlainTextPassword attribute in the DSC configuration data. Remember that this is not recommended in production environment.

####Using cLoopBackCheck resource#### The cLoopBackCheck resource can be used to enable or disable the LoopBackCheck registry setting on web servers such as SharePoint Front End servers. This is a composite resource that internally uses the Registry DSC resource to modify predefined settings.

The only property this resource requires is the Ensure property. By setting this to Present, the LoopBackCheck registry setting will be set and removed by setting it to Absent.

cLoopBackCheck LoopbackDemo {
    Ensure = 'Present'
}

cwindowsos's People

Contributors

rsabounds avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.