Skip to content

Feature: Import AD computers#3368

Open
Tyrix wants to merge 6 commits intoBornToBeRoot:mainfrom
Tyrix:feature/ImportAdComputers
Open

Feature: Import AD computers#3368
Tyrix wants to merge 6 commits intoBornToBeRoot:mainfrom
Tyrix:feature/ImportAdComputers

Conversation

@Tyrix
Copy link
Copy Markdown

@Tyrix Tyrix commented Mar 27, 2026

Changes proposed in this pull request

  • Added a new UI flow in the Remote Desktop host view to import computer accounts directly from an on-premises Active Directory via LDAP
  • Introduced ActiveDirectoryComputerSearcher in NETworkManager.Utilities to handle secure AD queries using current Windows credentials
  • Added automatic filtering to skip disabled AD accounts, accounts missing a DNS Host Name, and existing duplicate profiles in the target group
  • Implemented persistent settings to remember the last successful LDAP search base (RemoteDesktop_ActiveDirectoryImportLdapSearchBase) for better UX

Related issue(s)

Copilot generated summary

Provide a Copilot generated summary of the changes in this pull request.

Copilot summary

Summary
Adds Remote Desktop functionality to import computer accounts from an on-premises Active Directory using an LDAP subtree search from a user-supplied search base (OU DN). Imported machines are added to a single target profile group. Each profile is created with Remote Desktop enabled, utilizing the dNSHostName property.

User-visible behavior

  • Adds a toolbar control (domain icon) next to "add profile" on the Remote Desktop host view.
  • Provides inputs for: search base, target group (existing or new), and an option to exclude disabled accounts.
  • Uses current Windows credentials for the LDAP bind.
  • Stores and prefills the last successful LDAP search base.
  • Displays a summary dialog reporting imported accounts, skipped duplicates, and skipped entries lacking a DNS host name.
  • Calls ProfileManager.Save() after a successful import.

Implementation notes

  • LDAP logic is encapsulated in NETworkManager.Utilities.ActiveDirectoryComputerSearcher using System.DirectoryServices.
  • Added a null/empty guard in GroupNameValidator to prevent exceptions on editable group combos.

To-Do

Contributing

By submitting this pull request, I confirm the following:

Tyrix added 3 commits March 27, 2026 11:53
Store RemoteDesktop_ActiveDirectoryImportLdapSearchBase after a successful directory query and prefill the import dialog on next open.
@BornToBeRoot
Copy link
Copy Markdown
Owner

Thanks. I will review it once i am done with the PR for the Firewall Module :) I don't have much time right now, so it might take a while. But I think it's a great feature.

@BornToBeRoot
Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

@BornToBeRoot BornToBeRoot changed the title Feature/import ad computers Feature: Import AD computers Apr 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Remote Desktop UI flow to import computer accounts from on-premises Active Directory (LDAP subtree search) into a selected profile group, with filtering and persisted “last search base” for UX.

Changes:

  • Adds an “Import computers from Active Directory…” button to the Remote Desktop host view and a new child window for import options.
  • Introduces ActiveDirectoryComputerSearcher (+ record type) to query AD using current Windows credentials and return candidate computers.
  • Persists the last successful LDAP search base in settings and adds new localized strings for the import UX.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Source/NETworkManager/Views/RemoteDesktopHostView.xaml Adds toolbar button to open the AD import dialog.
Source/NETworkManager/Views/ImportAdComputersChildWindow.xaml New child window UI for LDAP search base, target group, and options.
Source/NETworkManager/Views/ImportAdComputersChildWindow.xaml.cs Child window sizing/focus behavior.
Source/NETworkManager/ViewModels/RemoteDesktopHostViewModel.cs Adds command to open the AD import dialog.
Source/NETworkManager/ViewModels/ImportAdComputersViewModel.cs Implements import workflow, filtering, and summary dialog.
Source/NETworkManager/ProfileDialogManager.cs Wires up new import child window + VM.
Source/NETworkManager.Validators/GroupNameValidator.cs Avoids exceptions by treating null/empty as valid (paired with EmptyValidator).
Source/NETworkManager.Utilities/ActiveDirectory/ActiveDirectoryComputerSearcher.cs LDAP query logic for AD computers.
Source/NETworkManager.Utilities/ActiveDirectory/ActiveDirectoryComputerRecord.cs Record struct for returned AD computer data.
Source/NETworkManager.Settings/SettingsInfo.cs Adds persisted setting for last LDAP search base.
Source/NETworkManager.Localization/Resources/Strings.resx Adds new strings for AD import UI.
Source/NETworkManager.Localization/Resources/Strings.Designer.cs Updates generated resource accessors.
CONTRIBUTORS.md Adds contributor entry.
Files not reviewed (1)
  • Source/NETworkManager.Localization/Resources/Strings.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/NETworkManager.Localization/Resources/Strings.resx
Comment on lines +201 to +207
var profile = CreateRemoteDesktopProfileForImportedComputer(computer.ProfileName, dnsHostName,
targetGroup);

ProfileManager.AddProfile(profile);
existingProfileNames.Add(computer.ProfileName);
importedCount++;
}
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import loop calls ProfileManager.AddProfile(profile) for every AD computer, and AddProfile triggers ProfilesUpdated() each time. For large OUs this can cause significant UI churn/slowdowns. Consider batching (e.g., add a ProfileManager.AddProfiles(...)/BeginUpdate-EndUpdate mechanism or otherwise suppress repeated OnProfilesUpdated until after the loop) so the UI refresh happens once.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Extend the ProfileManager with AddProfiles()

BornToBeRoot and others added 2 commits April 25, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Import Active Directory Computers for Remote Desktop

3 participants