Windows Service Deployment error in BeforePostDeploy.ps1

We are using deploying a windows service on a tentacle running version Initially we were able to deploy this windows service successfully without errors and then suddenly deployments started failing with the following error report:

Get-WMIObject : Provider load failure
At C:\Program Files\Octopus Deploy\Tentacle\Scripts\Octopus.Features.WindowsService_BeforePostDeploy.ps1:125 char:11

  • $status = Get-WMIObject win32_service -filter (“name=’” + $serviceName + “’”) -c …
  •   + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], ManagementException
      + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

The service is installed and updated on the server so I don’t understand why the error occurs and how I can clean the issue.

Thanks for your help!

I forgot to mention that the service is not started but starting the service manually is successful.

Hi Stephen,

Thanks for getting in touch! Are you able to provide a full deployment log:
and a screenshot of your step that sets the service details.

It should help us find the issue.

Thanks for the quick response! Attached is the requested log.

ServerTasks-10188.log.txt (37 KB)

Sorry … here is the requested screenshot

Hi Stephen,

Sorry for the delay in getting back to you. This error isn’t actually anything we have seen but I had a chat with Damian and we think that there is a race condition happening here where the name isn’t available when it tries to start. If you are happy to modify the C:\Program Files\Octopus Deploy\Tentacle\Scripts\Octopus.Features.WindowsService_BeforePostDeploy.ps1 PowerShell script and add the following line Start-Sleep -s 5 to see if adding a pause before the start allows the name to become available.


Hello Vanessa,

I’ve updated the script and the deployment was successful.

It is a rather strange issue since it only appears to be an issue at certain times. We have seen that we can do a deployment 3 or 4 times successfully and then suddenly the problem occurs. Wait a day and then the deployment runs fine again.

In any case, I will watch to see that the error does not reoccur.

Thanks for you help!

Hi Stephen,

Thanks for making that change and confirming our suspicion. We are going to add a ‘try again’ when that error occurs on starting a service.


I have same issue in version 3.1.1, what is solution for this version?



Could you please provide a full deployment log?




thx for response. Can I send you deployment log privately?

Yes, please send it to . On the body of the email add a line saying it belongs to this ticket (put the link)



not sure what is [email blocked] address in your email?

Please try with support[at]Octopus[dot]com or dalmiro.granas[at]octopus[dot]com