/// <summary> /// Starts the named virtual machine. /// </summary> /// <param name="machineName">The machine name.</param> public void StartVm(string machineName) { if (isAdmin) { hypervClient.StartVm(machineName: machineName); } else { var request = new GrpcStartVmRequest(machineName: machineName); var reply = desktopService.StartVmAsync(request).Result; reply.Error.EnsureSuccess(); } }
/// <inheritdoc/> public async Task <GrpcBaseReply> StartVmAsync(GrpcStartVmRequest request, CallContext context = default) { await SyncContext.Clear; try { hyperv.StartVm(machineName: request.MachineName); return(new GrpcBaseReply()); } catch (Exception e) { return(new GrpcBaseReply(e)); } }