Skip to content

Commit

Permalink
Adds -Force switch for Disconnect-CSObject cmdlet
Browse files Browse the repository at this point in the history
  • Loading branch information
ryannewington committed Apr 20, 2017
1 parent 5102ae3 commit 521b108
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Lithnet.Miiserver.Automation/Disconnect-CSObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
namespace Lithnet.Miiserver.Automation
{
[Cmdlet(VerbsCommunications.Disconnect, "CSObject")]
public class DisconnectCSObject : Cmdlet
public class DisconnectCSObject : PSCmdlet
{
[Parameter(Mandatory = true, Position = 1, ValueFromPipeline =true), ValidateNotNullOrEmpty]
public CSObject CSObject { get; set; }

[Parameter(Mandatory = false, Position = 2)]
public SwitchParameter Explicit {get;set;}

[Parameter(Mandatory = false, Position = 3)]
public SwitchParameter Force { get; set; }

private bool yesToAll;

private bool noToAll;
Expand All @@ -32,7 +35,7 @@ protected override void ProcessRecord()
return;
}

if (this.yesToAll || this.ShouldContinue("This action will result in the metaverse object being deleted. Continue", "Confirm disconnection", ref this.yesToAll, ref this.noToAll))
if (this.Force || this.yesToAll || this.ShouldContinue("This action will result in the metaverse object being deleted. Continue", "Confirm disconnection", ref this.yesToAll, ref this.noToAll))
{
this.prompted = true;
this.CSObject.Disconnect(this.Explicit.IsPresent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<ModuleObject xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fVersion="1.1" type="Manifest" mclass="Module" useSupports="false">
<Name>LithnetMIISAutomation</Name>
<Version>1.0.6236.18578</Version>
<Version>1.0.6320.366</Version>
<Description>Lithnet PowerShell Module for FIM Synchronization Service</Description>
<HasManifest>true</HasManifest>
<Provider>
Expand Down

0 comments on commit 521b108

Please sign in to comment.