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.
$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
Post a Comment