Find inactive computers and archive them


i found code on site.   
 
  
$comparedate=get-date 
 
$numberdays=90 
 
$csvfilelocation='c:\temp\oldcomps.csv' 
 
get-qadcomputer -sizelimit 0 -includedproperties lastlogontimestamp | { ($comparedate-$_.lastlogontimestamp).days -gt $numberdays } | select-object name, lastlogontimestamp, osname, parentcontainerdn | sort-object modificationdate, name | export-csv $csvfilelocation 
 

not point ou.  how point ou?  and 2)  once have list of machines inactive how archive (or move them) ou?   , should effect workstations, not servers.



mqh7

use searchroot option set search specific ou.

get-qadcomputer -searchroot "full path of ou" ....


regards sivakarthi



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file