knowledge base


PowerShell
Set Pssword renew

import-module activedirectory $120_Days = (Get-Date).adddays(-120) Get-ADUser -Filter {(mail -ne "null") -and (Enabled -eq "true") -and (passwordlastset -le $120_ days)} -Properties * | Select-Object passwordlastset,SamAccountName,mail,passwordneverexpires | sort SamAccountName | export-csv C:\ADEXPORT.txt -Encoding:UTF8 exit


Delete Exchange Mailbox

Get-MailboxDatabase | Get-MailboxStatistics | Where{ $_.DisconnectDate -ne $null } | fl DisplayName, Database, Identity , DisconnectReason, DisconnectDate DisplayName : Max Mustermann Database : Mailbox Database Standard Users Identity : 9f4736b9-f547-4b7d-87d8-bbd3dd0f5502 DisconnectReason : Disabled DisconnectDate : 01.05.2017 Remove-StoreMailboxRemove-StoreMailbox -database "Mailbox Database Standard Users" - Identity "9f4736b9-f547-4b7d-87d8-bbd3dd0f5502" -MailboxState SoftDeleted Entferne alle "Softdeleted"-Mailboxen: Get-MailboxStatistics -Database "dbname" | Where-Object {$_.DisconnectReason -eq "Softdeleted"} | ForEach {Remove-StoreMailbox -Database $_.database -identity $_ .mailboxguid -MailboxState Softdeleted Alle "disconnected mailboxes" entfernen: Get-MailboxStatistics -Database "dbname" | Where-Object {$_.DisconnectReason -eq "Disabled"} | ForEach {Remove-StoreMailbox -Database $_.database -identity $_.mailboxguid -MailboxState Disabled
RDP GracePeriod anzeigen: (Invoke-WmiMethod -PATH (gwmi -namespace rootcimv2terminalservices -class win32_terminalservicesetting) .__PATH -name GetGracePeriodDays).daysleft[/powershell)