Start-OSDCloud Wrapping

OSDCloud is heavily variable driven, similar to a ConfigMgr Task Sequence.

There are many variables in OSDCloud to control the process, similar to running OSDCloud with parameters to control a small set of the variables, you can script around Start-OSDCloud to configure so much more to get the exact zero touch scenario you're looking for.

Start-OSDCloud has about 60 variables in the Start-OSDCloud script beginning that are set, but along the way, several others can be used as well, which can be consumed by the OSDCloud engine which at last check, has about 130 variables.

At the start of the OSDCloud engine, it has a default set for these variables, then it looks at what you sent along the way with Start-OSDCloud, and it overwrites the defaults with the variables you set, but if you manually set any variables ahead of time using the global variable "MyOSDCloud", it will overwrite any previous variables with what you've set in that variable, I hope you're all tracking. Let's look at an example.

NOTE: See Start-OSDCloudGUI -> Global Variable for additional details

By Default, there is a $Global:OSDCloud variable with several sub keys, once of which is "OSVersion", which is set to "Windows 10" by default. If I run Start-OSDCloud with some parameters, I can see that a new Global variable $Global:StartOSDCloud is created with the information I just fed into it:

So now when OSDCloud runs, it will overwrite the defaults in $Global:OSDCloud with the ones in $Global:StartOSDCloud, updating $Global:OSDCloud.OSVersion from "Windows 10" to "Windows 11"

So, from this small example, you can see how OSDCloud overwrites the defaults with the variables you're setting along the way using parameters, but that's just one way to set them. The GUI? It's really just a front end that allows you to set several variables using a GUI interface. Each drop down and check box maps directly to a variable.

Now we're finally getting to the good part, this is how I have automated several unique experiences based on a simple PowerShell wrapper file that gets called. Lets look at some code examples. For instance, I have a Windows 11 wrapper script that sets several items and calls OSDCloud

#Variables to define the Windows OS / Edition etc to be applied during OSDCloud
$OSName = 'Windows 11 23H2 x64'
$OSEdition = 'Pro'
$OSActivation = 'Retail'
$OSLanguage = 'en-us'

#Set OSDCloud Vars
$Global:MyOSDCloud = [ordered]@{
    Restart = [bool]$False
    RecoveryPartition = [bool]$true
    OEMActivation = [bool]$True
    WindowsUpdate = [bool]$true
    WindowsUpdateDrivers = [bool]$true
    WindowsDefenderUpdate = [bool]$true
    SetTimeZone = [bool]$true
    ClearDiskConfirm = [bool]$False
    ShutdownSetupComplete = [bool]$false
    SyncMSUpCatDriverUSB = [bool]$true
    CheckSHA1 = [bool]$true
}

#Launch OSDCloud
Write-Host "Starting OSDCloud" -ForegroundColor Green
write-host "Start-OSDCloud -OSName $OSName -OSEdition $OSEdition -OSActivation $OSActivation -OSLanguage $OSLanguage"

Start-OSDCloud -OSName $OSName -OSEdition $OSEdition -OSActivation $OSActivation -OSLanguage $OSLanguage

When I trigger that script, it launches OSDCloud with the OS I want deployed, and presets several variables that are in the Global:MyOSDCloud variable.

You can see the variables in my script have been merged into the $global:OSDCloud variable

I keep a few variations of my wrapper scripts in GitHub, which I then call and based on hardware models, will also set additional variables, like for HP, I have it update TPM, BIOS, and run HPIA to update Drivers during Setup Complete.

As all of the available variables do change, I'm not going to list them here, but feel free to look at things in the code in the module to see a full list. If you'd ever like to see my of my examples, please reach out via Discord (WinAdmins) or X - @gwblok

Last updated