protected override void DoExecute() { try { var powerShellRemoteExecutor = new PowerShellExecutor( new PowerShellConfiguration { IsRemote = _isRemote, RemoteMachineName = _machineName, OnOutput = LogOutput, OnError = LogError, }); string script = string.Format(ScriptTemplate, _lazyScriptPath.Value, _scriptName); powerShellRemoteExecutor.Execute(script); PostDiagnosticMessage(string.Format("PowerShell script executed successfully, script: {0}", _lazyScriptPath), DiagnosticMessageType.Info); } catch (Exception exc) { PostDiagnosticMessage(string.Format("PowerShell script execution failed, script: {0}", _lazyScriptPath), DiagnosticMessageType.Error); throw new DeploymentTaskException(string.Format("Error while executing PowerShell script: {0}", _lazyScriptPath), exc); } }
protected override void DoExecute() { var powerShellRemoteExecutor = new PowerShellExecutor( new PowerShellConfiguration { IsRemote = true, RemoteMachineName = _machineName, OnOutput = OnOutput, OnError = OnError, }); string script = string.Format(RemoveDirScriptTemplate, _directoryPathToRemove.Value); powerShellRemoteExecutor.Execute(script); }
protected override void DoExecute() { var powerShellRemoteExecutor = new PowerShellExecutor( new PowerShellConfiguration { IsRemote = true, RemoteMachineName = _machineName, OnOutput = OnOutput, OnError = OnError, }); PSObject psObject = powerShellRemoteExecutor.Execute(CreateTempDirScript); if (psObject == null || psObject.BaseObject == null || psObject.BaseObject is string == false) { throw new DeploymentTaskException(string.Format("Failed creating remote temp dir on machine: [{0}]", _machineName)); } RemoteTempDirPath = psObject.BaseObject as string; }