Search This Blog

Wednesday, March 24, 2021

OSDCloud - Image devices without need of infrastructure

image

Introduction

Have you ever been in a situation where you need to image or reimage your device? Of course, you have and so have I. Recently David Segura launched some awesome PowerShell code called OSDCloud. You might know him better for the Offline patching of images OSDBuilder, which has been on the market for quite some time.

OSDCloud is brand new and working without the need to build your own infrastructure.

How much does it cost; you may ask? Nothing, David spends his weekends for us to use it. It is free. You pay for your internet and that’s all.

This tool will deploy the OS until a state where you can onboard the device using Autopilot and finally be fully managed by Intune.

In this post I will demonstrate the steps you need to proceed with this awesome tool.

Requirements

  • Internet
  • ADK
  • USB (Only for physical devices)
    • Windows 10 1703+ to create the USB disk
  • Intune license

Table of Content

  1. Install ADK
  2. Create OSDCloud Workspace
  3. Create ISO
  4. Boot into WinPE
  5. Cloud Image your device
  6. Autopilot
  7. Managing it with Intune

ADK

You can do this on your host machine but if you don’t like to spend 5 GB on installing ADK, then find a server or another device to do the following steps. Just be aware that the function to create USB drive will not work on a server OS.

 

Download ADK

Install the downloaded file

Adkwinpesetup.exe

Click Next

clip_image002

 

Click Next

clip_image004

 

Click Accept

clip_image006

 

Click Install

clip_image008

 

Click Close

clip_image010

 

Download this one too

Double click adksetup.exe

Click Next, next, Accept

clip_image012

 

Click Install

clip_image014

 

Click Close

clip_image016

Create OSDCloud Workspace and ISO

Open PowerShell as admin

clip_image018

Install-Module -Name OSD -force

clip_image020

 

To build a more refined copy of ADK’s WinPE we will run this command.

New-OSDCloud.template -Verbose

clip_image022

 

Create a workspace for the binaries

New-OSDCloud.workspace -WorkspacePath E:\OSDCloud

clip_image023

 

If we go to the workspace, we find the folders Autopilot and media. Let’s focus on how to get our Autopilot profile and locate it to the folder.

clip_image025

 

Let’s go and get those Autopilot profiles

$creds = Get-Credential

clip_image027

 

Insert your credentials (Intune admin)

clip_image029

 

(If you don’t have MSGraph installed yet you need to run Install-module Microsoft.Graph first)

Connect-MSGraph -Credential $creds

clip_image031

 

Get-AutopilotProfile | select displayname

clip_image033

 

Get-AutopilotProfile | Where-Object DisplayName -eq "Mindlab Production" | ConvertTo-AutopilotConfigurationJSON | Out-File -FilePath E:\OSDCloud\AutoPilot\Profiles\AutoPilotConfigurationFile.json -Encoding ASCII

clip_image035

 

Successfully downloaded the Autopilot JSON.

clip_image037

 

To get the Autopilot configuration file into the WinPe we need to edit that.

Edit-OSDCloud.winpe -WorkspacePath E:\OSDCloud

clip_image039

 

If you need drivers in your PE image for supporting certain Network interfaces that can be done too. There are 2 commands at the moment.

The first one adds all WinPE drivers that exist for Dell, Nutanix and VMware.

Edit-OSDCloud.winpe -CloudDriver Dell,Nutanix,VMware

clip_image041

 

The second option is to choose your own drivers from a path

Edit-OSDCloud.winpe -DriverPath "E:\OSDCloud\Drivers"

clip_image043

 

Lastly we complete the ISO by building with all the elements we prepared.

New-OSDCloud.iso

clip_image045

 

And the result will look somewhat like this:

clip_image047

 

If you need to put it on a USB stick, make sure that it will be ok to erase what’s on it.

Simply run this command

New-OSDCloud.usb

clip_image049

Boot into PE and Cloud image your device

Start Hyper-v and create a new empty Virtual Machine.

clip_image051

 

Inside the virtual machine, PowerShell starts up.

Install-module -name OSD -force

Start-OSDCloud -OSEdition “Enterprise” -Culture “da-dk”

clip_image053

 

Press 1

clip_image055

 

Press A to confirm you will format the disk

clip_image057

After a while depending on your internet line, the device is ready to be rebooted. Mine took 13 minutes and 33 seconds.

 

Write exit

clip_image059

 

And on the CMD as well

Write exit

clip_image061

Autopilot

The device will reboot and start running some configurations. After a couple of minutes, you will see the known OOBE

clip_image063

 

It will reboot automatically once more and after that you will be presented with your company name.

Type your username

clip_image065

 

Type your password

clip_image067

Managing the device using Intune

First, we need to know the new name of the device.

Open a CMD

Type hostname

clip_image069

 

Go to https://endpoint.microsoft.com/

Devices -> Windows

We see our device joined Intune just fine. Now it is time to make sure our device will be converted to the Autopilot service, so next time we need to refresh Windows, this will be done without the need to reinstall the device.

clip_image071

 

Go to Groups

clip_image073

 

Press New Group

clip_image075

 

Give it a group name

Group description

Set membership to Dynamic device

Click Add dynamic variable.

clip_image077

 

Click Edit

Insert (device.enrollmentProfileName -eq "OfflineAutopilotprofile-08988bcd-1a6f-4102-878b-a713c4c9a2f1")

clip_image078

You can find it in the autopilot JSON file located in E:\OSDCloud\AutoPilot\Profiles

Grab the ID and overwrite mine.

clip_image080

 

Save the group

And press Create

clip_image082

 

Wait some time and verify your device got into the group.

clip_image084

We verified our device came into the group. Very nice.

 

Go to Devices -> Enroll devices -> Deployment Profiles

Create profile -> Windows PC

clip_image086

 

Give it a name

Convert all targeted devices to autopilot set to yes

Press Next

clip_image088

 

My device should be a user driven Autopilot experience. Set settings as beneath.

Click next

clip_image090

 

Click next

clip_image092

 

Add groups

clip_image094

 

Select Autopilot – Cloud Devices JSON

Click Select and Next

clip_image096

 

Press create

clip_image098

Wait some time for the profile to target the device.

 

Go to devices -> Windows

Click on the device

clip_image100

 

Grab the Serial number

clip_image102

 

Go to Devices -> Enroll Devices -> Devices

clip_image104

 

Insert the serial number

clip_image106

We did it and got our device from scratch to fully managed by Intune and converted to Autopilot without ever touching the import script or hardware hash.

 

Summary

For companies that needs to start their cloud journey or just need a quick way of getting Windows reinstalled, OSDCloud is an excellent choice. No expensive bills and very fast to setup to use.

Happy Cloud OSD!

What is coming?

Lenovo and HP driver support direct downloads from vendor, so no need to provide driver packages and other stuff that takes up time.

Billede

Picture borrowed from David Segura’s twitter.

 

(If you are interested in more Autopilot stuff, go check out my earlier blog post on the topic.)

1 comment:

  1. Great article to get you started. I noticed the link to the ADK is wrong. It's linking to the Windows PE Add-on and not to the Windows ADK. If you only install the Windows PE add-on the ISO build process fails because of a missing oscdimg.exe

    The autopilot profiles need to be placed in C:\ProgramData\OSDCloud\AutoPilot\Profiles where they will be picked up by the New-OSDCloud-Workspace command. Might have changed also with the latest build.

    ReplyDelete