Verbindung zu Office365: neues Modul AzureAD: Install-Module -Name AzureAD altes Modul MSOnline: Install-Module MSOnline $credential = Get-Credential https://docs.microsoft.com/de-ch/office365/enterprise/powershell/connect-to-office-365-powershell |
Office 365 AD Sync Befehle:Import-Module ADSync |
Force AzureAD Password Sync: Entweder über das ADConnect Konfigurationstool über Troubleshooting oder mit Powershell: $adConnector = "<insert local connector name here>" |
MAC Adresse per Powershell ansehen: Get-NetAdapter | select name, macaddress | sort macaddress |
Send Email per Powershell Command: Send-MailMessage -SmtpServer IPorMailServerName -To Emailto@xyz.ch -From EmailFrom@xyz.ch -Subject "It`s me Ronald" -Body "Send a Test Mail" |
Passwort Ablaufdatum ermitteln per Powershell Command: https://bent-blog.de/powershell-ablaufdatum-des-eigenen-kennworts-ermitteln/ ([System.Security.Principal.WindowsIdentity]::GetCurrent().User).Value | get-aduser -Properties Displayname,PasswordLastSet,msDS-UserPasswordExpiryTimeComputed | Select-Object -Property Displayname,SamAccountName,PasswordLastSet,@{Name="ExpirationDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}},@{Name="Duration";Expression={$(New-TimeSpan -Start $(Get-Date) -End $([datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed"))).ToString("%d")+" days"}} Command: net user %username% /domain Letzter Systemstart anzeigen: Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptime Domain Functional Level und Forest Functional Level, sowie Schema Level: Get-ADDomain | fl Name,DomainMode Get-ADObject (Get-ADRootDSE).schemaNamingContext -Property objectVersion |
Verbindungsaufbau zu M365: https://docs.microsoft.com/de-ch/office365/enterprise/powershell/connect-to-office-365-powershell Installierte Module anzeigen: Get-InstalledModule TLS muss aktiviert sein um Module zu installieren: Net.ServicePointManager]::SecurityProtocol 64Bit Version: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord 32Bit Version: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord Module Installieren: Install-Module -Name AzureAD Update der Module z.B: Update-Module -Name ExchangeOnlineManagement Installierte Version auslesen: Import-Module ExchangeOnlineManagement; Get-Module ExchangeOnlineManagement Verbindung Aufbauen: $UserCredential = Get-Credential Allenfalls noch Skype Verbindung kann Warnmeldungen generieren: Import-Module SkypeOnlineConnector Security & Compliance Center: $SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication "Basic" -AllowRedirection Verbindungen sauber trennen: Remove-PSSession $sfboSession ; Remove-PSSession $SccSession ; Disconnect-SPOService ; Disconnect-MicrosoftTeams |
Check if ModernAuthentication is enabled:Get-OrganizationConfig | Format-Table Name,OAuth* -Auto |
Teams Cache löschen
Dieses Powershell Script ausführen, am besten, wenn das Teams beendet ist:
Write-Host "Microsoft Teams wird jetzt beendet, um den Cache zu leeren."
try{
Get-Process -ProcessName Teams | Stop-Process -Force
Start-Sleep -Seconds 5
Write-Host "Microsoft Teams wurde erfolgreich beendet."
}
catch{
echo $_
}
# Der Cache wird nun geleert
try{
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\code cache\cache" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\blob_storage" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\databases" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\cache" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\gpucache" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Indexeddb" | Remove-Item -Force -Recurse
Get-ChildItem -Path $env:APPDATA\"Microsoft\teams\Local Storage" | Remove-Item -Force -RecurseGet-ChildItem -Path $env:APPDATA\"Microsoft\teams\tmp" | Remove-Item -Force -Recurse
}
catch{
echo $_
}
write-host "Der Microsoft Teams Cache wurde erfolgreich geleert."