Category: Scripting

  • How to setup Debug Mode in Windows PowerShell Desired State Configuration (DSC)

    If you work on custom DSC resources then debug mode is very handy for you because you may need to re-import your updated DSC resource again and again. Without re-import (force import) the DSC uses cache. How to set DebugMode: None Signifies that DebugMode is False and not applicable. ForceModuleImport Enforce the resource module to…

  • How to remove all PowerShell DSC configuration documents (MOF files)?

    Recently I got question from one developer that uses DSC about DSC configuration documents (MOF files) that are used for current configuration and he did not believe me that MOF file for current configuration is just a file in C:\Windows\System32\Configuration directory. I would like to present you a simple piece of code that shows you…

  • Simplify your PowerShell DSC Configurations by using parameterized DSC Resources

    Often I can see that DSC adopters use similar code: Configuration TooVerbose { Import-DscResource -ModuleName PSDesiredStateConfiguration Service abc { Name = ‘abc’ State = ‘Running’ Ensure = ‘Present’ } Service def { Name = ‘abc’ State = ‘Running’ Ensure = ‘Present’ } Service xyz { Name = ‘abc’ State = ‘Running’ Ensure = ‘Present’ }…

  • How to fix Could not load file or assembly Microsoft.Isam.Esent.Interop error when you setup PowerShell DSC HTTPS Pull Server

    I have just downloaded DSC Resource Kit Wave 10 and I can see that known error when you setup PowerShell Desired State Configuration (DSC) HTTP Pull Server was not fixed yet. The reason is that the resource kit is February release. The error is related to missing Microsoft.Isam.Esent.Interop assembly that is available on Windows 8.1 but not…

  • PowerShell script to get all IIS bindings and SSL certificates

    Simple PowerShell script to get all bindings in Internet Information Services (IIS) and SSL certificates. Import-Module -Name WebAdministration Get-ChildItem -Path IIS:SSLBindings | ForEach-Object -Process ` { if ($_.Sites) { $certificate = Get-ChildItem -Path CERT:LocalMachine/My | Where-Object -Property Thumbprint -EQ -Value $_.Thumbprint [PsCustomObject]@{ Sites = $_.Sites.Value CertificateFriendlyName = $certificate.FriendlyName CertificateDnsNameList = $certificate.DnsNameList CertificateNotAfter = $certificate.NotAfter CertificateIssuer…