Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

PART 1 : POWERSHELL - CREATE LOCAL IIS WEB REPOSITORY FOR DSC MODULE

PART 1 : POWERSHELL - CREATE LOCAL IIS WEB REPOSITORY FOR DSC MODULE 
PART 2 : POWERSHELL - COPY DSC MODULE REMOTELY USING LOCAL WEB REPOSITORY

In my earlier PowerShell DSC (DESIRED STATE CONFIGURATION) : DEPLOYING ACTIVE DIRECTORY tutorial I shown how to Find and install Active Directory modules. In the script I had to copy module folder on the remote computer before running DSC script, otherwise I was getting error  THE POWERSHELL PROVIDER DOES NOT EXIST AT THE POWERSHELL MODULE PATH NOR IS IT REGISTERED AS A WMI PROVIDER, this is not only applicable to xActiveDirectory module but also applies to other modules also they should be present on remote computers before deploying DSC. Modules should be in the folder "C:\Program Files\WindowsPowerShell\Modules". For this to solve and improvise on this one I have created one in-house IIS based html repository, where I put all my dsc modules in zip format, then I can use in DSC script to copy and deploy remotely. 

Before starting I have used below commands to find and download all the required modules, Same I have shown in my above mentioned articles. 
Find-Module
Install-Module

Files are downloaded at my local computer on "C:\Program Files\WindowsPowerShell\Modules"

Next task I am Installing and creating one IIS web server, using below commands IIS web server role will be installed with all the default role services and I got Success in the Exist code, This does not require reboot.
Install-WindowsFeature Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Health, Web-Http-Logging, Web-Performance, Web-Stat-Compression, Web-Security, Web-Filtering, Web-Mgmt-Tools, Web-Mgmt-Console -IncludeManagementTools

Next setting directory browsing must be enabled on Default Web Site, So I can see all the modules files on web browser in Directory format. 
Set-WebConfigurationProperty -filter /system.webServer/directoryBrowse -name enabled -PSPath 'IIS:\Sites\Default Web Site' -Value $true

Powershell Install IIS web server and Set-WebConfigurationProperty directory browsing

Useful Blog related to DSC
POWERSHELL PS REMOTING BETWEEN STANDALONE WORKGROUP COMPUTERS
DSC (DESIRED STATE CONFIGURATION) : DEPLOYING ACTIVE DIRECTORY
POWERSHELL: USE PARAMETERS AND CONFIGURATION FROM INI FILE, USE AS SPLATTING
POWERSHELL CREATE HASHTABLE FROM MICROSOFT EXCEL

My IIS web server is setup and configured using PowerShell now, This can also be achieve this using ServerManager in Windows to add roles. I have already downloaded required PowerShell modules using Install-Module xActivedirectory (required powershell to be run in elevation as administrator and Internet is required, I will be taking only one module xActiveDirectory as a demo and verifing it using Get-DSCResource to check it is successfully loaded), Once I am all set on required modules I have created folder name Modules under C:\inetpub\wwwroot. This folder contains all my default web data and applications, which I am going to use and publish modules over HTTP to intranet computers or domain unjoined computers.

Powershell DSC IIS modules folder

Here I am creating Zip file of each folders located under "C:\Program Files\WindowsPowerShell\Modules\xmodule" and destination path will be C:\inetpub\wwwroot\Modules\.
Compress-Archive -Path "C:\Program Files\WindowsPowerShell\Modules\xActiveDirectory\2.11.0.0" -DestinationPath "C:\inetpub\wwwroot\Modules\xActiveDirectory.zip" -Force

Powershell DSC IIS modules folder and install-module dsc resource Zip

Once everything is successful, then I fired up http://localhostwebIP/Modules to test URL, now I am able to view all the module's zipped urls on this local default web site, which will work anywhere on my local network. I have downloaded other modules and zipped them to list here.

Powershell DSC Modules Zip local iis web repository

In my next article I will be showing how to use this local web dsc module repository remotely to configure computers remotely when you don't want to install modules from internet each time.

Go Back

Comment

Blog Search

Page Views

11362879

Follow me on Blogarama