User Tools

Site Tools


office365:powershell

Powershell

cls clear screen
start transcript transcript.txt

Powershell für Office 365

Install-Module MSOnline
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential


Get-MsolUser -UserPrincipalName johns@contoso.com
Get-MsolGroup -SearchString “bundesvorstand”

Verbindung mit Office365 Organisation herstellen

$Credential = get-credential
$O365Session = New-CsOnlineSession -Credential $credential
Import-PSSession $O365Session

Get users of a o365 group as a CSV file

$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
Get-MsolGroup -SearchString “geschaeftsstellen”

ObjectId DisplayName GroupType Description
——– ———– ——— ———–
8b9d2d26-8b96-47b5-bd94-e8e8bc889d86 Geschaeftsstellen DistributionList no description

Get-MsolGroupMember -groupObjectid ‘8b9d2d26-8b96-47b5-bd94-e8e8bc889d86’ | Select DisplayName,EmailAddress,GroupMemberType | Export-csv C:\users\konstantin\desktop\group-members.csv

Connect to Sharepoint Online

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://volks-admin.sharepoint.com -credential $credential

Connect to Exchange Online

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $credential -Authentication “Basic” -AllowRedirection
Import-PSSession $exchangeSession

New Office 365 User

New-MsolUser -UserPrincipalName kurt.wagner@volkssolidaritaet.de -DisplayName “Wagner, Kurt” -LastName “Wagner” -FirstName “Kurt” -Department “Bundesgeschäftsstelle” -State “Bundesverband”

Set-MsolUser -UserPrincipalName kurt.wagner@volkssolidaritaet.de -UsageLocation “DE”

Übersicht der Lizenzen

Get-MsolAccountSku

AccountSkuID ActiveUnits WarningUnits ComsumedUnits
volks:PROJECTPROFESSIONAL 4 0 3
volks:EXCHANGEARCHIVE_ADDON 249 0 245
volks:ENTERPRISEPACK 280 0 280
volks:POWER_BI_STANDARD 100 0 2
volks:STANDARDWOFFPACK 7000 0 3299

Set User Licence

Set-MsolUserLicense -UserPrincipalName kurt.wagner@volkssolidaritaet.de -AddLicenses volks:STANDARDWOFFPACK

view licences and services with powershell

User Email Weiterleitung

Connect to Exchange Online

$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri “https://outlook.office365.com/powershell-liveid/” -Credential $credential -Authentication “Basic” -AllowRedirection Import-PSSession $exchangeSession

Weiterleitung einrichten

Set-Mailbox kurt.wagner@volkssolidaritaet.de -ForwardingAddress konstantin.thumm@volkssolidaritaet.de -DeliverToMailboxAndForward $true

Löschen von (bereits soft gelöschte) Office 365 Gruppe

Connect-AzureAD
(Login)
Get-AzureADMSDeletedGroup (erhalte die soft gelöschten Gruppen mit ID)
Remove-AzureADMSDeletedDirectoryObject –Id <ID>

Folgende Datei beinhaltet ausführliche Anleitung zum Löschen von Soft gelöschten (30 Tage) Sharepoint Seiten und das Löschen von Office 365 Gruppen:
delete-sp-site-with-powershell.docx

office365/powershell.txt · Last modified: 2018/11/09 14:00 by zoula