protected override void ProcessRecord() { try { if (string.IsNullOrWhiteSpace(Alias)) { Alias = Guid.NewGuid().ToString(); } string uri = string.Format(_uri, UserName, Alias); var domain = new Uri("https://" + Domain); var getUri = new Uri(domain, uri); var session = RestImplementation.PostWithKey(getUri, ApiKey, ApiSecret, DateTime.UtcNow); // Return from the cmdlet WriteObject(session); } catch (Exception ex) { WriteError(new ErrorRecord(ex, ex.GetType().Name, ErrorCategory.InvalidOperation, this.GetType().Name)); } }