Skip to content

Instantly share code, notes, and snippets.

View thierrybuisson's full-sized avatar
🎯
Focusing

Thierry Buisson thierrybuisson

🎯
Focusing
View GitHub Profile
# source : http://www.thatlazyadmin.com/create-new-microsoft-team-using-powershell/
Connect-MicrosoftTeams
New-Team -DisplayName "That Lazy Admin Moderators" -Visibility Private
//Sharepoint Online - Site hub management
//Please connect first with - PS> Connect-SPOService -url https://<your tenant>-admin.sharepoint.com
#Export all admin users and roles to CSV
Get-MsolRole | %{$role = $_.name; Get-MsolRoleMember -RoleObjectId $_.objectid} | select @{Name="Role"; Expression = {$role}}, DisplayName, EmailAddress | Export-Csv .\tenantadminrole.csv
@thierrybuisson
thierrybuisson / Manage Hawk module
Last active July 10, 2019 13:54
ManageHawk.ps1
#install properly module, not updating existing modules
Install-module -name hawk -AllowClobber
# Import Office 365 Online Module
Import-module MSOnline
#Get admin credential
$UserCredential = Get-Credential
#start session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
#connect to msonline
@thierrybuisson
thierrybuisson / ManageSiteHub.ps1
Last active April 18, 2019 16:23
Managing Site Hub in Sharepoint Online
//Sharepoint Online - Site hub management
//Please connect first with - PS> Connect-SPOService -url https://<your tenant>-admin.sharepoint.com
//Get all sites containing url sites/mkt
Get-SPOSite -limit all | select url,ID | where-object {$_.Url -like "*sites/mkt*"}
//Remove a site from the recycle bin
Remove-SPODeletedSite -Identity https://contoso.sharepoint.com/sites/sitetoremove
//Register a site as Site Hub - principals should be default admin group