Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| pub:powershell [2015/10/07 07:56] – Marco Krage | pub:powershell [2019/05/18 11:49] (aktuell) – Marco Krage | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Powershell ====== | ====== Powershell ====== | ||
| + | |||
| + | Display Powershell Version | ||
| + | $PSVersionTable.PSVersion | ||
| + | If the variable does not exist, it is safe to assume the engine is version 1.0. | ||
| + | |||
| + | Ausgabe aus mehreren Befehlen zusammen | ||
| + | <code powershell> | ||
| + | Get-VM | Get-NetworkAdapter | | ||
| + | Where-object {$_.Type -ne " | ||
| + | Select @{N=" | ||
| + | </ | ||
| ===== Windows Powershell ===== | ===== Windows Powershell ===== | ||
| + | ==== Remote Session ==== | ||
| + | Enter-PSSession -ComputerName $computerName -Credential user@domain.local | ||
| - | ==== Gesperrte Benutzer ==== | + | $cred = Get-Credential user@domain.local |
| - | <code powershell> | + | |
| - | Import-Module activedirectory | + | |
| - | Search-ADAccount –LockedOut | + | ==== Get Registry Value ==== |
| + | Get-ItemPropertyValue " | ||
| - | Search-ADAccount | + | ==== Log Date ==== |
| - | </ | + | Write-Host (get-date).DateTime |
| - | <code powershell> | + | ==== Delete RAW if no matching JPG exists ==== |
| - | Alter Computer Konten finden | + | |
| - | $then = (Get-Date).AddDays(-60) # The 60 is the number of days from today since the last logon. | + | |
| - | Get-ADComputer -Property Name, | ||
| - | Set-ADComputer -Enabled $false | ||
| - | </ | ||
| ==== Drucker Migration ==== | ==== Drucker Migration ==== | ||
| Zeile 66: | Zeile 75: | ||
| </ | </ | ||
| - | ===== Exchange | + | ===== Active Directory ===== |
| + | |||
| + | ==== Gesperrte Benutzer ==== | ||
| + | <code powershell> | ||
| + | Import-Module activedirectory | ||
| + | |||
| + | Search-ADAccount –LockedOut | ||
| + | |||
| + | Search-ADAccount -LockedOut | Unlock-ADAccount | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Alte Computerkonten finden ==== | ||
| + | <code powershell> | ||
| + | $then = (Get-Date).AddDays(-60) # The 60 is the number of days from today since the last logon. | ||
| + | |||
| + | Get-ADComputer -Property Name, | ||
| + | |||
| + | Set-ADComputer -Enabled $false | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | ===== Exchange ===== | ||
| Die Powershell und auch die Exchange-Verwaltungsshell nutzen s.g. Cmdlets. Diese setzt sich aus einem Verb und einem Hauptwort zusammen. Zum Beispiel '' | Die Powershell und auch die Exchange-Verwaltungsshell nutzen s.g. Cmdlets. Diese setzt sich aus einem Verb und einem Hauptwort zusammen. Zum Beispiel '' | ||
| Zeile 160: | Zeile 192: | ||
| </ | </ | ||
| + | |||
| + | ==== Datenbank ==== | ||
| + | Übersicht über Datenbanken und deren Größe. | ||
| + | Get-MailboxDatabase -Status | ft name, | ||
| + | |||
| + | |||
| + | ==== Postfach ==== | ||
| + | Postfach suchen | ||
| + | Get-Mailbox -filter " | ||
| + | |||
| + | Getrennte Mailboxen auflisten | ||
| + | Get-MailboxStatistics -server SERVERNAME | Where {$_.DisconnectDate -ne $null} | ||
| + | |||
| + | Mailbox Cleanup um getrennte Postfächer sofort in der GUI anzuzeigen | ||
| + | Clean-MailboxDatabase " | ||
| + | |||
| + | Postfachgröße | ||
| + | Get-MailboxStatistics kragem | ft DisplayName, | ||
| + | |||
| + | Postfachgrößen aller Postfächer sortiert und in Größe in MB | ||
| + | Get-MailboxDatabase | Get-MailboxStatistics | Sort-Object -Descending -Property TotalItemSize | ft DisplayName, | ||
| + | |||
| + | Postfachgrößen als CSV (Komma) exportieren | ||
| + | Get-MailboxStatistics | Select-Object DisplayName, | ||
| + | | ||
| + | ==== Postfachfunktionen ==== | ||
| + | Postfächer mit Active Sync | ||
| + | Get-CASMailbox | where {$_.ActiveSyncEnabled -eq $true } | ||
| + | |||
| + | Postfächer mit OWA | ||
| + | Get-CASMailbox | where {$_.OWAEnabled -eq $true } | ||
| + | |||
| + | ==== Geräte ==== | ||
| + | Alle Geräte-Details anzeigen | ||
| + | Get-ActiveSyncDevice | fl UserDisplayName, | ||
| + | |||
| + | Alle Geräte-Details einer Mailbox anzeigen | ||
| + | Get-ActiveSyncDevice -Mailbox " | ||
| + | |||
| + | Alle Geräte einer Mailbox anzeigen mit LastSync Datum. Alte Geräte oben. | ||
| + | Get-ActiveSyncDeviceStatistics -Mailbox " | ||
| + | |||
| + | Alte Geräte finden | ||
| + | Get-ActiveSyncDevice -Result Unlimited | Get-ActiveSyncDeviceStatistics | Where {$_.LastSuccessSync -le (Get-Date).AddDays(" | ||
| + | |||
| + | zum löschen der Geräte statt an '' | ||
| + | |||
| + | Device manuell über ID löschen (Achtung: Wird aus allen evtl. aktiven Mailboxen gelöscht!) | ||
| + | Get-ActiveSyncDevice | where {$_.DeviceId -eq " | ||
| + | |||
| + | Device aus bestimmter Mailbox löschen (über Identity) | ||
| + | Get-ActiveSyncDevice | where {$_.Identity -eq " | ||
| + | |||
| + | http:// | ||
| + | Set-CasMailbox pponzeka –ActiveSyncAllowedDeviceIDs number1, | ||
| + | Set-CasMailbox pponzeka –ActiveSyncAllowedDeviceIDs: | ||
| ==== Zertifikat erneuern ==== | ==== Zertifikat erneuern ==== | ||