Just worked a support case with the customer using the RM task, Execute Remote PowerShell command on a Windows Server 2012 R2 server and seeing the following error message on a deployment:
System.AggregateException: Failed to install 'VisualStudioRemoteDeployere84cd437' from service executable path VisualStudioRemoteDeployer.exe . Consult the logs below:
Program 'sc.exe' failed to run: Object reference not set to an instance of an object.At line:1 char:295
+ New-Service -BinaryPathName "$env:windir\DtlDownloads\VisualStudioRemoteDeployer ...
at Microsoft.VisualStudio.Services.DevTestLabs.Deployment.Deployment.PowershellExecutor.Invoke(String errorContextMessage, Boolean writeResultToLog, Boolean isCancellable)
This left several ghost services installed on the server and it looked like this:
Went through several steps to verify WinRM was configured correctly and we could issue basic commands from the RM deployment server and discovered we could not execute a basic remote PowerShell command. There were no entries in the event logs indicating an issue, or other log files showing the error.
Installed PowerShell 5 through the latest version of the Windows Management Framework Windows Management Framework 5.0
Unfortunately, no exact root cause was found for the issue and the updated version of PowerShell resolved this issue.