ServiceDudes / cMDT

A PowerShell Module that uses DSC for building MDT deployment solutions
MIT License
29 stars 7 forks source link

cMDT

cMDT is a Powershell Module to help automize MDT server deployment and configuration with Desired State Configuration.

You can use this module with a pull server, an SMB share or a local file repository.

Version

See: Changelog.md

Build Status

Build status

Prerequisites

cMDT uses a number of components and open resource kit modules. The following are prerequisites for the module and need to be installed to the inteded deployment server:

The following prerequisites can automatically be downloaded with the cMDT Module:

Note: The MDT and ADK versions must compatible for the DSC modules to work.

And of course the cMDT Module itself which is open source with a [public repository][dill] on GitHub or from the Powershell Gallery.

Installation

To install the cMDT Module from the Powershell Gallery:

  1. Make sure you have installed all prerequisites.
  2. Install the cMDT module (Install-Module cMDT)
  3. Create a source directory (Example: C:\Sources) If you use another driveletter and patch you need to edit the configuration file: (C:\Program Files\WindowsPowerShell\Modules\cMDT\\Examples\Deploy_MDT_Server_ConfigurationData.psd1)
  4. Copy install.wim file from a Windows 10 media to C:\Sources and rename the file to install_1.0.0.0.wim
  5. Copy the Zip-files PEExtraFiles_1.0.0.0.zip and Scripts_1.0.0.0.zip from (C:\Program Files\WindowsPowerShell\Modules\cMDT\\Sources) to the C:\Sources directory.
  6. Run Powershell ISE as Administrator and open the file: C:\Program Files\WindowsPowerShell\Modules\cMDT\\Examples\Deploy_MDT_Server.ps1
  7. Press F5 to run the script. It will take approximately 30 min (Depending on internet capacity and virtualization hardware). The server will reboot ones during this process.

Known bugs

There is a known bug in the PSDesiredStateConfiguration User Resource that occur when performing a test method for an existing account. This will prevent you from for example changing the password of the MDTLocalAccount from the example contract. You will be able to create this account initially but all verification tests against this account will fail afterwards. This bug has been reported to Microsoft.

DscResources

The cMDT Module contain the following DscResources:

cMDTApplication

cMDTApplication is a DscResource that enables download, import of and lifecycle management of applications in MDT. Applications can be updated and retrieved from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

cMDTApplication Teamviewer {
    Ensure = "Present"
    Version = "1.0.0.1"
    Name = "Teamviewer"
    Path = "DS001:\Applications\Core Applications"
    Enabled = "True"
    ShortName = "Teamviewer"
    Publisher = "Teamviewer"
    Language = "en-US"
    CommandLine = "install.cmd"
    WorkingDirectory = ".\"
    ApplicationSourcePath = "$($SourcePath)/TeamViewer_Setup_sv"
    DestinationFolder = "Teamviewer"
    TempLocation = $TempLocation
    PSDriveName = $PSDriveName
    PSDrivePath = $PSDrivePath
}

cMDTApplicationBundle

cMDTApplicationBundle is a DscResource that enables download, import of and lifecycle management of application bundles in MDT. Applications can be updated and retrieved from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

cMDTApplicationBundle DeveloperApps {
    Ensure              = "Present"
    BundleName          = "DeveloperApps"
    BundledApplications = @('seven-z-1514-x64_1.0.0.0')
    Version             = "1.0.0.0"
    Publisher           = "7-Zip"
    Language            = "en-US"
    Hide                = $false
    Enable              = $true
    Folder              = "Applications"
}

cMDTBootstrapIni

cMDTBootstrapIni is a DscResource that enables configuration and lifecycle management of the BootStrap.ini in MDT. This file can be updated and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will manage the content of this file according to the following principle:

Desired State Configuration job example:

cMDTBootstrapIni ini {
    Ensure = "Present"
    Path = "$($PSDrivePath)\Control\Bootstrap.ini"
    Content = @"
[Settings]
Priority=Default

[Default]
DeployRoot=\\$($ComputerName)\DeploymentShare$
SkipBDDWelcome=YES

;MDT Connect Account
UserID=$($UserName)
UserPassword=$($Password)
UserDomain=$($env:COMPUTERNAME)

;Keyboard Layout
KeyboardLocalePE=041d:0000041d
"@
}

cMDTCustomize

cMDTCustomize is a DscResource that enables management of custom settings, additional folders and scripts with lifecycle management for MDT. The files can be updated and retrieved from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import custom settings files and directories according to the following principle:

Desired State Configuration job example:

cMDTCustomize PEExtraFiles {
    Ensure = "Present"
    Version = "1.0.0.0"
    Name = "PEExtraFiles"
    Path = $PSDrivePath
    SourcePath = "$($SourcePath)/PEExtraFiles"
    TempLocation = $TempLocation
}
cMDTCustomize Scripts {
    Ensure = "Present"
    Version = "1.0.0.0"
    Name = "Scripts"
    Path = $PSDrivePath
    SourcePath = "$($SourcePath)/Scripts"
    TempLocation = $TempLocation
    Protected = $true
}

cMDTCustomSettingsIni

cMDTCustomSettingsIni is a DscResource that enables configuration and lifecycle management of the CustomSettings.ini in MDT. This file can be updated and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will manage the content of this file according to the following principle:

Desired State Configuration job example:

cMDTCustomSettingsIni ini {
    Ensure = "Present"
    Path = "$($PSDrivePath)\Control\CustomSettings.ini"
    Content = @"
[Settings]
Priority=SetModelAlias, Init, ModelAlias, Default
Properties=ModelAlias, ComputerSerialNumber

[SetModelAlias]
UserExit=ModelAliasExit.vbs
ModelAlias=#SetModelAlias()#

[Init]
ComputerSerialNumber=#Mid(Replace(Replace(oEnvironment.Item("SerialNumber")," ",""),"-",""),1,11)#

[Default]
OSInstall=Y
_SMSTSORGNAME=Company
HideShell=YES
DisableTaskMgr=YES
ApplyGPOPack=NO
UserDataLocation=NONE
DoCapture=NO
OSDComputerName=CLI%ComputerSerialNumber%

;Local admin password
AdminPassword=C@ang3Me!
SLShare=%DeployRoot%\Logs

OrgName=Company
Home_Page=http://companyURL

;Enable or disable options:
SkipAdminPassword=NO
SkipApplications=YES
SkipBitLocker=NO
SkipCapture=YES
SkipComputerBackup=YES
SkipComputerName=NO
SkipDomainMembership=NO
SkipFinalSummary=NO
SkipLocaleSelection=NO
SkipPackageDisplay=YES
SkipProductKey=YES
SkipRoles=YES
SkipSummary=NO
SkipTimeZone=NO
SkipUserData=YES
SkipTaskSequence=NO

;DomainJoin
JoinDomain=ad.company.net
DomainAdmin=DomainJoinAccount
DomainAdminDomain=ad.company.net
DomainAdminPassword=DomainJoinAccountPassword
MachineObjectOU=OU=Clients,OU=company,DC=ad,DC=company,DC=net

;TimeZone settings
TimeZoneName=W. Europe Standard Time

WSUSServer=http://fqdn:port

;Example keyboard layout.
UserLocale=en-US
KeyboardLocale=en-US
UILanguage=en-US

;Drivers
DriverSelectionProfile=Nothing

;DriverInjectionMode=ALL

FinishAction=RESTART
"@
}

cMDTDirectory

cMDTDirectory is a DscResource that enables management of folder structures with lifecycle management for MDT. These folders can be managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will manage MDT folders according to the following principle:

Desired State Configuration job example:

cMDTDirectory Windows10 {
    Ensure = "Present"
    Name = "Windows 10"
    Path = "DS001:\Operating Systems"
    PSDriveName = $PSDriveName
    PSDrivePath = $PSDrivePath
}

cMDTDriver

cMDTDriver is a DscResource that enables download, import of and lifecycle management of drivers in MDT. Drivers can be updated and retrieved from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import drivers according to the following principle:

Desired State Configuration job example:

cMDTDriver Win10x64DellAudio {
    Ensure = "Present"
    Version = "6.0.1.6070_A00"
    Name = "Latitude 3340"
    Path = "DS001:\Out-of-Box Drivers\Windows 10 x64\Dell Inc."
    Enabled = "True"
    Comment = "Drivers for Dell Latitude 3340 Laptops"
    SourcePath = "$($SourcePath)/Audio_Driver_5P33P_WN32"
    TempLocation = $TempLocation
    PSDriveName = $PSDriveName
    PSDrivePath = $PSDrivePath
}

cMDTOperatingSystem

cMDTOperatingSystem is a DscResource that enables download, import of and lifecycle management of Operating System WIM files in MDT. These files can be updated and retrieved from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import Operating Systems according to the following principle:

Desired State Configuration job example:

cMDTOperatingSystem Win10x64 {
    Ensure = "Present"
    Version = "1.0.0.0"
    Name = "Windows 10 Enterprise x64"
    Path = "DS001:\Operating Systems\Windows 10"
    SourcePath = "$($SourcePath)/REFW10X64"
    TempLocation = $TempLocation
    PSDriveName = $PSDriveName
    PSDrivePath = $PSDrivePath
}

cMDTPersistentDrive

cMDTPersistentDrive is a DscResource that enables management of MDT persistent drives with lifecycle management for MDT. These folders can be managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will manage MDT folders according to the following principle:

Desired State Configuration job example:

cMDTPersistentDrive DeploymentPSDrive {
    Ensure = "Present"
    Name = $PSDriveName
    Path = $PSDrivePath
    Description = "Deployment Share"
    NetworkPath = "\\$ComputerName\DeploymentShare$"
}

cMDTPreReqs

cMDTPreReqs is a DscResource that enables download of prerequisites for MDT server deployment. Prerequisites can be defined and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

$ConfigurationData = @{   
    AllNodes = @(        
                @{     
                    NodeName  = "*"
                } 
    ) 
    MDTInstallationSoftware   = @{
        MDT                   = @(
            @{  
                Ensure        = "Present"
                Name          = "Microsoft Deployment Toolkit 2013 Update 2 (6.3.8330.1000)"
                ProductId     = "F172B6C7-45DD-4C22-A5BF-1B2C084CADEF"
                SourcePath    = "https://download.microsoft.com/download/3/0/1/3012B93D-C445-44A9-8BFB-F28EB937B060/MicrosoftDeploymentToolkit2013_x64.msi"
            }
        )
        ADK                   = @(
            @{                
                Ensure        = "Present"
                Name          = "Windows Assessment and Deployment Kit - Windows 10"
                ProductId     = "82daddb6-d4e0-42cb-988d-1e7f5739e155"
                SourcePath    = "http://download.microsoft.com/download/3/8/B/38BBCA6A-ADC9-4245-BCD8-DAA136F63C8B/adk/adksetup.exe"
            }
        )
        C01                   = @(
            @{  
                Ensure        = "Present"
                SourcePath    = "http://deploymentresearch.com/mnfiles/modelalias.zip"
            }
        )
    }
}

cMDTPreReqs MDTPreReqs {
    Ensure = "Present"            
    DownloadPath = "$(TempLocation)"
}

cMDTTaskSequence

cMDTTaskSequence is a DscResource that enables management of Task Sequences with lifecycle management for MDT. Task Sequences can be defined and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Note: The Operating System WIM file must exist in the OperatingSystemPath for the Task Sequence to be created correctly.

Desired State Configuration job example:

cMDTTaskSequence Win10x64 {
    Ensure = "Present"
    Name = "Windows 10 x64"
    Path = "DS001:\Task Sequences\Windows 10"
    #OperatingSystemPath = "DS001:\Operating Systems\Windows 10\REFW10X64DDrive in Windows 10 Enterprise x64 REFW10X64.wim"
    WIMFileName = "REFW10X64"    
    ID = "01"
    PSDriveName = $PSDriveName
    PSDrivePath = $PSDrivePath
}

cMDTUpdateBootImage

cMDTUpdateBootImage is a DscResource that enables creation and management of boot images with lifecycle management for MDT. Boot images can be defined and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

cMDTUpdateBootImage updateBootImage {
    Version = "1.0.0.0"
    PSDeploymentShare = $PSDriveName
    Force = $true
    Compress = $true
    DeploymentSharePath = $PSDrivePath
}

cWDSBootImage

cWDSBootImage is a DscResource that enables management of boot images with lifecycle management for the Windows Deployment Services (WDS). Boot images can be defined and managed from a pull server according to Desired State Configuration principles.

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

cWDSBootImage wdsBootImage {
    Ensure = "Present"
    Path = "$($PSDrivePath)\Boot\LiteTouchPE_x64.wim"
    ImageName = "LiteTouchTest X64 v1.0.0.0"
}

cWDSConfiguration

cWDSConfiguration is a DscResource that enables management and configuration for the Windows Deployment Services (WDS).

Available parameters with example:

The DscResource will import applications according to the following principle:

Desired State Configuration job example:

cWDSConfiguration wdsConfig {
    Ensure = "Present"
    RemoteInstallPath = "C:\RemoteInstall"
}

Development

Want to contribute? Great!

E-mail us with any changes, questions or suggestions: servicedudes@outlook.com

License

Free usage!