- In the extension bar, click the AdBlock Plus icon
- Click the large blue toggle for this website
- Click refresh
- In the extension bar, click the AdBlock icon
- Under "Pause on this site" click "Always"
- In the extension bar, click on the Adguard icon
- Click on the large green toggle for this website
- In the extension bar, click on the Ad Remover icon
- Click "Disable on This Website"
- In the extension bar, click on the orange lion icon
- Click the toggle on the top right, shifting from "Up" to "Down"
- In the extension bar, click on the Ghostery icon
- Click the "Anti-Tracking" shield so it says "Off"
- Click the "Ad-Blocking" stop sign so it says "Off"
- Refresh the page
- In the extension bar, click on the uBlock Origin icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the uBlock icon
- Click on the big, blue power button
- Refresh the page
- In the extension bar, click on the UltraBlock icon
- Check the "Disable UltraBlock" checkbox
- Please disable your Ad Blocker
- Disable any DNS blocking tools such as AdGuardDNS or NextDNS
- Disable any privacy or tracking protection extensions such as Firefox Enhanced Tracking Protection or DuckDuckGo Privacy.
If the prompt is still appearing, please disable any tools or services you are using that block internet ads (e.g. DNS Servers, tracking protection or privacy extensions).
Question
newbypr
I am trying to update the managers name in active directory with an application I got that updates active directory.
I been strugling with this for a few weeks now and couldn't find the best way to update the managers name.
I got a datareader that returns all the employees from the database then a method checks each one of the records and compares them in AD and them commits the changes to the users information.
This is what I have try so far:
This is one updates the other properties except the managers name:
using (DirectoryEntry manager = new DirectoryEntry(GetDirectoryEntry()))
using (DirectoryEntry minion = new DirectoryEntry(GetDirectoryEntry())) {
minion.Properties["manager"].Value =
manager.Properties["distinguishedName"].Value.ToString();
}
Error: The value provided for adsObject does not implement IADs.
With this is one:
if (oEmployee.Manager != String.Empty) {
dentry.Properties["manager"].Value = "CN=oEmployee.Manager,DC=domain, DC=net";
Error: System.DirectoryServices.DirectoryServicesCOMException (0x8007202F): A constraint violation occurred.(Exception from HRESULT: 0x8007202F)
And with this one:
if (oEmployee.Manager != String.Empty) {
dentry.Properties["manager"].Value = oEmployee.Manager;
Error: System.DirectoryServices.DirectoryServicesCOMException (0x8007202F): A constraint violation occurred.(Exception from HRESULT: 0x8007202F)
This is my code:
public void ModifyUsers(SortedList<string , clsEmployee> colEmployee) {
clsEmployee oEmployee;
DirectoryEntry dentry;
string empId;
DirectoryEntry de = GetDirectoryEntry();
DirectorySearcher dirsearcher = new DirectorySearcher(de);
dirsearcher.PageSize = 1000;
dirsearcher.Filter = "(&(objectCategory=person)(objectClass=user))";
SearchResultCollection dsCol = dirsearcher.FindAll();
foreach (SearchResult restEnt in dsCol) {
dentry = restEnt.GetDirectoryEntry();
if (dentry.Properties["employeeId"] != null) {
if (dentry.Properties["employeeId"].Value != null) {
empId = dentry.Properties["employeeId"].Value.ToString();
oEmployee = new clsEmployee();
try {
oEmployee = colEmployee[empId];
}
catch {
//do nothing
}
if (!oEmployee.empId.Equals(string.Empty)) {
//Update the information
try {
if (oEmployee.Pager != String.Empty) {
dentry.Properties["pager"].Value = oEmployee.Pager;
}
if (oEmployee.TelephoneNumber != String.Empty) {
dentry.Properties["telephoneNumber"].Value = oEmployee.TelephoneNumber;
}
if (oEmployee.HomePhone != String.Empty) {
dentry.Properties["homePhone"].Value = oEmployee.HomePhone;
}
if (oEmployee.Mobile != String.Empty) {
dentry.Properties["mobile"].Value = oEmployee.Mobile;
}
if (oEmployee.Nextel != String.Empty) {
dentry.Properties["ipphone"].Value = oEmployee.Nextel;
}
if (oEmployee.RadioId != String.Empty) {
dentry.Properties["otherIpPhone"].Value = oEmployee.RadioId;
}
if (oEmployee.Department != String.Empty) {
dentry.Properties["department"].Value = oEmployee.Department;
}
if (oEmployee.Manager != String.Empty) {
dentry.Properties["manager"].Value = oEmployee.Manager;
}
using (DirectoryEntry entryManager = new DirectoryEntry(GetDirectoryEntry()))
using (DirectoryEntry dirent = new DirectoryEntry(GetDirectoryEntry())) {
dirent.Properties["manager"].Value =
entryManager.Properties["manager"].Value = oEmployee.Manager;
}
//Update managers name
//if (oEmployee.Manager != String.Empty) {
// dentry.Properties["distinguishedName"].Value = oEmployee.Manager;
//}
}
catch (Exception e) {
//For debugging
Console.WriteLine(e.Message);
}
dentry.CommitChanges();
dentry.Close();
}
}
}
}
Any ideas of how I can update the manager name?
Thanks.
Link to comment
https://www.neowin.net/forum/topic/683460-update-managers-name-in-active-directory/Share on other sites
0 answers to this question
Recommended Posts