Advertisement
Advertisement
| 06.20.2008 at 02:55PM PDT, ID: 23503742 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: |
if (radioSingleObj.Checked)
{
if (textBoxSingle.Text == "")
{
MessageBox.Show("You need to enter a workstation name", "Input Required", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
string objectName = textBoxSingle.Text;
MessageBox.Show(objectName);
string strPath = "LDAP://OU=Workstations,OU=BAND,DC=Corp,DC=BankofAmerica,DC=Com";
DirectoryEntry entry = null;
entry = new DirectoryEntry(strPath);
DirectorySearcher wkstnSearcher = new DirectorySearcher(entry);
wkstnSearcher.Filter = "(&(objectClass=computer)(|(cn=" + objectName + ")))";
wkstnSearcher.ClientTimeout.Seconds.Equals(30);
SearchResult searchWkstn = wkstnSearcher.FindOne();
if (wkstnSearcher.CacheResults)
{
labelWkstnObjStatus.Text = "Workstation object was located";
entry.Properties["cn"].Remove(objectName);
entry.CommitChanges();
entry.Close();
}
else
{
labelWkstnObjStatus.Text = "Unabled to locate Workstation object";
}
}
}
|