add
add script
This commit is contained in:
1 parent
1c97f2d498
commit
a59992bae8
15 files changed
+1175
No files matched your search
@@ -0,0 +1,15 @@
|
||||
$exportPath = "C:\Temp\ADClients_LastLogon.csv"
|
||||
|
||||
Get-ADComputer -Filter * -Properties LastLogonDate, OperatingSystem, DistinguishedName |
|
||||
Select-Object Name,
|
||||
OperatingSystem,
|
||||
@{Name="LastLogonDate";Expression={$_.LastLogonDate}},
|
||||
@{Name="DaysInactive";Expression={
|
||||
if ($_.LastLogonDate) { (New-TimeSpan -Start $_.LastLogonDate -End (Get-Date)).Days }
|
||||
else { "Nie angemeldet" }
|
||||
}},
|
||||
DistinguishedName |
|
||||
Sort-Object LastLogonDate |
|
||||
Export-Csv -Path $exportPath -NoTypeInformation -Encoding UTF8 -Delimiter ";"
|
||||
|
||||
Write-Host "Export abgeschlossen: $exportPath"
|
||||
Reference in new issue
Block a user