public override void ExecuteCmdlet() { ExecutionBlock(() => { if (this.IsParameterBound(c => c.InputObject)) { UPNOrObjectId = !string.IsNullOrEmpty(InputObject.UserPrincipalName) ? InputObject.UserPrincipalName : InputObject.Id.ToString(); } else if (this.IsParameterBound(c => c.UserPrincipalName)) { UPNOrObjectId = UserPrincipalName; } else if (this.IsParameterBound(c => c.ObjectId)) { UPNOrObjectId = ObjectId.ToString(); } else if (this.IsParameterBound(c => c.DisplayName)) { UPNOrObjectId = ActiveDirectoryClient.GetUserObjectIdFromDisplayName(DisplayName).ToString(); } ConfirmAction( Force.IsPresent, string.Format(ProjectResources.RemoveUserConfirmation, UPNOrObjectId), ProjectResources.RemovingUser, UPNOrObjectId, () => ActiveDirectoryClient.RemoveUser(UPNOrObjectId)); if (PassThru.IsPresent) { WriteObject(true); } }); }