DisableSettingCmdlet.cs (1613B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="DisableSettingCmdlet.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGet.Client.Cmdlets.Cmdlets 8 { 9 using System.Management.Automation; 10 using Microsoft.WinGet.Client.Common; 11 using Microsoft.WinGet.Client.Engine.Commands; 12 13 /// <summary> 14 /// Disables an admin setting. Requires admin. 15 /// </summary> 16 [Cmdlet(VerbsLifecycle.Disable, Constants.WinGetNouns.Setting)] 17 [Alias("dwgs")] 18 public sealed class DisableSettingCmdlet : PSCmdlet 19 { 20 /// <summary> 21 /// Gets or sets the name of the setting to disable. 22 /// </summary> 23 [Parameter( 24 Position = 0, 25 Mandatory = true, 26 ValueFromPipeline = true, 27 ValueFromPipelineByPropertyName = true)] 28 [ValidateSet( 29 "LocalManifestFiles", 30 "BypassCertificatePinningForMicrosoftStore", 31 "InstallerHashOverride", 32 "LocalArchiveMalwareScanOverride", 33 "ProxyCommandLineOptions")] 34 public string Name { get; set; } 35 36 /// <summary> 37 /// Disables the admin setting. 38 /// </summary> 39 protected override void ProcessRecord() 40 { 41 var command = new CliCommand(this); 42 command.DisableSetting(this.Name); 43 } 44 } 45 }