OSDCloudGUI with ConfigMgr: Setting Defaults

In my previous post I demonstrated how you can utilize OSDCloud within a Configuration Manager Task sequence. I’ll link the post below:

By default, you will be given many different options for Operating Systems, Editions, and some Deployment Options.

But what if you want to restrict what Operating Systems can be selected, or if you don’t want to manually uncheck the Clear-Disk prompt?

OSDCloudGUI Defaults

In May 2023, David Segura added the ability to set Defaults in the GUI by utilizing a Json file. See the documentation below for the specifics of the different sections of the file.

Using this Json file, you can configure what Operating Systems show up, and also what Deployment options are Checked/Unchecked by default.
Below is the example that we’ll be using in our task sequence.

How is this file usually used?

Lets look at the ‘Start-OSDCloudGUI’ function at the ‘OSDCloud Automate’ section:

  1. In this section, the first thing it does is Export the full list of available configurations in their default settings.
    • The file will be exported to the path: "$env:TEMP\Start-OSDCloudGUI.json
  2. The next step searches all drives except for ‘C:’, for an existing ‘Start-OSDCloudGUI.json’ file
    • It searches the path “<DriveLetter>\OSDCloud\Automate\Start-OSDCloudGUI.json’
  3. If a file is found, it is convert FROM json, TO hashtable, and saves in the variable '$Global:OSDCloudGUI.AutomateConfiguration'
  4. Finally, it loops through all the Keys within that variable, and saves them.

Ideally, you would create your own Start-OSDCloudGUI.json file, edit it with the settings you want, and have it embedded within your OSDCloud WinPE image.

How do we utilize this in a Task Sequence?

We can utilize the below script to create the ‘Start-OSDCloudGUI.json’ file.

The script will:

  1. Set the configuration Defaults you want
  2. Create the file ‘Start-OSDCloudGUI.json’ to “$($env:SystemDrive)\OSDCloud\Automate\Start-OSDCloudGUI.json”
    • When running in WinPE, the drive letter will be ‘X:’
  3. Finally it will Convert the Hashtable TO json, and write it to the above file
PowerShell
<# https://MichaeltheAdmin.com

OSDCloudGUI can now be configured with Defaults and Selectable Options in the dropdowns.

Create the file "$($env:SystemDrive)\OSDCloud\Automate\Start-OSDCloudGUI.json"
and the 'Start-OSDCloudGUI' will import the file

https://www.osdcloud.com/osdcloud-automate/osdcloudgui-defaults

#>

# Set OSDCloudGUI Defaults
$Global:OSDCloud_Defaults = [ordered]@{
    BrandName            = "Michael The Admin"
    BrandColor           = "Orange"
    OSActivation         = "Volume"
    OSEdition            = "Enterprise"
    OSLanguage           = "en-us"
    OSImageIndex         = 6
    OSName               = "Windows 11 22H2 x64"
    OSReleaseID          = "22H2"
    OSVersion            = "Windows 11"
    OSActivationValues   = @(
        "Volume",
        "Retail"
    )
    OSEditionValues      = @(
        "Enterprise",
        "Pro"
    )
    OSLanguageValues     = @(
        "el-gr",
        "en-gb",
        "en-us",
        "es-es",
        "es-mx"
    )
    OSNameValues         = @(
        "Windows 11 22H2 x64",
        "Windows 10 22H2 x64"
    )
    OSReleaseIDValues    = @(
        "22H2"
    )
    OSVersionValues      = @(
        "Windows 11",
        "Windows 10"
    )
    captureScreenshots   = $false
    ClearDiskConfirm     = $false
    restartComputer      = $true
    updateDiskDrivers    = $true
    updateFirmware       = $false
    updateNetworkDrivers = $true
    updateSCSIDrivers    = $true
}

# Create 'Start-OSDCloudGUI.json' - During WinPE SystemDrive will be 'X:'
$OSDCloudGUIjson = New-Item -Path "$($env:SystemDrive)\OSDCloud\Automate\Start-OSDCloudGUI.json" -Force

# Covert data to Json and export to the file created above
$Global:OSDCloud_Defaults | ConvertTo-Json -Depth 10 | Out-File -FilePath $($OSDCloudGUIjson.FullName) -Force

Create-OSDCloudGUI-Defaults.ps1 · MichaelEscamilla/MichaelTheAdmin (github.com)

Add this to your Task Sequence

Lets add a step to our existing OSDCloudGUI Task Sequence.

Download the Full Task Sequence OSDCloudGUI_DefaultSettings.zip
Or from Github https://github.com/MichaelEscamilla/MichaelTheAdmin

  1. Add a ‘Run PowerShell Script’ step
    • This step needs to be after the ‘sandbox.osdcloud.com’ step but before the ‘Start-OSDCloudGUI’ steps
  1. Set the Execution Policy to Bypass
  1. Select ‘Enter PowerShell script:’
    • Then select ‘Edit Script…’
  1. Paste the script into the prompt, and select ‘OK’

Save the changes, Deploy the Task sequence if it isn’t already.

Run the Task Sequence

Now when OSDCloudGUI is ran, you should now see the Default are now Set:

We will first notice the Function found our Start-OSDCloudGUI.json file

And after the GUI loads, are Defaults should be set

Success!

Now you don’t have to worry about your Technicians installing out of date Operating Systems.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top