private async void AddressFamilyButton_Click(object sender, EventArgs e)
        {
            FamilyListBox.DataSource = null;
            var families = await PowerShellOperations.GetAddressFamilyContainerAsJson();

            FamilyListBox.DataSource = families;
        }
        private async void OnShown(object sender, EventArgs e)
        {
            Console.WriteLine($@"Today: {DateTime.Now:D}");
            Console.WriteLine();

            Console.WriteLine("Addresses");

            var families = await PowerShellOperations.GetAddressFamilyContainerAsJson();

            foreach (var family in families)
            {
                Console.WriteLine(family);
            }

            Console.WriteLine();

            Console.WriteLine("Up time");

            var details = await PowerShellOperations1.GetComputerInformationTask();

            Console.WriteLine($"Up time\n{details.OsUptime}");

            Console.WriteLine();

            Console.WriteLine("Visual Studio path");
            var vsPath = Environment.GetEnvironmentVariable("VisualStudioDir");

            Console.WriteLine(string.IsNullOrWhiteSpace(vsPath) ? "Not installed" : vsPath);

            textBox1.SelectionStart  = textBox1.Text.Length;
            textBox1.SelectionLength = 0;
        }
        /// <summary>
        /// Get services to an html page presented in Chrome browser.
        /// The return type is named tuple which allows multiple items to be returned,
        /// in this case a bool indicating if the operation completed properly or failed
        /// and on failure return the exception. We could also return the exception text
        /// rather than the entire exception object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GetServicesHtmlButton_Click(object sender, EventArgs e)
        {
            var(success, exception) = await PowerShellOperations.GetServicesAsHtml();

            if (!success)
            {
                MessageBox.Show($"Failed to open page\n{exception.Message}");
            }
        }
        /// <summary>
        /// Get IP address asynchronously
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GetIpAddressVersion2Button_Click(object sender, EventArgs e)
        {
            IpAddressTextBox2.Text = "";

            string ipAddress = "";

            await Task.Run(async() => { ipAddress = await PowerShellOperations.GetIpAddressTask(); });

            IpAddressTextBox2.Text = !string.IsNullOrWhiteSpace(ipAddress) ? ipAddress : "Failed to obtain IP address";
        }
        /// <summary>
        /// Get all services and their status
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GetServicesAsJsonButton_Click(object sender, EventArgs e)
        {
            ServicesListView.Items.Clear();

            var serviceItems = await PowerShellOperations.GetServicesAsJson();

            ServiceCountLabel.Text = serviceItems.Count.ToString();

            ServicesListView.BeginUpdate();

            try
            {
                foreach (var serviceItem in serviceItems)
                {
                    ServicesListView.Items.Add(new ListViewItem(serviceItem.ItemArray()));
                }

                ServicesListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

                /*
                 * Example for finding an item (service) in the ListView and if found
                 * scroll to the item.
                 *
                 * In this case to ensure SQLEXPRESS service is running.
                 */
                var listViewItem = ServicesListView.FindItemWithText("MSSQL$SQLEXPRESS");
                if (listViewItem != null)
                {
                    var index = ServicesListView.Items.IndexOf(listViewItem);
                    ServicesListView.Items[index].Selected = true;
                    ServicesListView.EnsureVisible(index);
                }
                else
                {
                    ServicesListView.Items[0].Selected = true;
                    ServicesListView.EnsureVisible(0);
                }

                ActiveControl = ServicesListView;
            }
            finally
            {
                ServicesListView.EndUpdate();
            }
        }
        /// <summary>
        /// Not PowerShell yet follows the same pattern to get information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OfficeStatusButton_Click(object sender, EventArgs e)
        {
            var result = await PowerShellOperations.OfficeStatusAsync();

            if (result == "Directory not found")
            {
                MessageBox.Show("Incorrect folder");
                return;
            }

            if (result.Contains("LICENSE STATUS:  ---LICENSED---"))
            {
                MessageBox.Show("Good to go");
            }
            else
            {
                MessageBox.Show("Licence expired");
            }
        }
 /// <summary>
 /// Asynchronous processing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private async void Example2Button_Click(object sender, EventArgs e)
 {
     ResultsTextBox.Text = "";
     await PowerShellOperations.Example2Task();
 }
 /// <summary>
 /// Synchronous processing
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Example1Button_Click(object sender, EventArgs e)
 {
     ResultsTextBox.Text = "";
     PowerShellOperations.Example1();
 }
 /// <summary>
 /// Get IP address synchronously
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GetIpAddressVersion1Button_Click(object sender, EventArgs e)
 {
     IpAddressTextBox1.Text = "";
     IpAddressTextBox1.Text = PowerShellOperations.GetIpAddressSync();
 }