Projects STRLCPY ADReplStatus Commits ec4d217a
🤬
  • ■ ■ ■ ■ ■ ■
    ADReplStatus.csproj
     1 +<?xml version="1.0" encoding="utf-8"?>
     2 +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3 + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
     4 + <PropertyGroup>
     5 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     6 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     7 + <ProjectGuid>{AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}</ProjectGuid>
     8 + <OutputType>WinExe</OutputType>
     9 + <RootNamespace>ADReplStatus</RootNamespace>
     10 + <AssemblyName>ADReplStatus</AssemblyName>
     11 + <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
     12 + <FileAlignment>512</FileAlignment>
     13 + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
     14 + <Deterministic>true</Deterministic>
     15 + </PropertyGroup>
     16 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     17 + <PlatformTarget>AnyCPU</PlatformTarget>
     18 + <DebugSymbols>true</DebugSymbols>
     19 + <DebugType>full</DebugType>
     20 + <Optimize>false</Optimize>
     21 + <OutputPath>bin\Debug\</OutputPath>
     22 + <DefineConstants>DEBUG;TRACE</DefineConstants>
     23 + <ErrorReport>prompt</ErrorReport>
     24 + <WarningLevel>4</WarningLevel>
     25 + </PropertyGroup>
     26 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     27 + <PlatformTarget>AnyCPU</PlatformTarget>
     28 + <DebugType>pdbonly</DebugType>
     29 + <Optimize>true</Optimize>
     30 + <OutputPath>bin\Release\</OutputPath>
     31 + <DefineConstants>TRACE</DefineConstants>
     32 + <ErrorReport>prompt</ErrorReport>
     33 + <WarningLevel>4</WarningLevel>
     34 + </PropertyGroup>
     35 + <PropertyGroup>
     36 + <ApplicationIcon>Forest.ico</ApplicationIcon>
     37 + </PropertyGroup>
     38 + <ItemGroup>
     39 + <Reference Include="ObjectListView, Version=2.9.1.1072, Culture=neutral, PublicKeyToken=b1c5bf581481bcd4, processorArchitecture=MSIL">
     40 + <HintPath>packages\ObjectListView.Official.2.9.1\lib\net20\ObjectListView.dll</HintPath>
     41 + </Reference>
     42 + <Reference Include="System" />
     43 + <Reference Include="System.Core" />
     44 + <Reference Include="System.DirectoryServices" />
     45 + <Reference Include="System.Xml.Linq" />
     46 + <Reference Include="System.Data.DataSetExtensions" />
     47 + <Reference Include="Microsoft.CSharp" />
     48 + <Reference Include="System.Data" />
     49 + <Reference Include="System.Deployment" />
     50 + <Reference Include="System.Drawing" />
     51 + <Reference Include="System.Net.Http" />
     52 + <Reference Include="System.Windows.Forms" />
     53 + <Reference Include="System.Xml" />
     54 + </ItemGroup>
     55 + <ItemGroup>
     56 + <Compile Include="ADReplStatusForm.cs">
     57 + <SubType>Form</SubType>
     58 + </Compile>
     59 + <Compile Include="ADReplStatusForm.Designer.cs">
     60 + <DependentUpon>ADReplStatusForm.cs</DependentUpon>
     61 + </Compile>
     62 + <Compile Include="AlternateCredsForm.cs">
     63 + <SubType>Form</SubType>
     64 + </Compile>
     65 + <Compile Include="AlternateCredsForm.Designer.cs">
     66 + <DependentUpon>AlternateCredsForm.cs</DependentUpon>
     67 + </Compile>
     68 + <Compile Include="Program.cs" />
     69 + <Compile Include="Properties\AssemblyInfo.cs" />
     70 + <Compile Include="SetForestNameForm.cs">
     71 + <SubType>Form</SubType>
     72 + </Compile>
     73 + <Compile Include="SetForestNameForm.Designer.cs">
     74 + <DependentUpon>SetForestNameForm.cs</DependentUpon>
     75 + </Compile>
     76 + <EmbeddedResource Include="ADReplStatusForm.resx">
     77 + <DependentUpon>ADReplStatusForm.cs</DependentUpon>
     78 + </EmbeddedResource>
     79 + <EmbeddedResource Include="AlternateCredsForm.resx">
     80 + <DependentUpon>AlternateCredsForm.cs</DependentUpon>
     81 + </EmbeddedResource>
     82 + <EmbeddedResource Include="Properties\Resources.resx">
     83 + <Generator>ResXFileCodeGenerator</Generator>
     84 + <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     85 + <SubType>Designer</SubType>
     86 + </EmbeddedResource>
     87 + <Compile Include="Properties\Resources.Designer.cs">
     88 + <AutoGen>True</AutoGen>
     89 + <DependentUpon>Resources.resx</DependentUpon>
     90 + </Compile>
     91 + <EmbeddedResource Include="SetForestNameForm.resx">
     92 + <DependentUpon>SetForestNameForm.cs</DependentUpon>
     93 + </EmbeddedResource>
     94 + <None Include="packages.config" />
     95 + <None Include="Properties\Settings.settings">
     96 + <Generator>SettingsSingleFileGenerator</Generator>
     97 + <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     98 + </None>
     99 + <Compile Include="Properties\Settings.Designer.cs">
     100 + <AutoGen>True</AutoGen>
     101 + <DependentUpon>Settings.settings</DependentUpon>
     102 + <DesignTimeSharedInput>True</DesignTimeSharedInput>
     103 + </Compile>
     104 + </ItemGroup>
     105 + <ItemGroup>
     106 + <None Include="App.config" />
     107 + </ItemGroup>
     108 + <ItemGroup>
     109 + <Content Include="Forest.ico" />
     110 + </ItemGroup>
     111 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     112 +</Project>
  • ■ ■ ■ ■ ■ ■
    ADReplStatus.sln
     1 +
     2 +Microsoft Visual Studio Solution File, Format Version 12.00
     3 +# Visual Studio Version 17
     4 +VisualStudioVersion = 17.4.33205.214
     5 +MinimumVisualStudioVersion = 10.0.40219.1
     6 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ADReplStatus", "ADReplStatus.csproj", "{AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}"
     7 +EndProject
     8 +Global
     9 + GlobalSection(SolutionConfigurationPlatforms) = preSolution
     10 + Debug|Any CPU = Debug|Any CPU
     11 + Release|Any CPU = Release|Any CPU
     12 + EndGlobalSection
     13 + GlobalSection(ProjectConfigurationPlatforms) = postSolution
     14 + {AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     15 + {AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}.Debug|Any CPU.Build.0 = Debug|Any CPU
     16 + {AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}.Release|Any CPU.ActiveCfg = Release|Any CPU
     17 + {AF7EE9DD-D7C5-409C-A1E9-78E1078F6A89}.Release|Any CPU.Build.0 = Release|Any CPU
     18 + EndGlobalSection
     19 + GlobalSection(SolutionProperties) = preSolution
     20 + HideSolutionNode = FALSE
     21 + EndGlobalSection
     22 + GlobalSection(ExtensibilityGlobals) = postSolution
     23 + SolutionGuid = {07B32D0E-B7B7-49A4-8ED3-43C83A52FC2D}
     24 + EndGlobalSection
     25 +EndGlobal
     26 + 
  • ■ ■ ■ ■ ■ ■
    ADReplStatusForm.Designer.cs
     1 +namespace ADReplStatus
     2 +{
     3 + partial class ADReplStatusForm
     4 + {
     5 + /// <summary>
     6 + /// Required designer variable.
     7 + /// </summary>
     8 + private System.ComponentModel.IContainer components = null;
     9 + 
     10 + /// <summary>
     11 + /// Clean up any resources being used.
     12 + /// </summary>
     13 + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     14 + protected override void Dispose(bool disposing)
     15 + {
     16 + if (disposing && (components != null))
     17 + {
     18 + components.Dispose();
     19 + }
     20 + base.Dispose(disposing);
     21 + }
     22 + 
     23 + #region Windows Form Designer generated code
     24 + 
     25 + /// <summary>
     26 + /// Required method for Designer support - do not modify
     27 + /// the contents of this method with the code editor.
     28 + /// </summary>
     29 + private void InitializeComponent()
     30 + {
     31 + this.components = new System.ComponentModel.Container();
     32 + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ADReplStatusForm));
     33 + this.RefreshButton = new System.Windows.Forms.Button();
     34 + this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
     35 + this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
     36 + this.EnableLoggingButton = new System.Windows.Forms.Button();
     37 + this.SetForestButton = new System.Windows.Forms.Button();
     38 + this.ProgressPictureBox = new System.Windows.Forms.PictureBox();
     39 + this.AlternateCredsButton = new System.Windows.Forms.Button();
     40 + this.ProgressPercentLabel = new System.Windows.Forms.Label();
     41 + this.treeListView1 = new BrightIdeasSoftware.TreeListView();
     42 + this.DCNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     43 + this.DomainNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     44 + this.SiteColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     45 + this.DiscoveryIssuesColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     46 + this.IsGCColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     47 + this.IsRODCColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     48 + this.SourceServerColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     49 + this.PartitionNameColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     50 + this.ConsecutiveFailureCountColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     51 + this.LastSuccessfulSyncColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     52 + this.LastSyncResultColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     53 + this.LastSyncMessageColumn = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
     54 + this.ErrorsOnlyButton = new System.Windows.Forms.Button();
     55 + ((System.ComponentModel.ISupportInitialize)(this.ProgressPictureBox)).BeginInit();
     56 + ((System.ComponentModel.ISupportInitialize)(this.treeListView1)).BeginInit();
     57 + this.SuspendLayout();
     58 + //
     59 + // RefreshButton
     60 + //
     61 + this.RefreshButton.Image = ((System.Drawing.Image)(resources.GetObject("RefreshButton.Image")));
     62 + this.RefreshButton.Location = new System.Drawing.Point(12, 12);
     63 + this.RefreshButton.Name = "RefreshButton";
     64 + this.RefreshButton.Size = new System.Drawing.Size(50, 50);
     65 + this.RefreshButton.TabIndex = 0;
     66 + this.RefreshButton.UseVisualStyleBackColor = true;
     67 + this.RefreshButton.Click += new System.EventHandler(this.RefreshButton_Click);
     68 + //
     69 + // backgroundWorker1
     70 + //
     71 + this.backgroundWorker1.WorkerReportsProgress = true;
     72 + this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
     73 + this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
     74 + this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
     75 + //
     76 + // EnableLoggingButton
     77 + //
     78 + this.EnableLoggingButton.Image = ((System.Drawing.Image)(resources.GetObject("EnableLoggingButton.Image")));
     79 + this.EnableLoggingButton.Location = new System.Drawing.Point(292, 12);
     80 + this.EnableLoggingButton.Name = "EnableLoggingButton";
     81 + this.EnableLoggingButton.Size = new System.Drawing.Size(50, 50);
     82 + this.EnableLoggingButton.TabIndex = 3;
     83 + this.EnableLoggingButton.UseVisualStyleBackColor = true;
     84 + this.EnableLoggingButton.Click += new System.EventHandler(this.EnableLoggingButton_Click);
     85 + //
     86 + // SetForestButton
     87 + //
     88 + this.SetForestButton.Image = ((System.Drawing.Image)(resources.GetObject("SetForestButton.Image")));
     89 + this.SetForestButton.Location = new System.Drawing.Point(124, 12);
     90 + this.SetForestButton.Name = "SetForestButton";
     91 + this.SetForestButton.Size = new System.Drawing.Size(50, 50);
     92 + this.SetForestButton.TabIndex = 4;
     93 + this.SetForestButton.UseVisualStyleBackColor = true;
     94 + this.SetForestButton.Click += new System.EventHandler(this.SetForestButton_Click);
     95 + //
     96 + // ProgressPictureBox
     97 + //
     98 + this.ProgressPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("ProgressPictureBox.Image")));
     99 + this.ProgressPictureBox.Location = new System.Drawing.Point(72, 22);
     100 + this.ProgressPictureBox.Name = "ProgressPictureBox";
     101 + this.ProgressPictureBox.Size = new System.Drawing.Size(40, 40);
     102 + this.ProgressPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
     103 + this.ProgressPictureBox.TabIndex = 5;
     104 + this.ProgressPictureBox.TabStop = false;
     105 + this.ProgressPictureBox.Visible = false;
     106 + //
     107 + // AlternateCredsButton
     108 + //
     109 + this.AlternateCredsButton.Image = ((System.Drawing.Image)(resources.GetObject("AlternateCredsButton.Image")));
     110 + this.AlternateCredsButton.Location = new System.Drawing.Point(180, 12);
     111 + this.AlternateCredsButton.Name = "AlternateCredsButton";
     112 + this.AlternateCredsButton.Size = new System.Drawing.Size(50, 50);
     113 + this.AlternateCredsButton.TabIndex = 6;
     114 + this.AlternateCredsButton.UseVisualStyleBackColor = true;
     115 + this.AlternateCredsButton.Click += new System.EventHandler(this.AlternateCredsButton_Click);
     116 + //
     117 + // ProgressPercentLabel
     118 + //
     119 + this.ProgressPercentLabel.Location = new System.Drawing.Point(71, 9);
     120 + this.ProgressPercentLabel.Name = "ProgressPercentLabel";
     121 + this.ProgressPercentLabel.Size = new System.Drawing.Size(42, 12);
     122 + this.ProgressPercentLabel.TabIndex = 8;
     123 + this.ProgressPercentLabel.Text = "0%";
     124 + this.ProgressPercentLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     125 + this.ProgressPercentLabel.Visible = false;
     126 + //
     127 + // treeListView1
     128 + //
     129 + this.treeListView1.AllColumns.Add(this.DCNameColumn);
     130 + this.treeListView1.AllColumns.Add(this.DomainNameColumn);
     131 + this.treeListView1.AllColumns.Add(this.SiteColumn);
     132 + this.treeListView1.AllColumns.Add(this.DiscoveryIssuesColumn);
     133 + this.treeListView1.AllColumns.Add(this.IsGCColumn);
     134 + this.treeListView1.AllColumns.Add(this.IsRODCColumn);
     135 + this.treeListView1.AllColumns.Add(this.SourceServerColumn);
     136 + this.treeListView1.AllColumns.Add(this.PartitionNameColumn);
     137 + this.treeListView1.AllColumns.Add(this.ConsecutiveFailureCountColumn);
     138 + this.treeListView1.AllColumns.Add(this.LastSuccessfulSyncColumn);
     139 + this.treeListView1.AllColumns.Add(this.LastSyncResultColumn);
     140 + this.treeListView1.AllColumns.Add(this.LastSyncMessageColumn);
     141 + this.treeListView1.CellEditUseWholeCell = false;
     142 + this.treeListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     143 + this.DCNameColumn,
     144 + this.DomainNameColumn,
     145 + this.SiteColumn,
     146 + this.DiscoveryIssuesColumn,
     147 + this.IsGCColumn,
     148 + this.IsRODCColumn,
     149 + this.SourceServerColumn,
     150 + this.PartitionNameColumn,
     151 + this.ConsecutiveFailureCountColumn,
     152 + this.LastSuccessfulSyncColumn,
     153 + this.LastSyncResultColumn,
     154 + this.LastSyncMessageColumn});
     155 + this.treeListView1.Cursor = System.Windows.Forms.Cursors.Default;
     156 + this.treeListView1.HideSelection = false;
     157 + this.treeListView1.Location = new System.Drawing.Point(12, 68);
     158 + this.treeListView1.Name = "treeListView1";
     159 + this.treeListView1.ShowGroups = false;
     160 + this.treeListView1.Size = new System.Drawing.Size(760, 381);
     161 + this.treeListView1.TabIndex = 9;
     162 + this.treeListView1.UseCompatibleStateImageBehavior = false;
     163 + this.treeListView1.UseFiltering = true;
     164 + this.treeListView1.View = System.Windows.Forms.View.Details;
     165 + this.treeListView1.VirtualMode = true;
     166 + this.treeListView1.FormatRow += new System.EventHandler<BrightIdeasSoftware.FormatRowEventArgs>(this.treeListView1_FormatRow);
     167 + //
     168 + // DCNameColumn
     169 + //
     170 + this.DCNameColumn.AspectName = "Name";
     171 + this.DCNameColumn.Groupable = false;
     172 + this.DCNameColumn.Text = "DC Name";
     173 + //
     174 + // DomainNameColumn
     175 + //
     176 + this.DomainNameColumn.AspectName = "DomainName";
     177 + this.DomainNameColumn.Text = "Domain";
     178 + //
     179 + // SiteColumn
     180 + //
     181 + this.SiteColumn.AspectName = "Site";
     182 + this.SiteColumn.Text = "Site";
     183 + //
     184 + // DiscoveryIssuesColumn
     185 + //
     186 + this.DiscoveryIssuesColumn.AspectName = "DiscoveryIssues";
     187 + this.DiscoveryIssuesColumn.Text = "Discovery Issues";
     188 + //
     189 + // IsGCColumn
     190 + //
     191 + this.IsGCColumn.AspectName = "IsGC";
     192 + this.IsGCColumn.Text = "Is GC";
     193 + //
     194 + // IsRODCColumn
     195 + //
     196 + this.IsRODCColumn.AspectName = "IsRODC";
     197 + this.IsRODCColumn.Text = "Is RODC";
     198 + //
     199 + // SourceServerColumn
     200 + //
     201 + this.SourceServerColumn.AspectName = "SourceServer";
     202 + this.SourceServerColumn.Text = "Source DC";
     203 + //
     204 + // PartitionNameColumn
     205 + //
     206 + this.PartitionNameColumn.AspectName = "PartitionName";
     207 + this.PartitionNameColumn.Text = "Partition";
     208 + //
     209 + // ConsecutiveFailureCountColumn
     210 + //
     211 + this.ConsecutiveFailureCountColumn.AspectName = "ConsecutiveFailureCount";
     212 + this.ConsecutiveFailureCountColumn.Text = "Consecutive Failures";
     213 + //
     214 + // LastSuccessfulSyncColumn
     215 + //
     216 + this.LastSuccessfulSyncColumn.AspectName = "LastSuccessfulSync";
     217 + this.LastSuccessfulSyncColumn.Text = "Last Successful Sync";
     218 + //
     219 + // LastSyncResultColumn
     220 + //
     221 + this.LastSyncResultColumn.AspectName = "LastSyncResult";
     222 + this.LastSyncResultColumn.Text = "Last Sync Result";
     223 + //
     224 + // LastSyncMessageColumn
     225 + //
     226 + this.LastSyncMessageColumn.AspectName = "LastSyncMessage";
     227 + this.LastSyncMessageColumn.Text = "Last Sync Message";
     228 + //
     229 + // ErrorsOnlyButton
     230 + //
     231 + this.ErrorsOnlyButton.Image = ((System.Drawing.Image)(resources.GetObject("ErrorsOnlyButton.Image")));
     232 + this.ErrorsOnlyButton.Location = new System.Drawing.Point(236, 12);
     233 + this.ErrorsOnlyButton.Name = "ErrorsOnlyButton";
     234 + this.ErrorsOnlyButton.Size = new System.Drawing.Size(50, 50);
     235 + this.ErrorsOnlyButton.TabIndex = 10;
     236 + this.ErrorsOnlyButton.UseVisualStyleBackColor = true;
     237 + this.ErrorsOnlyButton.Click += new System.EventHandler(this.ErrorsOnlyButton_Click);
     238 + //
     239 + // ADReplStatusForm
     240 + //
     241 + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     242 + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     243 + this.ClientSize = new System.Drawing.Size(784, 461);
     244 + this.Controls.Add(this.ErrorsOnlyButton);
     245 + this.Controls.Add(this.treeListView1);
     246 + this.Controls.Add(this.ProgressPercentLabel);
     247 + this.Controls.Add(this.AlternateCredsButton);
     248 + this.Controls.Add(this.ProgressPictureBox);
     249 + this.Controls.Add(this.SetForestButton);
     250 + this.Controls.Add(this.EnableLoggingButton);
     251 + this.Controls.Add(this.RefreshButton);
     252 + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     253 + this.MinimumSize = new System.Drawing.Size(800, 500);
     254 + this.Name = "ADReplStatusForm";
     255 + this.Text = "AD Replication Status Tool";
     256 + this.Load += new System.EventHandler(this.ADReplStatusForm_Load);
     257 + this.Resize += new System.EventHandler(this.ADReplStatusForm_Resize);
     258 + ((System.ComponentModel.ISupportInitialize)(this.ProgressPictureBox)).EndInit();
     259 + ((System.ComponentModel.ISupportInitialize)(this.treeListView1)).EndInit();
     260 + this.ResumeLayout(false);
     261 + 
     262 + }
     263 + 
     264 + #endregion
     265 + 
     266 + private System.Windows.Forms.Button RefreshButton;
     267 + private System.ComponentModel.BackgroundWorker backgroundWorker1;
     268 + private System.Windows.Forms.ToolTip toolTip1;
     269 + private System.Windows.Forms.Button EnableLoggingButton;
     270 + private System.Windows.Forms.Button SetForestButton;
     271 + private System.Windows.Forms.PictureBox ProgressPictureBox;
     272 + private System.Windows.Forms.Button AlternateCredsButton;
     273 + private System.Windows.Forms.Label ProgressPercentLabel;
     274 + private BrightIdeasSoftware.TreeListView treeListView1;
     275 + private BrightIdeasSoftware.OLVColumn DCNameColumn;
     276 + private BrightIdeasSoftware.OLVColumn SiteColumn;
     277 + private BrightIdeasSoftware.OLVColumn DiscoveryIssuesColumn;
     278 + private BrightIdeasSoftware.OLVColumn IsGCColumn;
     279 + private BrightIdeasSoftware.OLVColumn IsRODCColumn;
     280 + private BrightIdeasSoftware.OLVColumn DomainNameColumn;
     281 + private BrightIdeasSoftware.OLVColumn SourceServerColumn;
     282 + private BrightIdeasSoftware.OLVColumn PartitionNameColumn;
     283 + private BrightIdeasSoftware.OLVColumn ConsecutiveFailureCountColumn;
     284 + private BrightIdeasSoftware.OLVColumn LastSuccessfulSyncColumn;
     285 + private BrightIdeasSoftware.OLVColumn LastSyncResultColumn;
     286 + private BrightIdeasSoftware.OLVColumn LastSyncMessageColumn;
     287 + private System.Windows.Forms.Button ErrorsOnlyButton;
     288 + }
     289 +}
     290 + 
     291 + 
  • ■ ■ ■ ■ ■ ■
    ADReplStatusForm.cs
     1 +using System;
     2 +using System.Collections.Generic;
     3 +using System.ComponentModel;
     4 +using System.Data;
     5 +using System.Drawing;
     6 +using System.Linq;
     7 +using System.Text;
     8 +using System.Threading.Tasks;
     9 +using System.Windows.Forms;
     10 +using System.DirectoryServices;
     11 +using System.DirectoryServices.ActiveDirectory;
     12 +using Microsoft.Win32;
     13 +using BrightIdeasSoftware;
     14 + 
     15 +namespace ADReplStatus
     16 +{
     17 + public partial class ADReplStatusForm : Form
     18 + {
     19 + public static bool gLoggingEnabled = false;
     20 + 
     21 + public static bool gErrorsOnly = false;
     22 + 
     23 + public static string gLogfileName = string.Empty;
     24 + 
     25 + public static string gForestName = string.Empty;
     26 + 
     27 + public static string gUsername = string.Empty;
     28 + 
     29 + public static string gPassword = string.Empty;
     30 + 
     31 + public static List<ADREPLDC> gDCs = new List<ADREPLDC>();
     32 +
     33 + public ADReplStatusForm()
     34 + {
     35 + InitializeComponent();
     36 + }
     37 + 
     38 + private void RefreshButton_Click(object sender, EventArgs e)
     39 + {
     40 + ProgressPercentLabel.Visible = true;
     41 + 
     42 + ProgressPercentLabel.Text = "0%";
     43 + 
     44 + ActiveForm.Text = $"AD Replication Status Tool - {gForestName}";
     45 + 
     46 + gDCs.Clear();
     47 + 
     48 + RefreshButton.Enabled = false;
     49 + 
     50 + SetForestButton.Enabled = false;
     51 + 
     52 + EnableLoggingButton.Enabled = false;
     53 + 
     54 + AlternateCredsButton.Enabled = false;
     55 + 
     56 + ErrorsOnlyButton.Enabled = false;
     57 + 
     58 + ProgressPictureBox.Visible = true;
     59 + 
     60 + backgroundWorker1.RunWorkerAsync();
     61 + }
     62 + 
     63 + private void ADReplStatusForm_Load(object sender, EventArgs e)
     64 + {
     65 + toolTip1.SetToolTip(RefreshButton, "Refresh Replication Status");
     66 + 
     67 + toolTip1.SetToolTip(EnableLoggingButton, "Enable Logging");
     68 + 
     69 + toolTip1.SetToolTip(SetForestButton, "Manually Set Forest");
     70 + 
     71 + toolTip1.SetToolTip(AlternateCredsButton, "Provide Alternate Credentials");
     72 + 
     73 + toolTip1.SetToolTip(ErrorsOnlyButton, "Show Errors Only");
     74 + 
     75 + try
     76 + {
     77 + var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\ADREPLSTATUS", false);
     78 + 
     79 + if (key != null)
     80 + {
     81 + gForestName = key.GetValue("ForestName", string.Empty).ToString();
     82 + 
     83 + key.Dispose();
     84 + }
     85 + }
     86 + catch
     87 + {
     88 + 
     89 + }
     90 + 
     91 + if (string.IsNullOrEmpty(gForestName))
     92 + {
     93 + try
     94 + {
     95 + using (Forest forest = Forest.GetCurrentForest())
     96 + {
     97 + gForestName = forest.Name;
     98 + }
     99 + }
     100 + catch
     101 + {
     102 + MessageBox.Show("Unable to detect AD forest. You will need to manually enter the AD forest you wish to scan using the 'Manually Set Forest' button.\nThis happens on non-domain joined computers as well as hybrid or Azure AD domain-joined machines.", "Forest Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     103 + }
     104 + }
     105 + }
     106 + 
     107 + private void ADReplStatusForm_Resize(object sender, EventArgs e)
     108 + {
     109 + treeListView1.Top = 68;
     110 + 
     111 + treeListView1.Left = 12;
     112 + 
     113 + if (ActiveForm != null)
     114 + {
     115 + treeListView1.Width = ActiveForm.Width - 40;
     116 + 
     117 + treeListView1.Height = ActiveForm.Height - 119;
     118 + }
     119 + }
     120 + 
     121 + private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
     122 + {
     123 + Forest forest = null;
     124 + 
     125 + try
     126 + {
     127 + DirectoryContext ForestContext = null;
     128 + 
     129 + if (gUsername.Length > 0)
     130 + {
     131 + backgroundWorker1.ReportProgress(0, $"Attempting to connect to forest {gForestName} with alternate user {gUsername}.");
     132 + 
     133 + ForestContext = new DirectoryContext(DirectoryContextType.Forest, gForestName, gUsername, gPassword);
     134 + }
     135 + else
     136 + {
     137 + backgroundWorker1.ReportProgress(0, $"Attempting to connect to forest {gForestName} as currently logged-on user.");
     138 + 
     139 + ForestContext = new DirectoryContext(DirectoryContextType.Forest, gForestName);
     140 + }
     141 + 
     142 + forest = Forest.GetForest(ForestContext);
     143 + }
     144 + catch (Exception ex)
     145 + {
     146 + backgroundWorker1.ReportProgress(0, $"ERROR:Unable to find AD forest:{gForestName}\n{ex.Message}\n\nYou probably need to manually enter the forest using the button.");
     147 + 
     148 + return;
     149 + }
     150 + 
     151 + DomainCollection domainCollection = forest.Domains;
     152 + 
     153 + backgroundWorker1.ReportProgress(0, $"Found {domainCollection.Count} domains in forest {forest.Name}.");
     154 + 
     155 + int CurrentDC = 0;
     156 + 
     157 + int NumDCs = 0;
     158 + 
     159 + foreach (Domain domain in domainCollection)
     160 + {
     161 + NumDCs += domain.DomainControllers.Count;
     162 + }
     163 + 
     164 + foreach (Domain domain in domainCollection)
     165 + {
     166 + DomainControllerCollection DCs = domain.DomainControllers;
     167 + 
     168 + foreach (DomainController dc in DCs)
     169 + {
     170 + ADREPLDC adrepldc = new ADREPLDC();
     171 + 
     172 + adrepldc.Name = dc.Name;
     173 + 
     174 + adrepldc.DomainName = domain.Name;
     175 + 
     176 + try
     177 + {
     178 + adrepldc.Site = dc.SiteName;
     179 + }
     180 + catch (Exception ex)
     181 + {
     182 + backgroundWorker1.ReportProgress((int)(((float)CurrentDC / (float)NumDCs) * 100), $"Failed to contact DC {adrepldc.Name} and fetch site name:{ex.Message}");
     183 + 
     184 + adrepldc.Site = "Unknown";
     185 + 
     186 + adrepldc.DiscoveryIssues = true;
     187 + }
     188 + 
     189 + try
     190 + {
     191 + adrepldc.IsGC = dc.IsGlobalCatalog().ToString();
     192 + }
     193 + catch (Exception ex)
     194 + {
     195 + backgroundWorker1.ReportProgress((int)(((float)CurrentDC / (float)NumDCs) * 100), $"Failed to contact DC {adrepldc.Name} and determine global catalog status:{ex.Message}");
     196 + 
     197 + adrepldc.IsGC = "Unknown";
     198 + 
     199 + adrepldc.DiscoveryIssues = true;
     200 + }
     201 + 
     202 + try
     203 + {
     204 + using (DirectoryEntry directoryEntry = new DirectoryEntry("LDAP://" + dc.Name))
     205 + {
     206 + using (DirectorySearcher search = new DirectorySearcher(directoryEntry))
     207 + {
     208 + search.Filter = $"(samaccountname={dc.Name.Split('.')[0]}$)";
     209 + 
     210 + search.PropertiesToLoad.Add("msDS-isRODC");
     211 + 
     212 + SearchResult result = search.FindOne();
     213 + 
     214 + if (result == null || result.Properties["msDS-isRODC"].Count == 0)
     215 + {
     216 + throw new Exception("msDS-isRODC attribute not found!");
     217 + }
     218 + 
     219 + if ((bool)result.Properties["msDS-isRODC"][0] == true)
     220 + {
     221 + adrepldc.IsRODC = "True";
     222 + }
     223 + else
     224 + {
     225 + adrepldc.IsRODC = "False";
     226 + }
     227 + }
     228 + }
     229 + }
     230 + catch (Exception ex)
     231 + {
     232 + backgroundWorker1.ReportProgress((int)(((float)CurrentDC / (float)NumDCs) * 100), $"Failed to determine RODC status for {dc.Name}:{ex.Message}");
     233 + 
     234 + adrepldc.IsRODC = "Unknown";
     235 + 
     236 + adrepldc.DiscoveryIssues = true;
     237 + }
     238 + 
     239 + if (adrepldc.DiscoveryIssues == false)
     240 + {
     241 + try
     242 + {
     243 + foreach (ReplicationNeighbor partner in dc.GetAllReplicationNeighbors())
     244 + {
     245 + adrepldc.ReplicationPartners.Add(partner);
     246 + }
     247 + }
     248 + catch (Exception ex)
     249 + {
     250 + backgroundWorker1.ReportProgress((int)(((float)CurrentDC / (float)NumDCs) * 100), $"Failed to determine replication neighbors and repl status for {dc.Name}:{ex.Message}");
     251 + 
     252 + adrepldc.DiscoveryIssues = true;
     253 + }
     254 + }
     255 +
     256 + gDCs.Add(adrepldc);
     257 + 
     258 + CurrentDC++;
     259 + 
     260 + backgroundWorker1.ReportProgress((int)(((float)CurrentDC / (float)NumDCs) * 100), "UPDATEPERCENT");
     261 + }
     262 + }
     263 + 
     264 +
     265 + 
     266 + treeListView1.SetObjects(gDCs);
     267 + 
     268 + treeListView1.CanExpandGetter = delegate (object x)
     269 + {
     270 + return (x is ADREPLDC);
     271 + };
     272 + 
     273 + treeListView1.ChildrenGetter = delegate (object x)
     274 + {
     275 + return ((ADREPLDC)x).ReplicationPartners;
     276 + };
     277 + }
     278 + 
     279 + private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
     280 + {
     281 + ProgressPercentLabel.Visible = false;
     282 + 
     283 + RefreshButton.Enabled = true;
     284 + 
     285 + SetForestButton.Enabled = true;
     286 + 
     287 + EnableLoggingButton.Enabled = true;
     288 + 
     289 + AlternateCredsButton.Enabled = true;
     290 + 
     291 + ErrorsOnlyButton.Enabled = true;
     292 + 
     293 + ProgressPictureBox.Visible = false;
     294 + }
     295 + 
     296 + private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
     297 + {
     298 + if (gLoggingEnabled)
     299 + {
     300 + System.IO.File.AppendAllText(gLogfileName, $"[{DateTime.Now}] {e.UserState}\n");
     301 + }
     302 + 
     303 + if (e.UserState.ToString().StartsWith("ERROR:"))
     304 + {
     305 + MessageBox.Show(e.UserState.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     306 + }
     307 + else if (e.UserState.ToString().Equals("UPDATEPERCENT"))
     308 + {
     309 + ProgressPercentLabel.Text = $"{e.ProgressPercentage}%";
     310 + }
     311 + }
     312 + 
     313 + private void EnableLoggingButton_Click(object sender, EventArgs e)
     314 + {
     315 + gLoggingEnabled = !gLoggingEnabled;
     316 + 
     317 + if (gLoggingEnabled)
     318 + {
     319 + toolTip1.SetToolTip(EnableLoggingButton, "Disable Logging");
     320 + 
     321 + EnableLoggingButton.BackColor = SystemColors.ControlDark;
     322 + 
     323 + DateTime Now = DateTime.Now;
     324 + 
     325 + gLogfileName = $"adreplstatus_{Now.Month}.{Now.Day}.{Now.Year}.{Now.Hour}.{Now.Minute}.{Now.Second}.log";
     326 + 
     327 + System.IO.File.AppendAllText(gLogfileName, $"[{DateTime.Now}] Logging enabled.\n");
     328 + }
     329 + else
     330 + {
     331 + toolTip1.SetToolTip(EnableLoggingButton, "Enable Logging");
     332 + 
     333 + EnableLoggingButton.BackColor = SystemColors.Control;
     334 + 
     335 + System.IO.File.AppendAllText(gLogfileName, $"[{DateTime.Now}] Logging disabled.\n");
     336 + }
     337 + }
     338 + 
     339 + private void SetForestButton_Click(object sender, EventArgs e)
     340 + {
     341 + SetForestNameForm setForestNameForm = new SetForestNameForm();
     342 + 
     343 + if (gLoggingEnabled)
     344 + {
     345 + System.IO.File.AppendAllText(gLogfileName, $"[{DateTime.Now}] SetForestName button was clicked.\n");
     346 + }
     347 + 
     348 + setForestNameForm.ShowDialog();
     349 + 
     350 + setForestNameForm.Dispose();
     351 + }
     352 + 
     353 + private void AlternateCredsButton_Click(object sender, EventArgs e)
     354 + {
     355 + AlternateCredsForm alternateCredsForm = new AlternateCredsForm();
     356 + 
     357 + if (gLoggingEnabled)
     358 + {
     359 + System.IO.File.AppendAllText(gLogfileName, $"[{DateTime.Now}] AlternateCreds button was clicked.\n");
     360 + }
     361 + 
     362 + alternateCredsForm.ShowDialog();
     363 + 
     364 + alternateCredsForm.Dispose();
     365 + }
     366 + 
     367 + private void treeListView1_FormatRow(object sender, BrightIdeasSoftware.FormatRowEventArgs e)
     368 + {
     369 + if (e.Model is ADREPLDC)
     370 + {
     371 + ADREPLDC dc = (ADREPLDC)e.Model;
     372 + 
     373 + if (dc.DiscoveryIssues == true)
     374 + {
     375 + e.Item.BackColor = Color.Red;
     376 + 
     377 + e.Item.ForeColor = Color.White;
     378 + }
     379 + }
     380 + else if (e.Model is ReplicationNeighbor)
     381 + {
     382 + ReplicationNeighbor neighbor = (ReplicationNeighbor)e.Model;
     383 + 
     384 + if (neighbor.ConsecutiveFailureCount > 0)
     385 + {
     386 + e.Item.BackColor = Color.Red;
     387 + 
     388 + e.Item.ForeColor = Color.White;
     389 + }
     390 + }
     391 + }
     392 + 
     393 + private void ErrorsOnlyButton_Click(object sender, EventArgs e)
     394 + {
     395 + gErrorsOnly = !gErrorsOnly;
     396 + 
     397 + if (gErrorsOnly == true)
     398 + {
     399 + toolTip1.SetToolTip(ErrorsOnlyButton, "Show Everything");
     400 + 
     401 + ErrorsOnlyButton.BackColor = SystemColors.ControlDark;
     402 + 
     403 + treeListView1.ModelFilter = new ModelFilter(delegate (object x)
     404 + {
     405 + if (x is ADREPLDC)
     406 + {
     407 + return ((ADREPLDC)x).DiscoveryIssues;
     408 + }
     409 + else if (x is ReplicationNeighbor)
     410 + {
     411 + return (((ReplicationNeighbor)x).ConsecutiveFailureCount > 0);
     412 + }
     413 + 
     414 + return false;
     415 + });
     416 + }
     417 + else
     418 + {
     419 + toolTip1.SetToolTip(ErrorsOnlyButton, "Show Errors Only");
     420 + 
     421 + ErrorsOnlyButton.BackColor = SystemColors.Control;
     422 + 
     423 + treeListView1.ModelFilter = null;
     424 + }
     425 + }
     426 + }
     427 + 
     428 + public class ADREPLDC
     429 + {
     430 + public string Name;
     431 + 
     432 + public string DomainName;
     433 + 
     434 + public bool DiscoveryIssues = false;
     435 + 
     436 + public string Site;
     437 + 
     438 + public string IsGC;
     439 + 
     440 + public string IsRODC;
     441 + 
     442 + public List<ReplicationNeighbor> ReplicationPartners = new List<ReplicationNeighbor>();
     443 + }
     444 + 
     445 +}
     446 + 
     447 + 
  • ADReplStatusForm.resx
    Diff is too large to be displayed.
  • ■ ■ ■ ■ ■ ■
    AlternateCredsForm.Designer.cs
     1 +namespace ADReplStatus
     2 +{
     3 + partial class AlternateCredsForm
     4 + {
     5 + /// <summary>
     6 + /// Required designer variable.
     7 + /// </summary>
     8 + private System.ComponentModel.IContainer components = null;
     9 + 
     10 + /// <summary>
     11 + /// Clean up any resources being used.
     12 + /// </summary>
     13 + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     14 + protected override void Dispose(bool disposing)
     15 + {
     16 + if (disposing && (components != null))
     17 + {
     18 + components.Dispose();
     19 + }
     20 + base.Dispose(disposing);
     21 + }
     22 + 
     23 + #region Windows Form Designer generated code
     24 + 
     25 + /// <summary>
     26 + /// Required method for Designer support - do not modify
     27 + /// the contents of this method with the code editor.
     28 + /// </summary>
     29 + private void InitializeComponent()
     30 + {
     31 + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlternateCredsForm));
     32 + this.AlternateCredsButton = new System.Windows.Forms.Button();
     33 + this.AlternateCredsLabel = new System.Windows.Forms.Label();
     34 + this.UsernameTextBox = new System.Windows.Forms.TextBox();
     35 + this.PasswordTextBox = new System.Windows.Forms.TextBox();
     36 + this.PwdLabel = new System.Windows.Forms.Label();
     37 + this.UsernameLabel = new System.Windows.Forms.Label();
     38 + this.SuspendLayout();
     39 + //
     40 + // AlternateCredsButton
     41 + //
     42 + this.AlternateCredsButton.Location = new System.Drawing.Point(384, 57);
     43 + this.AlternateCredsButton.Name = "AlternateCredsButton";
     44 + this.AlternateCredsButton.Size = new System.Drawing.Size(75, 23);
     45 + this.AlternateCredsButton.TabIndex = 0;
     46 + this.AlternateCredsButton.Text = "OK";
     47 + this.AlternateCredsButton.UseVisualStyleBackColor = true;
     48 + this.AlternateCredsButton.Click += new System.EventHandler(this.AlternateCredsButton_Click);
     49 + //
     50 + // AlternateCredsLabel
     51 + //
     52 + this.AlternateCredsLabel.AutoSize = true;
     53 + this.AlternateCredsLabel.Location = new System.Drawing.Point(12, 9);
     54 + this.AlternateCredsLabel.Name = "AlternateCredsLabel";
     55 + this.AlternateCredsLabel.Size = new System.Drawing.Size(359, 39);
     56 + this.AlternateCredsLabel.TabIndex = 1;
     57 + this.AlternateCredsLabel.Text = resources.GetString("AlternateCredsLabel.Text");
     58 + //
     59 + // UsernameTextBox
     60 + //
     61 + this.UsernameTextBox.Location = new System.Drawing.Point(74, 57);
     62 + this.UsernameTextBox.Name = "UsernameTextBox";
     63 + this.UsernameTextBox.Size = new System.Drawing.Size(120, 20);
     64 + this.UsernameTextBox.TabIndex = 2;
     65 + //
     66 + // PasswordTextBox
     67 + //
     68 + this.PasswordTextBox.Location = new System.Drawing.Point(240, 57);
     69 + this.PasswordTextBox.Name = "PasswordTextBox";
     70 + this.PasswordTextBox.Size = new System.Drawing.Size(138, 20);
     71 + this.PasswordTextBox.TabIndex = 3;
     72 + this.PasswordTextBox.UseSystemPasswordChar = true;
     73 + //
     74 + // PwdLabel
     75 + //
     76 + this.PwdLabel.AutoSize = true;
     77 + this.PwdLabel.Location = new System.Drawing.Point(206, 60);
     78 + this.PwdLabel.Name = "PwdLabel";
     79 + this.PwdLabel.Size = new System.Drawing.Size(31, 13);
     80 + this.PwdLabel.TabIndex = 4;
     81 + this.PwdLabel.Text = "Pwd:";
     82 + //
     83 + // UsernameLabel
     84 + //
     85 + this.UsernameLabel.AutoSize = true;
     86 + this.UsernameLabel.Location = new System.Drawing.Point(13, 60);
     87 + this.UsernameLabel.Name = "UsernameLabel";
     88 + this.UsernameLabel.Size = new System.Drawing.Size(58, 13);
     89 + this.UsernameLabel.TabIndex = 5;
     90 + this.UsernameLabel.Text = "Username:";
     91 + //
     92 + // AlternateCredsForm
     93 + //
     94 + this.AcceptButton = this.AlternateCredsButton;
     95 + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     96 + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     97 + this.ClientSize = new System.Drawing.Size(462, 87);
     98 + this.Controls.Add(this.UsernameLabel);
     99 + this.Controls.Add(this.PwdLabel);
     100 + this.Controls.Add(this.PasswordTextBox);
     101 + this.Controls.Add(this.UsernameTextBox);
     102 + this.Controls.Add(this.AlternateCredsLabel);
     103 + this.Controls.Add(this.AlternateCredsButton);
     104 + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
     105 + this.MaximizeBox = false;
     106 + this.MinimizeBox = false;
     107 + this.Name = "AlternateCredsForm";
     108 + this.ShowInTaskbar = false;
     109 + this.Text = "Provide Alternate Credentials";
     110 + this.ResumeLayout(false);
     111 + this.PerformLayout();
     112 + 
     113 + }
     114 + 
     115 + #endregion
     116 + 
     117 + private System.Windows.Forms.Button AlternateCredsButton;
     118 + private System.Windows.Forms.Label AlternateCredsLabel;
     119 + private System.Windows.Forms.TextBox UsernameTextBox;
     120 + private System.Windows.Forms.TextBox PasswordTextBox;
     121 + private System.Windows.Forms.Label PwdLabel;
     122 + private System.Windows.Forms.Label UsernameLabel;
     123 + }
     124 +}
  • ■ ■ ■ ■ ■ ■
    AlternateCredsForm.cs
     1 +using System;
     2 +using System.Collections.Generic;
     3 +using System.ComponentModel;
     4 +using System.Data;
     5 +using System.Drawing;
     6 +using System.Linq;
     7 +using System.Text;
     8 +using System.Threading.Tasks;
     9 +using System.Windows.Forms;
     10 + 
     11 +namespace ADReplStatus
     12 +{
     13 + public partial class AlternateCredsForm : Form
     14 + {
     15 + public AlternateCredsForm()
     16 + {
     17 + InitializeComponent();
     18 + }
     19 + 
     20 + private void AlternateCredsButton_Click(object sender, EventArgs e)
     21 + {
     22 + if (UsernameTextBox.Text.Length > 0 && PasswordTextBox.Text.Length > 0)
     23 + {
     24 + ADReplStatusForm.gUsername = UsernameTextBox.Text;
     25 + 
     26 + ADReplStatusForm.gPassword = PasswordTextBox.Text;
     27 + 
     28 + this.Dispose();
     29 + 
     30 + if (ADReplStatusForm.gLoggingEnabled)
     31 + {
     32 + System.IO.File.AppendAllText(ADReplStatusForm.gLogfileName, $"[{DateTime.Now}] Using alternate identity: {ADReplStatusForm.gUsername}\n");
     33 + }
     34 + }
     35 + }
     36 + }
     37 +}
     38 + 
  • ■ ■ ■ ■ ■ ■
    AlternateCredsForm.resx
     1 +<?xml version="1.0" encoding="utf-8"?>
     2 +<root>
     3 + <!--
     4 + Microsoft ResX Schema
     5 +
     6 + Version 2.0
     7 +
     8 + The primary goals of this format is to allow a simple XML format
     9 + that is mostly human readable. The generation and parsing of the
     10 + various data types are done through the TypeConverter classes
     11 + associated with the data types.
     12 +
     13 + Example:
     14 +
     15 + ... ado.net/XML headers & schema ...
     16 + <resheader name="resmimetype">text/microsoft-resx</resheader>
     17 + <resheader name="version">2.0</resheader>
     18 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
     19 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
     20 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
     21 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
     22 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
     23 + <value>[base64 mime encoded serialized .NET Framework object]</value>
     24 + </data>
     25 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     26 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
     27 + <comment>This is a comment</comment>
     28 + </data>
     29 +
     30 + There are any number of "resheader" rows that contain simple
     31 + name/value pairs.
     32 +
     33 + Each data row contains a name, and value. The row also contains a
     34 + type or mimetype. Type corresponds to a .NET class that support
     35 + text/value conversion through the TypeConverter architecture.
     36 + Classes that don't support this are serialized and stored with the
     37 + mimetype set.
     38 +
     39 + The mimetype is used for serialized objects, and tells the
     40 + ResXResourceReader how to depersist the object. This is currently not
     41 + extensible. For a given mimetype the value must be set accordingly:
     42 +
     43 + Note - application/x-microsoft.net.object.binary.base64 is the format
     44 + that the ResXResourceWriter will generate, however the reader can
     45 + read any of the formats listed below.
     46 +
     47 + mimetype: application/x-microsoft.net.object.binary.base64
     48 + value : The object must be serialized with
     49 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
     50 + : and then encoded with base64 encoding.
     51 +
     52 + mimetype: application/x-microsoft.net.object.soap.base64
     53 + value : The object must be serialized with
     54 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
     55 + : and then encoded with base64 encoding.
     56 + 
     57 + mimetype: application/x-microsoft.net.object.bytearray.base64
     58 + value : The object must be serialized into a byte array
     59 + : using a System.ComponentModel.TypeConverter
     60 + : and then encoded with base64 encoding.
     61 + -->
     62 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     63 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
     64 + <xsd:element name="root" msdata:IsDataSet="true">
     65 + <xsd:complexType>
     66 + <xsd:choice maxOccurs="unbounded">
     67 + <xsd:element name="metadata">
     68 + <xsd:complexType>
     69 + <xsd:sequence>
     70 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
     71 + </xsd:sequence>
     72 + <xsd:attribute name="name" use="required" type="xsd:string" />
     73 + <xsd:attribute name="type" type="xsd:string" />
     74 + <xsd:attribute name="mimetype" type="xsd:string" />
     75 + <xsd:attribute ref="xml:space" />
     76 + </xsd:complexType>
     77 + </xsd:element>
     78 + <xsd:element name="assembly">
     79 + <xsd:complexType>
     80 + <xsd:attribute name="alias" type="xsd:string" />
     81 + <xsd:attribute name="name" type="xsd:string" />
     82 + </xsd:complexType>
     83 + </xsd:element>
     84 + <xsd:element name="data">
     85 + <xsd:complexType>
     86 + <xsd:sequence>
     87 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     88 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
     89 + </xsd:sequence>
     90 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
     91 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
     92 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
     93 + <xsd:attribute ref="xml:space" />
     94 + </xsd:complexType>
     95 + </xsd:element>
     96 + <xsd:element name="resheader">
     97 + <xsd:complexType>
     98 + <xsd:sequence>
     99 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     100 + </xsd:sequence>
     101 + <xsd:attribute name="name" type="xsd:string" use="required" />
     102 + </xsd:complexType>
     103 + </xsd:element>
     104 + </xsd:choice>
     105 + </xsd:complexType>
     106 + </xsd:element>
     107 + </xsd:schema>
     108 + <resheader name="resmimetype">
     109 + <value>text/microsoft-resx</value>
     110 + </resheader>
     111 + <resheader name="version">
     112 + <value>2.0</value>
     113 + </resheader>
     114 + <resheader name="reader">
     115 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     116 + </resheader>
     117 + <resheader name="writer">
     118 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     119 + </resheader>
     120 + <data name="AlternateCredsLabel.Text" xml:space="preserve">
     121 + <value>Provide alternate credentials to connect to the AD forest.
     122 +NOTE: This is only necessary if the currently logged-on user does not have
     123 +permissions to the replication data of the target Active Directory forest:</value>
     124 + </data>
     125 +</root>
  • ■ ■ ■ ■ ■ ■
    App.config
     1 +<?xml version="1.0" encoding="utf-8" ?>
     2 +<configuration>
     3 + <startup>
     4 + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
     5 + </startup>
     6 +</configuration>
  • Forest.ico
  • ■ ■ ■ ■ ■ ■
    Program.cs
     1 +using System;
     2 +using System.Collections.Generic;
     3 +using System.Linq;
     4 +using System.Threading.Tasks;
     5 +using System.Windows.Forms;
     6 + 
     7 +namespace ADReplStatus
     8 +{
     9 + internal static class Program
     10 + {
     11 + /// <summary>
     12 + /// The main entry point for the application.
     13 + /// </summary>
     14 + [STAThread]
     15 + static void Main()
     16 + {
     17 + Application.EnableVisualStyles();
     18 + Application.SetCompatibleTextRenderingDefault(false);
     19 + Application.Run(new ADReplStatusForm());
     20 + }
     21 + }
     22 +}
     23 + 
  • ■ ■ ■ ■ ■ ■
    Properties/AssemblyInfo.cs
     1 +using System.Reflection;
     2 +using System.Runtime.CompilerServices;
     3 +using System.Runtime.InteropServices;
     4 + 
     5 +// General Information about an assembly is controlled through the following
     6 +// set of attributes. Change these attribute values to modify the information
     7 +// associated with an assembly.
     8 +[assembly: AssemblyTitle("ADReplStatus")]
     9 +[assembly: AssemblyDescription("Active Directory Replication Status Tool")]
     10 +[assembly: AssemblyConfiguration("")]
     11 +[assembly: AssemblyCompany("")]
     12 +[assembly: AssemblyProduct("ADReplStatus")]
     13 +[assembly: AssemblyCopyright("Copyright © Joseph Ryan Ries 2023")]
     14 +[assembly: AssemblyTrademark("")]
     15 +[assembly: AssemblyCulture("")]
     16 + 
     17 +// Setting ComVisible to false makes the types in this assembly not visible
     18 +// to COM components. If you need to access a type in this assembly from
     19 +// COM, set the ComVisible attribute to true on that type.
     20 +[assembly: ComVisible(false)]
     21 + 
     22 +// The following GUID is for the ID of the typelib if this project is exposed to COM
     23 +[assembly: Guid("af7ee9dd-d7c5-409c-a1e9-78e1078f6a89")]
     24 + 
     25 +// Version information for an assembly consists of the following four values:
     26 +//
     27 +// Major Version
     28 +// Minor Version
     29 +// Build Number
     30 +// Revision
     31 +//
     32 +// You can specify all the values or you can default the Build and Revision Numbers
     33 +// by using the '*' as shown below:
     34 +// [assembly: AssemblyVersion("1.0.*")]
     35 +[assembly: AssemblyVersion("1.0.0.0")]
     36 +[assembly: AssemblyFileVersion("1.0.0.0")]
     37 + 
  • ■ ■ ■ ■ ■ ■
    Properties/Resources.Designer.cs
     1 +//------------------------------------------------------------------------------
     2 +// <auto-generated>
     3 +// This code was generated by a tool.
     4 +// Runtime Version:4.0.30319.42000
     5 +//
     6 +// Changes to this file may cause incorrect behavior and will be lost if
     7 +// the code is regenerated.
     8 +// </auto-generated>
     9 +//------------------------------------------------------------------------------
     10 + 
     11 +namespace ADReplStatus.Properties
     12 +{
     13 + 
     14 + 
     15 + /// <summary>
     16 + /// A strongly-typed resource class, for looking up localized strings, etc.
     17 + /// </summary>
     18 + // This class was auto-generated by the StronglyTypedResourceBuilder
     19 + // class via a tool like ResGen or Visual Studio.
     20 + // To add or remove a member, edit your .ResX file then rerun ResGen
     21 + // with the /str option, or rebuild your VS project.
     22 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
     23 + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     24 + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     25 + internal class Resources
     26 + {
     27 + 
     28 + private static global::System.Resources.ResourceManager resourceMan;
     29 + 
     30 + private static global::System.Globalization.CultureInfo resourceCulture;
     31 + 
     32 + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
     33 + internal Resources()
     34 + {
     35 + }
     36 + 
     37 + /// <summary>
     38 + /// Returns the cached ResourceManager instance used by this class.
     39 + /// </summary>
     40 + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     41 + internal static global::System.Resources.ResourceManager ResourceManager
     42 + {
     43 + get
     44 + {
     45 + if ((resourceMan == null))
     46 + {
     47 + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ADReplStatus.Properties.Resources", typeof(Resources).Assembly);
     48 + resourceMan = temp;
     49 + }
     50 + return resourceMan;
     51 + }
     52 + }
     53 + 
     54 + /// <summary>
     55 + /// Overrides the current thread's CurrentUICulture property for all
     56 + /// resource lookups using this strongly typed resource class.
     57 + /// </summary>
     58 + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
     59 + internal static global::System.Globalization.CultureInfo Culture
     60 + {
     61 + get
     62 + {
     63 + return resourceCulture;
     64 + }
     65 + set
     66 + {
     67 + resourceCulture = value;
     68 + }
     69 + }
     70 + }
     71 +}
     72 + 
  • ■ ■ ■ ■ ■ ■
    Properties/Resources.resx
     1 +<?xml version="1.0" encoding="utf-8"?>
     2 +<root>
     3 + <!--
     4 + Microsoft ResX Schema
     5 +
     6 + Version 2.0
     7 +
     8 + The primary goals of this format is to allow a simple XML format
     9 + that is mostly human readable. The generation and parsing of the
     10 + various data types are done through the TypeConverter classes
     11 + associated with the data types.
     12 +
     13 + Example:
     14 +
     15 + ... ado.net/XML headers & schema ...
     16 + <resheader name="resmimetype">text/microsoft-resx</resheader>
     17 + <resheader name="version">2.0</resheader>
     18 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
     19 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
     20 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
     21 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
     22 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
     23 + <value>[base64 mime encoded serialized .NET Framework object]</value>
     24 + </data>
     25 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     26 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
     27 + <comment>This is a comment</comment>
     28 + </data>
     29 +
     30 + There are any number of "resheader" rows that contain simple
     31 + name/value pairs.
     32 +
     33 + Each data row contains a name, and value. The row also contains a
     34 + type or mimetype. Type corresponds to a .NET class that support
     35 + text/value conversion through the TypeConverter architecture.
     36 + Classes that don't support this are serialized and stored with the
     37 + mimetype set.
     38 +
     39 + The mimetype is used for serialized objects, and tells the
     40 + ResXResourceReader how to depersist the object. This is currently not
     41 + extensible. For a given mimetype the value must be set accordingly:
     42 +
     43 + Note - application/x-microsoft.net.object.binary.base64 is the format
     44 + that the ResXResourceWriter will generate, however the reader can
     45 + read any of the formats listed below.
     46 +
     47 + mimetype: application/x-microsoft.net.object.binary.base64
     48 + value : The object must be serialized with
     49 + : System.Serialization.Formatters.Binary.BinaryFormatter
     50 + : and then encoded with base64 encoding.
     51 +
     52 + mimetype: application/x-microsoft.net.object.soap.base64
     53 + value : The object must be serialized with
     54 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
     55 + : and then encoded with base64 encoding.
     56 + 
     57 + mimetype: application/x-microsoft.net.object.bytearray.base64
     58 + value : The object must be serialized into a byte array
     59 + : using a System.ComponentModel.TypeConverter
     60 + : and then encoded with base64 encoding.
     61 + -->
     62 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     63 + <xsd:element name="root" msdata:IsDataSet="true">
     64 + <xsd:complexType>
     65 + <xsd:choice maxOccurs="unbounded">
     66 + <xsd:element name="metadata">
     67 + <xsd:complexType>
     68 + <xsd:sequence>
     69 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
     70 + </xsd:sequence>
     71 + <xsd:attribute name="name" type="xsd:string" />
     72 + <xsd:attribute name="type" type="xsd:string" />
     73 + <xsd:attribute name="mimetype" type="xsd:string" />
     74 + </xsd:complexType>
     75 + </xsd:element>
     76 + <xsd:element name="assembly">
     77 + <xsd:complexType>
     78 + <xsd:attribute name="alias" type="xsd:string" />
     79 + <xsd:attribute name="name" type="xsd:string" />
     80 + </xsd:complexType>
     81 + </xsd:element>
     82 + <xsd:element name="data">
     83 + <xsd:complexType>
     84 + <xsd:sequence>
     85 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     86 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
     87 + </xsd:sequence>
     88 + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
     89 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
     90 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
     91 + </xsd:complexType>
     92 + </xsd:element>
     93 + <xsd:element name="resheader">
     94 + <xsd:complexType>
     95 + <xsd:sequence>
     96 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     97 + </xsd:sequence>
     98 + <xsd:attribute name="name" type="xsd:string" use="required" />
     99 + </xsd:complexType>
     100 + </xsd:element>
     101 + </xsd:choice>
     102 + </xsd:complexType>
     103 + </xsd:element>
     104 + </xsd:schema>
     105 + <resheader name="resmimetype">
     106 + <value>text/microsoft-resx</value>
     107 + </resheader>
     108 + <resheader name="version">
     109 + <value>2.0</value>
     110 + </resheader>
     111 + <resheader name="reader">
     112 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     113 + </resheader>
     114 + <resheader name="writer">
     115 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     116 + </resheader>
     117 +</root>
  • ■ ■ ■ ■ ■ ■
    Properties/Settings.Designer.cs
     1 +//------------------------------------------------------------------------------
     2 +// <auto-generated>
     3 +// This code was generated by a tool.
     4 +// Runtime Version:4.0.30319.42000
     5 +//
     6 +// Changes to this file may cause incorrect behavior and will be lost if
     7 +// the code is regenerated.
     8 +// </auto-generated>
     9 +//------------------------------------------------------------------------------
     10 + 
     11 +namespace ADReplStatus.Properties
     12 +{
     13 + 
     14 + 
     15 + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     16 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
     17 + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
     18 + {
     19 + 
     20 + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
     21 + 
     22 + public static Settings Default
     23 + {
     24 + get
     25 + {
     26 + return defaultInstance;
     27 + }
     28 + }
     29 + }
     30 +}
     31 + 
  • ■ ■ ■ ■ ■ ■
    Properties/Settings.settings
     1 +<?xml version='1.0' encoding='utf-8'?>
     2 +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
     3 + <Profiles>
     4 + <Profile Name="(Default)" />
     5 + </Profiles>
     6 + <Settings />
     7 +</SettingsFile>
     8 + 
  • ■ ■ ■ ■ ■ ■
    SetForestNameForm.Designer.cs
     1 +namespace ADReplStatus
     2 +{
     3 + partial class SetForestNameForm
     4 + {
     5 + /// <summary>
     6 + /// Required designer variable.
     7 + /// </summary>
     8 + private System.ComponentModel.IContainer components = null;
     9 + 
     10 + /// <summary>
     11 + /// Clean up any resources being used.
     12 + /// </summary>
     13 + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     14 + protected override void Dispose(bool disposing)
     15 + {
     16 + if (disposing && (components != null))
     17 + {
     18 + components.Dispose();
     19 + }
     20 + base.Dispose(disposing);
     21 + }
     22 + 
     23 + #region Windows Form Designer generated code
     24 + 
     25 + /// <summary>
     26 + /// Required method for Designer support - do not modify
     27 + /// the contents of this method with the code editor.
     28 + /// </summary>
     29 + private void InitializeComponent()
     30 + {
     31 + this.EnterForestNameLabel = new System.Windows.Forms.Label();
     32 + this.SetForestNameTextBox = new System.Windows.Forms.TextBox();
     33 + this.SetForestNameButton = new System.Windows.Forms.Button();
     34 + this.SaveForestCheckBox = new System.Windows.Forms.CheckBox();
     35 + this.SuspendLayout();
     36 + //
     37 + // EnterForestNameLabel
     38 + //
     39 + this.EnterForestNameLabel.AutoSize = true;
     40 + this.EnterForestNameLabel.Location = new System.Drawing.Point(12, 9);
     41 + this.EnterForestNameLabel.Name = "EnterForestNameLabel";
     42 + this.EnterForestNameLabel.Size = new System.Drawing.Size(303, 13);
     43 + this.EnterForestNameLabel.TabIndex = 0;
     44 + this.EnterForestNameLabel.Text = "Enter the name of the Active Directory forest you want to scan:";
     45 + //
     46 + // SetForestNameTextBox
     47 + //
     48 + this.SetForestNameTextBox.Location = new System.Drawing.Point(13, 29);
     49 + this.SetForestNameTextBox.Name = "SetForestNameTextBox";
     50 + this.SetForestNameTextBox.Size = new System.Drawing.Size(240, 20);
     51 + this.SetForestNameTextBox.TabIndex = 1;
     52 + //
     53 + // SetForestNameButton
     54 + //
     55 + this.SetForestNameButton.Location = new System.Drawing.Point(322, 29);
     56 + this.SetForestNameButton.Name = "SetForestNameButton";
     57 + this.SetForestNameButton.Size = new System.Drawing.Size(75, 23);
     58 + this.SetForestNameButton.TabIndex = 2;
     59 + this.SetForestNameButton.Text = "OK";
     60 + this.SetForestNameButton.UseVisualStyleBackColor = true;
     61 + this.SetForestNameButton.Click += new System.EventHandler(this.SetForestNameButton_Click);
     62 + //
     63 + // SaveForestCheckBox
     64 + //
     65 + this.SaveForestCheckBox.AutoSize = true;
     66 + this.SaveForestCheckBox.Location = new System.Drawing.Point(15, 56);
     67 + this.SaveForestCheckBox.Name = "SaveForestCheckBox";
     68 + this.SaveForestCheckBox.Size = new System.Drawing.Size(51, 17);
     69 + this.SaveForestCheckBox.TabIndex = 3;
     70 + this.SaveForestCheckBox.Text = "Save";
     71 + this.SaveForestCheckBox.UseVisualStyleBackColor = true;
     72 + //
     73 + // SetForestNameForm
     74 + //
     75 + this.AcceptButton = this.SetForestNameButton;
     76 + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     77 + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     78 + this.ClientSize = new System.Drawing.Size(406, 83);
     79 + this.Controls.Add(this.SaveForestCheckBox);
     80 + this.Controls.Add(this.SetForestNameButton);
     81 + this.Controls.Add(this.SetForestNameTextBox);
     82 + this.Controls.Add(this.EnterForestNameLabel);
     83 + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
     84 + this.MaximizeBox = false;
     85 + this.MinimizeBox = false;
     86 + this.Name = "SetForestNameForm";
     87 + this.ShowInTaskbar = false;
     88 + this.Text = "Enter AD Forest Name";
     89 + this.Load += new System.EventHandler(this.SetForestNameForm_Load);
     90 + this.ResumeLayout(false);
     91 + this.PerformLayout();
     92 + 
     93 + }
     94 + 
     95 + #endregion
     96 + 
     97 + private System.Windows.Forms.Label EnterForestNameLabel;
     98 + private System.Windows.Forms.TextBox SetForestNameTextBox;
     99 + private System.Windows.Forms.Button SetForestNameButton;
     100 + private System.Windows.Forms.CheckBox SaveForestCheckBox;
     101 + }
     102 +}
  • ■ ■ ■ ■ ■ ■
    SetForestNameForm.cs
     1 +using Microsoft.Win32;
     2 +using System;
     3 +using System.Collections.Generic;
     4 +using System.ComponentModel;
     5 +using System.Data;
     6 +using System.Drawing;
     7 +using System.Linq;
     8 +using System.Text;
     9 +using System.Threading.Tasks;
     10 +using System.Windows.Forms;
     11 + 
     12 +namespace ADReplStatus
     13 +{
     14 + public partial class SetForestNameForm : Form
     15 + {
     16 + public SetForestNameForm()
     17 + {
     18 + InitializeComponent();
     19 + }
     20 + 
     21 + private void SetForestNameForm_Load(object sender, EventArgs e)
     22 + {
     23 +
     24 + }
     25 + 
     26 + private void SetForestNameButton_Click(object sender, EventArgs e)
     27 + {
     28 + if (SetForestNameTextBox.Text.Length > 0)
     29 + {
     30 + ADReplStatusForm.gForestName = SetForestNameTextBox.Text;
     31 + 
     32 + if (SaveForestCheckBox.Checked)
     33 + {
     34 + try
     35 + {
     36 + var key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\ADREPLSTATUS", true);
     37 + 
     38 + if (key != null)
     39 + {
     40 + key.SetValue("ForestName", SetForestNameTextBox.Text);
     41 + 
     42 + key.Dispose();
     43 + }
     44 + }
     45 + catch (Exception ex)
     46 + {
     47 + string errorMessage = $"ERROR: Failed to write to the HKCU\\ADREPLSTATUS registry key!\n{ex.Message}\n";
     48 + 
     49 + MessageBox.Show(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     50 + 
     51 + if (ADReplStatusForm.gLoggingEnabled)
     52 + {
     53 + System.IO.File.AppendAllText(ADReplStatusForm.gLogfileName, $"[{DateTime.Now}] {errorMessage}\n");
     54 + }
     55 + }
     56 + }
     57 + 
     58 + if (ADReplStatusForm.gLoggingEnabled)
     59 + {
     60 + System.IO.File.AppendAllText(ADReplStatusForm.gLogfileName, $"[{DateTime.Now}] Forest name set to: {ADReplStatusForm.gForestName}\n");
     61 + }
     62 + 
     63 + this.Dispose();
     64 + }
     65 + }
     66 + }
     67 +}
     68 + 
  • ■ ■ ■ ■ ■ ■
    SetForestNameForm.resx
     1 +<?xml version="1.0" encoding="utf-8"?>
     2 +<root>
     3 + <!--
     4 + Microsoft ResX Schema
     5 +
     6 + Version 2.0
     7 +
     8 + The primary goals of this format is to allow a simple XML format
     9 + that is mostly human readable. The generation and parsing of the
     10 + various data types are done through the TypeConverter classes
     11 + associated with the data types.
     12 +
     13 + Example:
     14 +
     15 + ... ado.net/XML headers & schema ...
     16 + <resheader name="resmimetype">text/microsoft-resx</resheader>
     17 + <resheader name="version">2.0</resheader>
     18 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
     19 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
     20 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
     21 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
     22 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
     23 + <value>[base64 mime encoded serialized .NET Framework object]</value>
     24 + </data>
     25 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     26 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
     27 + <comment>This is a comment</comment>
     28 + </data>
     29 +
     30 + There are any number of "resheader" rows that contain simple
     31 + name/value pairs.
     32 +
     33 + Each data row contains a name, and value. The row also contains a
     34 + type or mimetype. Type corresponds to a .NET class that support
     35 + text/value conversion through the TypeConverter architecture.
     36 + Classes that don't support this are serialized and stored with the
     37 + mimetype set.
     38 +
     39 + The mimetype is used for serialized objects, and tells the
     40 + ResXResourceReader how to depersist the object. This is currently not
     41 + extensible. For a given mimetype the value must be set accordingly:
     42 +
     43 + Note - application/x-microsoft.net.object.binary.base64 is the format
     44 + that the ResXResourceWriter will generate, however the reader can
     45 + read any of the formats listed below.
     46 +
     47 + mimetype: application/x-microsoft.net.object.binary.base64
     48 + value : The object must be serialized with
     49 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
     50 + : and then encoded with base64 encoding.
     51 +
     52 + mimetype: application/x-microsoft.net.object.soap.base64
     53 + value : The object must be serialized with
     54 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
     55 + : and then encoded with base64 encoding.
     56 + 
     57 + mimetype: application/x-microsoft.net.object.bytearray.base64
     58 + value : The object must be serialized into a byte array
     59 + : using a System.ComponentModel.TypeConverter
     60 + : and then encoded with base64 encoding.
     61 + -->
     62 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     63 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
     64 + <xsd:element name="root" msdata:IsDataSet="true">
     65 + <xsd:complexType>
     66 + <xsd:choice maxOccurs="unbounded">
     67 + <xsd:element name="metadata">
     68 + <xsd:complexType>
     69 + <xsd:sequence>
     70 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
     71 + </xsd:sequence>
     72 + <xsd:attribute name="name" use="required" type="xsd:string" />
     73 + <xsd:attribute name="type" type="xsd:string" />
     74 + <xsd:attribute name="mimetype" type="xsd:string" />
     75 + <xsd:attribute ref="xml:space" />
     76 + </xsd:complexType>
     77 + </xsd:element>
     78 + <xsd:element name="assembly">
     79 + <xsd:complexType>
     80 + <xsd:attribute name="alias" type="xsd:string" />
     81 + <xsd:attribute name="name" type="xsd:string" />
     82 + </xsd:complexType>
     83 + </xsd:element>
     84 + <xsd:element name="data">
     85 + <xsd:complexType>
     86 + <xsd:sequence>
     87 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     88 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
     89 + </xsd:sequence>
     90 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
     91 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
     92 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
     93 + <xsd:attribute ref="xml:space" />
     94 + </xsd:complexType>
     95 + </xsd:element>
     96 + <xsd:element name="resheader">
     97 + <xsd:complexType>
     98 + <xsd:sequence>
     99 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
     100 + </xsd:sequence>
     101 + <xsd:attribute name="name" type="xsd:string" use="required" />
     102 + </xsd:complexType>
     103 + </xsd:element>
     104 + </xsd:choice>
     105 + </xsd:complexType>
     106 + </xsd:element>
     107 + </xsd:schema>
     108 + <resheader name="resmimetype">
     109 + <value>text/microsoft-resx</value>
     110 + </resheader>
     111 + <resheader name="version">
     112 + <value>2.0</value>
     113 + </resheader>
     114 + <resheader name="reader">
     115 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     116 + </resheader>
     117 + <resheader name="writer">
     118 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     119 + </resheader>
     120 +</root>
  • images/Error.png
  • images/Forest.ico
  • images/Forest.png
  • images/Go.png
  • images/KeyLock.png
  • images/Logging.png
  • images/Progress.gif
  • ■ ■ ■ ■ ■ ■
    packages.config
     1 +<?xml version="1.0" encoding="utf-8"?>
     2 +<packages>
     3 + <package id="ObjectListView.Official" version="2.9.1" targetFramework="net48" />
     4 +</packages>
Please wait...
Page is in error, reload to recover