vCAC Provisioning without Guest Agent leaves Machine in ‘Installing OS’ state

When provisioning a server via PXE or ISO install you might run into a problem where you see your machines being in an ‘Installing OS’ state (between ‘BuildingMachine’ and ‘MachineProvisioned’) though the actual installation has finished long time ago. This might be because the ‘Guest Agent’ is either not installed on the image/machine or because there is no connectivity between the machine and vCAC (eg for security reason). Instead of waiting for the provisioning to time out there is a workaround that you might want to use: you manually advance the workflow to the next (i.e. Completed) state.

In order to do this you will lookup the (child) provisioning workflow for your machine via the WorkflowMaps and initiate a ChangeStateRequest as illustrated in the following example:

PS > $m.GetType().FullName;
PS > $Machine = $m.VirtualMachines |? VirtualMachineName -eq 'myServer';
PS > $wfMap = $m.WorkflowMaps |? VirtualMachineID -eq $Machine.VirtualMachineID;
PS > $wfMap
VirtualMachineID                     ChildWorkflowID
----------------                     ---------------
561e4136-a0ee-4746-8108-b3aa8ca49352 8836d18a-ed82-4bcc-bb76-a29632bdd7b3

PS > $csr = New-Object DynamicOps.ManagementModel.ChangeStateRequest;
PS > $csr
WorkflowID                           NextState IsEvent
----------                           --------- -------

PS > $csr.WorkflowID = $wfMap.ChildWorkflowID;
PS > $csr.NextState = 'BuildComplete';
PS > $csr.IsEvent = $false;
PS > $m.AddToChangeStateRequests($csr);
PS > $m.UpdateObject($csr);
PS > $m.SaveChanges();

The API equivalent would look like this:

PS > $Method = 'POST'
PS > $Uri = ''
PS > $ContentType = 'application/atom+xml;type=entry'
PS > $Body = @"
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d="" xmlns:m="" xmlns="">
 <title />
  <name />
 <id />
 <content type="application/xml">
   <d:IsEvent m:type="Edm.Boolean">false</d:IsEvent>
   <d:WorkflowID m:type="Edm.Guid">8836d18a-ed82-4bcc-bb76-a29632bdd7b3</d:WorkflowID>
PS > Invoke-RestMethod -Method $Method -Uri $Uri -Body $Body -UseDefaultCredentials -ContentType $ContentType;

After issuing this request you will see your machine advancing to the ‘MachineProvisioned’ state.

Note: Depending on your workflow you might see a step with a slightly different name, you should have a look at the workflow states for your specific workflow and advance to the next desired state.


  1. Jared says:

    How would you set this up for a UCS provisioning? I am trying to utilize your setup to advance a physical provisioning workflow. The situation is this – it would be amazing to be able to demo feature functionality w/ the UCS Emulator. However because the agent never responds it won’t allow me to provision it fully. Is there a way to utilize your script to push past the “InstallingOS”?

    • Ronald Rink says:

      Hi Jarek, though I never tried with the UCS Emulator the script in the post would normally exactly do that – advancing the state of “Installing OS” to “Machine Provisioned”. So I do not seem to fully understand your question. Did you try this out with the emulator? What kind of error are you seeing? Could it be that for UCS Deployment the states are named differently? Maybe if you gave more information via mail we could find out where the actual error is. Regards, Ronald

  2. Gopi says:

    What does $m variable indicates? looks like the some lines are missing..

    • Ronald Rink says:

      Hi Gopi, the ‘$m’ is of type ‘DynamicOps.ManagementModel.ManagementModelEntities’ as you can see in the script block, which is essentially the management context from vCAC (or to better say it, the service reference to the ManagementModelEntites.svc from vCAC). You can create that either by adding manually a ‘Add-Type -Path ‘ or just use our vCAC PowerShell module which you can download at: For a further explanation of the MgmtContext you can have a look at ‘’. The reason why I did not explain on how to get to ‘$m’ is, that most/all of the vCAC scripts rely on that MgmtContext anyway. You will find a couple of other articles describing the context and on how vCAC uses it on our blog. Maybe this can further assist you in exploring vCAC. In case you have further questions please let me know. Ronald

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: