OSDeploy / OSD

OSD Shared Functions
MIT License
144 stars 59 forks source link

How to Start-OSDcloud with a custom .wim image without asking? #39

Closed sanderpleijers closed 7 months ago

sanderpleijers commented 2 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Is it possible to 'pre-populate' the variables in Start-OSDcloud with a custom image file on a share (preferably not in "*:\OSDCloud\OS\")? Now only this works: Start-OSDCloud -ZTI -FindImageFile

But, this will keep on asking to select the .wim on the found location. I would like to skip that question and continue right away.

Describe alternatives you've considered Tried setting some globals: $Global:StartOSDCloud.ImageFileItem = Find-OSDCloudOfflineFile -Name *.wim | Select-Object -First 1 #finds z:\OSDcloud\OS\install.wim $Global:StartOSDCloud.ImageFileFullName = Split-Path -Path $Global:StartOSDCloud.ImageFileItem.FullName -Leaf $Global:StartOSDCloud.ImageFileName = Split-Path -Path $Global:StartOSDCloud.ImageFileItem.FullName -Leaf $Global:StartOSDCloud.OSImageIndex = 1 $Global:StartOSDCloud.ZTI = $true $Global:StartOSDCloud.OSName = 'Windows 11 21H2 x64' $Global:StartOSDCloud.OSVersion = 'Windows 10' Start-OSDCloud

But that starts with asking a operating system selection.

Additional context File resides on z:\OSDcloud\OS\install.wim

OSDeploy commented 1 year ago

You can't set $Global:StartOSDCloud as this is reset every time you run Start-OSDCloud You can populate $Global:StartOSDCloudGUI and those will get merged

I'd suggest you set $Global:MyOSDCloud and run that against Invoke-OSDCloud. In this method you will not use Start-OSDCloud

Keep in mind that Start-OSDCloud and Start-OSDCloudGUI are just frontends to Invoke-OSDCloud, so if those frontends do not do what you want it to do, you can always create your own. If you are set on using Start-OSDCloud then I believe you need to set these Global Variables

$Global:MyOSDCloud.ImageFileFullName = 'Z:\OSDCloud\OS\install.wim' $Global:MyOSDCloud.ImageFileItem = Get-Item 'Z:\OSDCloud\OS\install.wim' $Global:MyOSDCloud.ImageFileName = 'install.wim'

Banthaf0dder commented 1 year ago

I did this by using a WebPSScript hosted somewhere (internally for us) that then starts OSDCloud with -ImageFileUrl.

Set up the iso or usb drive with:

Edit-OSDCloudWinPE -CloudDriver IntelNet -WebPSScript http://domain.com/webpsscript.ps1 -Wallpaper "C:\PATH TO A WALLPAPER JPEG.jpg"

And then the webpsscript that is called is just:

Install-Module OSD -Force
Import-Module OSD -Force

Start-OSDCloud -ImageFileUrl http://your.domain.com/webpsscript.ps1 -ZTI

wpeutil reboot
gwblok commented 7 months ago

Closing out old Issue. If you have any questions, please create a new one.