Find inactive computers from domain

  • Thread starter Thread starter MyTechnet.Me
  • Start date Start date
M

MyTechnet.Me

Guest
public static inactivecomputer()

{
ArrayList inactiveComputers=new ArrayList();
DirectoryEntry entry = new DirectoryEntry("LDAP://OU=Workstation,DC=Mytechnet,DC=COM");
DirectorySearcher mysearcher = new DirectorySearcher(entry);
long timeStamp = DateTime.Now.Subtract(TimeSpan.FromDays(90)).ToFileTime();
mysearcher.Filter = "(&(objectClass=computer)(lastLogon<=" + timeStamp + "))";
foreach (SearchResult result in mysearcher.FindAll())
{
inactiveComputers.Add(result.GetDirectoryEntry().Name);
}
return;
}


Error : Method must have a return type




Support@Mytechnet.me

Continue reading...
 
Back
Top