private async void GetApplicationEventsJsonButton_Click(object sender, EventArgs e)
        {
            JsonTimeTextBox.Text = "";
            GetApplicationEventsJsonButton.Enabled = false;

            if (!Properties.Settings.Default.DonotShowAgain)
            {
                MessageBox.Show("This may take awhile, feel free to run other operations while waiting.");
                Properties.Settings.Default.DonotShowAgain = true;
                Properties.Settings.Default.Save();
            }


            try
            {
                StopWatcher.Instance.Start();
                var serviceItems = await PowerShellOperations1.GetApplicationEventsAsJson();

                JsonTimeTextBox.Text = $"{StopWatcher.Instance.ElapsedFormatted}";

                var f = new EventsForm(serviceItems);

                f.ShowDialog();
            }
            finally
            {
                GetApplicationEventsJsonButton.Enabled = true;
            }
        }
        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>
        /// In this case the file name is a parameter to the PowerShell command and
        /// more details are obtained
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GetIpAddressVersion3Button_Click(object sender, EventArgs e)
        {
            IpItem ipAddress = new();

            await Task.Run(async() => { ipAddress = await PowerShellOperations1.GetIpAddressAsJsonTask(); });

            MessageBox.Show(!string.IsNullOrWhiteSpace(ipAddress.Ip) ? ipAddress.Details : "Operation failed");
        }
        /// <summary>
        /// Simple code sample to grab information from the system registry
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void RunScriptButton_Click(object sender, EventArgs e)
        {
            const string fileName = "regFile.txt";
            var          results  = await PowerShellOperations1.GetRegistryInformationAsJson(fileName);

            if (results)
            {
                var lines = FileHelpers.ReadAllLines(fileName);
                MessageBox.Show(lines.Count.ToString());
            }
            else
            {
                MessageBox.Show("Operation failed");
            }
        }
 /// <summary>
 /// Used when Windows marks file(s) with mark of the web which usually happens
 /// when downloading files from the web such as a Visual Studio project.
 ///
 /// To test, pass in a folder name that exists with one or more files with
 /// the mark of the web, run, inspect the files via their property dialog to
 /// confirm the code worked.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UnblockFolderButton_Click(object sender, EventArgs e)
 {
     PowerShellOperations1.UnblockFiles("C:\\OED\\DataValidationWindowsForms1");
 }
        /// <summary>
        /// Get computer information
        /// Note OsUpTime has a ToString override
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ComputerInformationButton_Click(object sender, EventArgs e)
        {
            var details = await PowerShellOperations1.GetComputerInformationTask();

            MessageBox.Show($"Up time\n{details.OsUptime}\n{details.OsLocalDateTime.ToString("G")}");
        }
        /// <summary>
        /// Get time zone information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void TimeZoneButton_Click(object sender, EventArgs e)
        {
            var timeZone = await PowerShellOperations1.GetTimeZoneTask();

            MessageBox.Show($"{timeZone.StandardName}\nSupports daylight savings {timeZone.SupportsDaylightSavingTime.ToYesNoString()}");
        }