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 Domain Functional Level und Forest Functional Level: Get-ADDomain | fl Name,DomainMode |
Verbindungsaufbau zu M365: https://docs.microsoft.com/de-ch/office365/enterprise/powershell/connect-to-office-365-powershell 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 |