protected override void ProcessRecord() { switch (this.ParameterSetName) { case _GRID_BY_OBJECT: case _SESSION_BY_OBJECT: case _ENTERED_SESSION_BY_OBJECT: { base.ProcessByNewObject(this.InputObject); break; } case _GRID_BY_ATTRIBUTE: case _SESSION_BY_ATTRIBUTE: case _ENTERED_SESSION_BY_ATTRIBUTE: case _GRID_NEXT_AVAILABLE_IP: case _SESSION_NEXT_AVAILABLE_IP: case _ENTERED_SESSION_NEXT_AVAILABLE_IP: { List <KeyValuePair <string, string> > PropertyList = new List <KeyValuePair <string, string> >(); if (this.ParameterSetName.EndsWith(_NEXT_AVAILABLE_IP)) { if (NetworkAddressTest.IsIPv4Cidr(this._Network)) { PropertyList.Add(new KeyValuePair <string, string>("ipv4addr", $"func:nextavailableip:{this._Network}")); } else if (NetworkAddressTest.IsIPv6Cidr(this._Network)) { PropertyList.Add(new KeyValuePair <string, string>("ipv6addr", $"func:nextavailableip:{this._Network}")); } else { throw new PSArgumentException("The provided network was not a valid IPv4 or IPv6 network."); } } base.ProcessByAttributeForNewObject("RecordType", PropertyList); break; } default: { throw new PSArgumentException("Bad parameter set name."); } } }