$ForestInfo=Get-ADForest
$Domains =$forestInfo.domains
$FileName =$ForestInfo.RootDomain+”-Windows_Servers_60-9_Days_Active-“+”$(get-date -Format MM-dd-yyyy)”+”.csv”
$FilePath = “c:\temp”
$Daysactive = 60
$lastactive=(get-date).AddDays(-($Daysactive))
foreach($domain in $domains){
Write-Output “Working on $domain”
Get-ADComputer -Filter {OperatingSystem -like “*server*” -and lastlogondate -gt $lastactive -and enabled -eq $true } -Property Name,DNSHostName,OperatingSystem,OperatingSystemServicePack,IPv4Address,LastLogonDate,Modified,Description,DistinguishedName,Created -Server $domain| select Name,DNSHostName,OperatingSystem,OperatingSystemServicePack,IPv4Address,LastLogonDate,Modified,Description,DistinguishedName,Created | Export-Csv -NoTypeInformation $FilePath\$FileName -append
}
Hi my family member! I want to say that this post is awesome, nice written and include approximately all important infos. I?¦d like to see extra posts like this .
Heya i’m for the first time here. I came across this board and I find It truly useful & it helped me out much. I hope to give something back and help others like you aided me.
Pvznk dMNQ NOwlw VyLZ GmWs
Generally I do not read article on blogs, however I would like to say that this write-up very forced me to try and do so! Your writing style has been amazed me. Thanks, quite nice post.
you are really a good webmaster. The site loading speed is incredible. It seems that you are doing any unique trick. Also, The contents are masterwork. you’ve done a magnificent job on this topic!
yjOn qLfZfVm xKIWHAT
I’ve been surfing online greater than three hours nowadays, yet I by no means found any interesting article like yours. It’s pretty value sufficient for me. In my opinion, if all website owners and bloggers made excellent content material as you did, the net will probably be much more useful than ever before.
jear2p
s7fksw
very nice publish, i definitely love this web site, keep on it
8fhe0d
Its such as you read my thoughts! You appear to understand so much approximately this, like you wrote the ebook in it or something. I think that you just could do with some to pressure the message home a bit, but other than that, that is wonderful blog. An excellent read. I will definitely be back.
6izzly
ibkuna
fp34j3
wi0j7x
It is actually a great and useful piece of information. I’m satisfied that you shared this useful information with us. Please stay us informed like this. Thanks for sharing.
r40xaj
co1slj