Verbindung zu Office365: neues Modul AzureAD: Install-Module -Name AzureAD altes Modul MSOnline: Install-Module MSOnline $credential = Get-Credential Connect-MsolService -Credential $credential Connect-AzureAD -Credential $credential https://docs.microsoft.com/de-ch/office365/enterprise/powershell/connect-to-office-365-powershell |
Office 365 AD Sync Befehle: Import-Module ADSync Start-ADSyncSyncCycle -PolicyType Delta Start-ADSyncSyncCycle -PolicyType Initial |
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 Get-ADForest | fl Name,ForestMode |
Verbindungsaufbau zu M365: https://docs.microsoft.com/de-ch/office365/enterprise/powershell/connect-to-office-365-powershell Module Installieren: Install-Module -Name AzureAD Install-Module -Name MicrosoftTeams Install-Module -Name ExchangeOnlineManagement Install-Module -Name Microsoft.Online.SharePoint.PowerShell Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking Update der Module z.B: Update-Module -Name ExchangeOnlineManagement Installierte Version auslesen: Import-Module ExchangeOnlineManagement; Get-Module ExchangeOnlineManagement Verbindung Aufbauen: $UserCredential = Get-Credential Connect-AzureAD -Credential $usercredential Connect-MsolService -Credential $usercredential Connect-ExchangeOnline -Credential $UserCredential -ShowProgress $true Connect-SPOService -Url https://<domainhost>-admin.sharepoint.com -credential $UserCredential Connect-MicrosoftTeams -Credential $UserCredential Allenfalls noch Skype Verbindung kann Warnmeldungen generieren: Import-Module SkypeOnlineConnector $sfboSession = New-CsOnlineSession -Credential $UserCredential Import-PSSession $sfboSession Security & Compliance Center: $SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication „Basic“ -AllowRedirection Import-PSSession $SccSession -Prefix cc 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 |