Glazier

A tool for automating the installation of the Microsoft Windows operating system on various device platforms.

Home
About
Setup Guide
Glazier Configurations
└─New Actions
└─Config Layout
YAML Files
└─YAML Specs
└─Chooser UI
└─YAML Tips
Python
└─Installer Actions
└─Policy Modules
└─Error Handling
└─Config Handlers
Mailing List 💌
File A Bug 🐛

Hosted on GitHub Pages — Theme by orderedlist

Glazier Installer Actions

Actions are classes which the configuration handler may call to perform a variety of tasks during imaging.

Usage

Each module should inherit from BaseAction and will receive a BuildInfo instance (self._build_info).

Arguments are stored as a data structure in the self._args variable, commonly as an ordered list or dictionary.

Each action class should override the Run function to execute its main behavior.

If an action fails, the module should raise ActionError with a message explaining the cause of failure. This will abort the build.

Validation

Config validation can be accomplished by overriding the Validate() function. Validate should test the inputs (_args) for correctness. If _args contains any unexpected or inappropriate data, ValidationError should be raised.

Validate() will pass for any actions which have not overridden it with custom rules.

Actions

Abort

Aborts the build with a custom error message.

Arguments

AddChoice

Aliases: choice

BitlockerEnable

Enable Bitlocker on the host system.

Available modes:

Arguments

BuildInfoDump

Write state from the BuildInfo class to disk for later processing by BuildInfoSave.

BuildInfoSave

Load BuildInfo data from disk and store permanently to the registry.

ChangeServer

Change the active Glazier config server at runtime.

ChangeServer is a unique action in the sense that it alters the behavior of the configuration builder in real time. This action must come (logically) last in the input config; once reached, the config builder effectively restarts immediately with the new server address and root. No subsequent tasks in the original location will be handled.

ChangeServer Arguments

Examples

ChangeServer: ['https://new-server.example.com', '/new/config/path']

CopyDir

Copy directories from source to destination.

CopyDir Arguments

Examples

CopyDir: ['X:\Glazier', 'C:\Glazier\Old']

# Delete existing directory before copying
CopyDir: ['X:\Glazier', 'C:\Glazier\Old', true]

CopyFile/MultiCopyFile

Copy files from source to destination.

Also available as MultiCopyFile for copying larger sets of files.

CopyFile Arguments

MultiCopyFile Arguments

Examples

CopyFile: ['X:\glazier.log', 'C:\Windows\Logs\glazier.log']

MultiCopyFile:
  - ['X:\glazier-applyimg.log', 'C:\Windows\Logs\glazier-applyimg.log']
  - ['X:\glazier.log', 'C:\Windows\Logs\glazier.log']

DomainJoin

Joins the host to the domain. (Requires installer to be running within the host OS.)

Arguments

Examples

DomainJoin: ['interactive', 'domain.example.com']
DomainJoin: ['auto', 'domain.example.com', 'OU=Servers,DC=DOMAIN,DC=EXAMPLE,DC=COM']

Driver

Process drivers in WIM format. Downloads file, verifies hash, creates an empty directory, mounts wim file, applies drivers to the base image, and finally unmounts wim.

Examples

Driver: ['@/Driver/HP/z840/win10/20160909/z840.wim',
         'C:\Glazier_Cache\z840.wim',
         'cd8f4222a9ba4c4493d8df208fe38cdad969514512d6f5dfd0f7cc7e1ea2c782']

Execute

Run one or more commands on the system.

Supports multiple commands via nested list structure due to the frequency of program executions occurring as part of a typical imaging process.

Arguments

Examples

Execute: [
  # Using defaults.
  ['C:\Windows\System32\netsh.exe interface teredo set state disabled'],

  # 0 or 1 are successful exit codes, 3010 will trigger a restart.
  ['C:\Windows\System32\msiexec.exe /i @Drivers/HP/zbook/HP_Hotkey_Support_6_2_20_8.msi /qn /norestart', [0,1], [3010]],

  # 0 is a successful exit code, 2 will trigger a restart, and True will rerun the command after the restart.
  ['C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -File #secureboot.ps1', [0], [2], True],

  # 0 is a successful exit code, 2 will trigger a restart, and True will ONLY log output to console.
  ['C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -File #secureboot.ps1', [0], [2], False. True],
]

ExitWinPE

Leave the WinPE environment en route to the local host configuration. Is normally followed by sysprep, then the relaunch of the autobuild tool running inside the new host image.

Performs multiple steps in one:

Without a separate command, some of these actions would remain in the task list after being carried over, and would be re-executed.

Arguments

Get

Aliases: pull

Downloads remote files to local disk. Get is an ordered, two dimensional list of source file names and destination file names. Source filenames are assumed to be relative to the location of the current yaml file.

Verification

To use checksum verification, add the computed SHA256 hash as a third argument to the list. This argument is optional, and being absent or null bypasses verification.

Get:
    - ['windows10.wim', 'c:\base.wim', '4b5b6bf0e59dadb4663ad9b4110bf0794ba24c344291f30d47467d177feb4776']

Arguments

Examples

Get:
    - ['win2008-x64-se.wim', 'c:\base.wim']
    - ['win2008-x64-se.wim.sha256', 'c:\base.wim.sha256']

GooGetInstall

Installs one or more GooGet packages with optional arguments.

Supports multiple packages via nested list structure.

GooGetInstall Arguments

Examples

    GooGetInstall: [
      # Specify only GooGet package name
      ['test_package_v1'],

      # Package name with additional GooGet arguments
      ['test_package_v1', ['http://example.com/team-unstable, http://example.co.uk/secure-unstable, https://example.jp/unstable/ -reinstall whatever']],

      # Package name, no GooGet arguments, but with custom path to googet.exe
      ['test_package_v1', [], 'C:\ProgramData\GooGet\googet.exe'],

      # Package name, custom GooGet arguments, and custom path to googet.exe
      ['test_package_v1', ['http://example.com/team-unstable, http://example.co.uk/secure-unstable, https://example.jp/unstable/ -reinstall whatever'], 'C:\ProgramData\GooGet\googet.exe'],

      # Package name with custom retry count of 3 and sleep interval of 60 seconds
      ['test_package_v1', [], 'C:\ProgramData\GooGet\googet.exe', 3, 60],

      # Replaces '%' in custom GooGet arguments with the current build branch
      ['test_package_v1', ['http://example.com/team-%, http://example.co.uk/secure-%, https://example.jp/%/ -reinstall whatever'], 'C:\ProgramData\GooGet\googet.exe'],

      # Remove a Googet Package with custom retry count of 3 and sleep interval of 60 seconds
      ['test_package_v1', [], 'C:\ProgramData\GooGet\googet.exe', 3, 60, true],
    ]

LogCopy

Attempts to copy a log file to a new destination for collection.

Destinations include Event Log and CIFS. Copy failures only produce warnings rather than hard failures.

Logs will always be copied to the local Application log. Specifying the second logs share parameter will also attempt to copy the log to the specified file share.

Arguments

Examples

LogCopy: ['C:\Windows\Logs\glazier.log', '\\shares.example.com\logs-share']

MkDir

Make a directory.

Arguments

Examples

MkDir: ['C:\Glazier_Cache']

PrintFromFile

Print text from a file.

Arguments

Examples

PrintFromFile: ['c:\windows\temp\logo.txt']

# Continue even when the file doesn't exist (ignore errors)
PrintFromFile: ['c:\windows\temp\logo.txt', True]

PSCommand/MultiPSCommand

Run a PowerShell command.

PSCommand Arguments

MultiPSCommand Arguments

Examples

    # Specify only the PowerShell script.
    PSCommand: ['Write-Verbose Foo -Verbose']

    # 0 or 1 as successful exit codes.
    PSCommand: ['Write-Verbose Foo -Verbose', [0, 1]]

    # 1337 will trigger a restart.
    PSCommand: ['Write-Verbose Foo -Verbose', [0, 1], [1337]]

    # True will rerun the command after restart.
    PSCommand: ['Write-Verbose Foo -Verbose', [0, 1], [1337], True]

    # True will ONLY log PowerShell output to console.
    PSCommand: ['Write-Verbose Foo -Verbose', [0, 1], [1337], True, True]

    # Will not any log PowerShell output.
    PSCommand: ['Write-Verbose Foo -Verbose', [0, 1], [1337], True, False, False]

    MultiPSCommand:
      - ['Write-Information "Setting Execution Policy"']
      - ['Set-ExecutionPolicy -ExecutionPolicy RemoteSigned', [0], [1337]]

PSScript/MultiPSScript

Run a PowerShell script file using the local PowerShell interpreter.

PSScript Arguments

MultiPSScript Arguments

Examples

    # Specify only the PowerShell script.
    PSScript: ['#Sample-Script.ps1']

    # Additional parameters.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue']]

    # 0 or 1 as successful exit codes.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1]]

    # 1337 will trigger a restart.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1], [1337]]

    # True will rerun the command after restart.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1], [1337], True]

    # True will ONLY log PowerShell output to console.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1], [1337], True, True]

    # Will not any log PowerShell output.
    PSScript: ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1], [1337], True, False, False]

    MultiPSScript:
      - ['#Sample-Script.ps1']
      - ['#Sample-Script.ps1', ['-Verbose', '-InformationAction', 'Continue'], [0,1], [1337], True, False, False]

RegAdd/MultiRegAdd

Create/modify a registry key.

Also available as MultiRegAdd for creating larger sets of registry keys.

RegAdd Arguments

MultiRegAdd Arguments

Examples

RegAdd: ['HKLM', 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform', 'KeyManagementServiceName', 'kms.example.com', 'REG_SZ']

MultiRegAdd:
  - ['HKLM', 'SOFTWARE\Policies\Microsoft\WindowsStore', 'RemoveWindowsStore', 1, 'REG_DWORD']
  - ['HKLM', 'SOFTWARE\Policies\Microsoft\Windows\Windows Search', 'AllowCortana', 0, 'REG_DWORD']

RegDel/MultiRegDel

RegDel Arguments

Delete a registry key.

MultiRegDel Arguments

Examples

RegDel: ['HKLM', 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform', 'KeyManagementServiceName']

MultiRegDel:
  - ['HKLM', 'SOFTWARE\Policies\Microsoft\WindowsStore', 'RemoveWindowsStore']
  - ['HKLM', 'SOFTWARE\Policies\Microsoft\Windows\Windows Search', 'AllowCortana']

Reboot

Restart the host machine.

Arguments

Examples

Reboot: [30]
Reboot: [10, "Restarting to finish installing drivers."]
Reboot: [10, "Restarting to finish installing drivers.", True]

RegenerateTasklist

Perform a one-shot rebuild of the Glazier task list. Note that a Registry key created in REG_ROOT\tasklist_regen prevents this action from being run more than once.

RmDir

Remove one or more directories.

Arguments

Examples

RmDir: ['C:\Glazier_Cache', 'D:\Glazier_Cache']

SetUnattendTimeZone

Attempts to detect the timezone via DHCP and configures any <TimeZone> fields in unattend.xml with the resulting values.

Arguments

SetupCache

Creates the imaging cache directory with the path stored in BuildInfo.

Arguments

Examples

SetupCache: []

SetTimer

Add an imaging timer.

Arguments

Examples

SetTimer: ['TimerName']

ShowChooser

Show the Chooser UI to display all accumulated options to the user. All results are returned to BuildInfo and the pending options list is cleared.

Arguments

Shutdown

Shutdown the host machine.

Arguments

Examples

Shutdown: [30]

# Display reason message
Shutdown: [10, "Shutting down to save power."]

# Display reason message and remove the next item in the task list
Shutdown: [10, "Shutting down to save power.", True]

Sleep

Pause the installer.

Arguments

Examples

Sleep: [30]

# Display reason message
Sleep: [300, "Waiting for Group Policy to apply..."]

SpliceDomainJoin

Leverage Splice to join a Microsoft Active Directory domain without direct line of sight to a domain controller.

Arguments

Examples

# Using defaults.
SpliceDomainJoin: []

# Attempt unattend, without fallback, and 3 retry attempts.
SpliceDomainJoin: [3, True, False]

# Don't attempt unattend with 5 retry attemps.
SpliceDomainJoin: [5, False]

# Attempt unattend, without fallback, using the Prefix name generator.
# Encryption using a host certificate with identity container "my-container" and issuer "my-issuer".
SpliceDomainJoin: [2, True, False, 'Prefix', ['my-container', 'my-issuer']]

StartStage

Start a new stage of the imaging process.

Stages are used for tracking (internally and externally) and reporting progress through the imaging process.

Arguments

Examples

StartStage: [1]

Unzip

Unzip a zip file to the local filesystem.

Arguments

Examples

Unzip: ['C:\some_archive.zip', 'C:\Some\Destination\Path']

UpdateMSU

Process updates in MSU format. Downloads file, verifies hash, creates a SYS_CACHE\Updates folder that is used as a temp location to extract the msu file, and applies the update to the base image.

Examples

Update: ['@/Driver/HP/z840/win7/20160909/kb290292.msu',
         'C:\Glazier_Cache\kb290292.msu',
         'cd8f4222a9ba4c4493d8df208fe38cdad969514512d6f5dfd0f7cc7e1ea2c782']

Warn

Issue a warning that can be bypassed by the user.

Arguments

Examples

Warn: ["You probably don't want to do this, or bad things will happen."]

WriteDiskSpace

Writes the current total, used, and free disk space to registry (in bytes).

Examples

WriteDiskSpace: []