Skip to content

OSManagerCLI Command Line & Exit Codes

As well as double-clicking the .exe and walking through its interactive menus, OSManagerCLI can run a ‘hands-free’ reimage as part of one of your automation scripts, straight from the command line:

Terminal window
.\OSManagerCLI.exe -PreIngestedOSFileHandle 'gx3p_25Q3_f0885a6e' -MachineToReimageHandle 'gx3p-42123'

You can tell if a reimage was successful or not by checking the exit code (0 means success).

Terminal window
.\OSManagerCLI.exe -PreIngestedOSFileHandle 'gx3p_25Q3_f0885a6e' -MachineToReimageHandle 'gx3p-42123'
$reimageSuccessExitCode = $LASTEXITCODE
if( $reimageSuccessExitCode -eq 0 ) {
Write-Host "Reimage Was Successful"
}
else {
$exitCodesMeaning = & .\OSManagerCLI.exe -DescribeExitCode $reimageSuccessExitCode
Write-Host "Reimage Failed with Exit Code $reimageSuccessExitCode, which means: $exitCodesMeaning"
}

OSManagerCLI requires Administrator rights, so it relaunches itself in a new elevated window if you are not already running in a Terminal ‘(As Administrator)’. If you are in a non-elevated session, to capture its exit code from a script, start it elevated and wait for it to finish:

Terminal window
$run = Start-Process .\OSManagerCLI.exe `
-ArgumentList '-PreIngestedOSFileHandle','gx3p_25Q3_f0885a6e','-MachineToReimageHandle','MYSERVER' `
-Verb RunAs -Wait -PassThru
$reimageSuccessExitCode = $run.ExitCode # 0 = success; see the tables below
Write-Host "Exit Code Was: $reimageSuccessExitCode"
ParameterDescription
-IngestOSFilePath <path>Ingest the OS image at <path> (an .iso or .os file) into your OS Library.
-PreIngestedOSFileHandle <handle>Use an OS you’ve already ingested, identified by its handle (the name shown in the OS list). Requires -MachineToReimageHandle.
-MachineToReimageHandle <hostname>The server (Actor) to reimage. Requires an OS source: one of the two parameters above must be set.
-HelpPrint usage for every parameter, then exit.
-VersionPrint just the version number of the current .exe (e.g. 1.12), for easy scripting, then exit.
-DescribeExitCode <n>Print the name and meaning of a single exit code, then exit.
-ListExitCodesPrint the full exit-code table, then exit.

A few rules the tool enforces:

  • -IngestOSFilePath and -PreIngestedOSFileHandle can’t be used together. They’re two ways of choosing the same thing.
  • -MachineToReimageHandle needs an OS source as well.
  • -PreIngestedOSFileHandle needs -MachineToReimageHandle.
Terminal window
# Ingest an OS only
OSManagerCLI.exe -IngestOSFilePath "D:\OSImages\gx3p_25Q3_f0885a6e.iso"
# Reimage a server using an OS you've already ingested
OSManagerCLI.exe -PreIngestedOSFileHandle gx3p_25Q3_f0885a6e -MachineToReimageHandle MYSERVER
# Ingest an OS and reimage a server in one go
OSManagerCLI.exe -IngestOSFilePath "D:\OSImages\gx3p_25Q3_f0885a6e.iso" -MachineToReimageHandle MYSERVER

OSManagerCLI returns a meaningful exit code so that scripts (and you) can tell exactly how a run ended. 0 means success; anything else indicates why it stopped.

CodeNameMeaning
0SuccessCompleted successfully, or you quit normally.
CodeNameMeaning
100ParamMutuallyExclusiveSources-IngestOSFilePath and -PreIngestedOSFileHandle were both supplied (use only one).
101ParamMachineHandleNeedsOsSource-MachineToReimageHandle was supplied without an OS source.
102ParamPreIngestedHandleNeedsMachine-PreIngestedOSFileHandle was supplied without -MachineToReimageHandle.
CodeNameMeaning
200ConfigInvalidJsonThe config file contains invalid JSON.
201NoDeploymentShareFolderSelectedNo OS Library (deployment share) folder was selected.
202DeploymentShareSetupFailedAsAdminDeployment share setup failed while running as Administrator.
203DeploymentShareSetupNeedsAdminDeployment share setup is incomplete and needs Administrator rights.
204SevenZipMissingUserDeclined7-Zip wasn’t found and you chose not to continue without it.
205D3ServiceMissingUserDeclinedd3Service wasn’t detected and you chose not to continue without it.
206PasswordProtectedSharingGuestMissingPassword Protected Sharing couldn’t be disabled (the built-in Guest account wasn’t found).
207PasswordProtectedSharingUserDeclinedYou declined to disable Password Protected Sharing (which requires enabling the Guest account).
208GuestNetworkAccessPolicyUndeterminedCouldn’t determine the Windows Guest network-access policy.
209GuestNetworkAccessUserDeclinedYou declined the Windows policy change that lets servers reach the deployment share on your laptop.
210LocalD3ServiceVersionTooLowThe d3/Designer version installed on this machine is below the minimum required.
211D3InstalledButServiceNotRunningd3/Designer is installed on this machine but the d3Service process isn’t running, so the local API is unreachable.
CodeNameMeaning
300HeadlessOsHandleNotFoundThe pre-ingested OS handle wasn’t found in your OS Library.
301HeadlessOsLibraryEmptyYour OS Library is empty (nothing has been ingested yet).
CodeNameMeaning
400HeadlessIngestSevenZipPathNotSetThe 7-Zip path isn’t set in the config.
401HeadlessIngestSevenZipPathInvalidThe configured 7-Zip path doesn’t exist.
402HeadlessIngestArchiveUnreadable7-Zip couldn’t read the archive (invalid or corrupt file).
403HeadlessIngestNotEnoughDiskSpaceNot enough disk space to extract the archive.
404HeadlessIngestCreateDirFailedCouldn’t create the OS Library destination folder.
405HeadlessIngestExtractionFailed7-Zip returned an error while extracting the archive.
406HeadlessIngestNotExactlyTwoWimsThe archive didn’t contain exactly two .wim files.
407HeadlessIngestNotExactlyOneBootWimThe archive didn’t contain exactly one boot .wim file.
408HeadlessIngestOsDirNotExactlyOneWimThe /OS folder didn’t contain exactly one .wim file.
409HeadlessIngestSourcesDirNotExactlyOneBootWimThe /sources folder didn’t contain exactly one boot .wim file.
410HeadlessIngestOsWimMoveFailedCouldn’t move the OS .wim into the OS Library.
411HeadlessIngestBootWimMoveFailedCouldn’t move the boot .wim into the OS Library.
412HeadlessIngestFileNotFoundThe file given to -IngestOSFilePath doesn’t exist.

Redisguise / reimage, headless (500–599)

Section titled “Redisguise / reimage, headless (500–599)”
CodeNameMeaning
500HeadlessRedisguiseNoServerSelectedNo server was selected.
501HeadlessRedisguiseNoOsSelectedNo OS was selected.
502HeadlessRedisguiseEndpointNotVerifiedCouldn’t resolve and identity-verify the server’s d3Service API endpoint. DNS-SD discovery and the last-known address were both tried; the intended machine couldn’t be confirmed on a reachable IP and port.
505HeadlessRedisguiseNoOsWimNo OS .wim file was found in the selected OS.
506HeadlessRedisguiseNoBootWimNo boot .wim file was found in the selected OS.
507HeadlessRedisguiseReimageRequestFailedThe reimage request failed.
509HeadlessRedisguiseDesignerVersionTooLowThe server’s installed Designer version is below the minimum required, and headless mode can’t prompt to override.
510HeadlessRedisguiseActorHasRunningProjectThe server has a project open in Designer, and headless mode can’t prompt to override.
511HeadlessRedisguiseMultipleBootWimsThe OS profile contains more than one boot .wim, and headless mode can’t prompt to pick which one to use.
CodeNameMeaning
600HeadlessUsbNoOsSelectedNo OS was selected for Redisguise USB creation.