sanders720
Programmer
I am trying to get a listin of all the PC names on the network and add them to a listbox. The code builds fine, but it does not work.
The error I get is:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll
Additional information: The server is not operational
I am running Windows XP. Any help would be greatly appreciated!
private void Form1_Load(object sender, System.EventArgs e)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://microsoft");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=computer)");
foreach (SearchResult d in mySearcher.FindAll())
{
this.lstPCNames.Items.Add(d.GetDirectoryEntry().Name.ToString());
}
}
The error I get is:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll
Additional information: The server is not operational
I am running Windows XP. Any help would be greatly appreciated!
private void Form1_Load(object sender, System.EventArgs e)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://microsoft");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=computer)");
foreach (SearchResult d in mySearcher.FindAll())
{
this.lstPCNames.Items.Add(d.GetDirectoryEntry().Name.ToString());
}
}