/// <summary> /// /// </summary> protected override void EndProcessing() { // if user did not specify any shell, act on the default shell. if (_shellsToDisable.Count == 0) { _shellsToDisable.Add(RemotingConstants.DefaultShellName); } //WriteWarning(StringUtil.Format(RemotingErrorIdStrings.DcsWarningMessage)); WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.EcsScriptMessageV, disablePluginSbFormat)); // gather -WhatIf, -Confirm parameter data and pass it to the script block bool whatIf = false; // confirm is always true to start with bool confirm = true; PSSessionConfigurationCommandUtilities.CollectShouldProcessParameters(this, out whatIf, out confirm); string restartWinRMMessage = RemotingErrorIdStrings.RestartWinRMMessage; string setEnabledTarget = RemotingErrorIdStrings.SetEnabledFalseTarget; string setEnabledAction = StringUtil.Format(RemotingErrorIdStrings.CSShouldProcessAction, "Set-Item"); s_disablePluginSb.InvokeUsingCmdlet( contextCmdlet: this, useLocalScope: true, errorHandlingBehavior: ScriptBlock.ErrorHandlingBehavior.WriteToCurrentErrorPipe, dollarUnder: _shellsToDisable, input: Utils.EmptyArray<object>(), scriptThis: AutomationNull.Value, args: new object[] { _force, whatIf, confirm, restartWinRMMessage, setEnabledTarget, setEnabledAction, _noRestart}); System.Management.Automation.Tracing.Tracer tracer = new System.Management.Automation.Tracing.Tracer(); StringBuilder sb = new StringBuilder(); foreach (string endPointName in Name ?? Utils.EmptyArray<string>()) { sb.Append(endPointName); sb.Append(", "); } if (sb.Length > 0) { sb.Remove(sb.Length - 2, 2); } tracer.EndpointDisabled(sb.ToString(), WindowsIdentity.GetCurrent().Name); }
/// <summary> /// </summary> protected override void EndProcessing() { System.Management.Automation.Tracing.Tracer tracer = new System.Management.Automation.Tracing.Tracer(); tracer.EndpointRegistered(this.Name, this.sessionType.ToString(), WindowsIdentity.GetCurrent().Name); }
/// <summary> /// </summary> protected override void EndProcessing() { PSSessionConfigurationCommandUtilities.RestartWinRMService(this, _isErrorReported, Force, noRestart); if (!_isErrorReported && noRestart) { string action = StringUtil.Format(RemotingErrorIdStrings.CSShouldProcessAction, this.CommandInfo.Name); WriteWarning(StringUtil.Format(RemotingErrorIdStrings.WinRMRequiresRestart, action)); } System.Management.Automation.Tracing.Tracer tracer = new System.Management.Automation.Tracing.Tracer(); tracer.EndpointModified(this.Name, WindowsIdentity.GetCurrent().Name); }