Text
Exchange Mailbox Migration Document from Microsoft
https://docs.microsoft.com/en-us/exchange/mailbox-migration/migrate-mailboxes-across-tenants
0 notes
Text
Export Distribution Group members to CSV
$Result=@() $groups = Get-DistributionGroup -ResultSize Unlimited $totalmbx = $groups.Count $i = 1 $groups | ForEach-Object { Write-Progress -activity "Processing $_.DisplayName" -status "$i out of $totalmbx completed" $group = $_ Get-DistributionGroupMember -Identity $group.Name -ResultSize Unlimited | ForEach-Object { $member = $_ $Result += New-Object PSObject -property @{ GroupName = $group.DisplayName Member = $member.Name EmailAddress = $member.PrimarySMTPAddress RecipientType= $member.RecipientType }} $i++ } $Result | Export-CSV "C:\Temp\All-Distribution-Group-Members.csv" -NoTypeInformation -Encoding UTF8
0 notes
Text
Shared Mailbox permissions Export/Import
Check access rights first. look for fullAccess/SendAs etc. In this example all rights were Full Access.
Get-exoMailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | sort Identity | Get-exoMailboxPermission |Select-Object Identity,User | Where-Object {($_.user -like '*@*')}
Edit to return the correct access rights if required and export to CSV:
Get-exoMailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited | sort Identity | Get-exoMailboxPermission |Select-Object Identity,User | Where-Object {($_.user -like '*@*')}|Export-Csv C:\Temp\sharedmailboxpermissions.csv -NoTypeInformation
Open CSV and edit username if required.
Create PowerShell cmdlet
=CONCATENATE("Add-MailboxPermission -Identity """,A2,"""","-User """,B2,""""," -AccessRights FullAccess")
Copy and paste result into PowerShell and run
0 notes
Text
Get-User_Licenses.PS1
$MSOLCompanyInformation = Get-MsolCompanyInformation $MSOLCompanyInformationDisplayName = $MsolCompanyInformation.displayname
$ClientPath = Test-Path -Path "C:\Temp\Clients" If($ClientPath -eq $False){
New-Item -ItemType Directory -Path "C:\Temp\Clients" }
$OrgPath = Test-Path -Path "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" If($OrgPath -eq $False){
New-Item -ItemType Directory -Path "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" }
$ReportPath = "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" $Date = Get-Date -uformat %H%M%S_%d%m%Y $Date1 = Get-Date -Format U
$licensedUsers = Get-MsolUser -All | Where-Object {$_.islicensed} | Sort DisplayName
foreach ($user in $licensedUsers) { Write-Host "$($user.displayname)" -ForegroundColor Yellow $licenses = $user.Licenses $licenseArray = $licenses | foreach-Object {$_.AccountSkuId} $licenseString = $licenseArray -join ", " Write-Host "$($user.displayname) has $licenseString" -ForegroundColor Blue $licensedSharedMailboxProperties = [pscustomobject][ordered]@{
DisplayName = $user.DisplayName Licenses = $licenseString UserPrincipalName = $user.UserPrincipalName } $licensedSharedMailboxProperties | Export-CSV -Path $ReportPath\UserLicenses.csv -Append -NoTypeInformation }
0 notes
Text
Unified Group Storage Info
$UnifiedGroups = Get-UnifiedGroup -ResultSize unlimited | sort Displayname
$CustomResult=@() ForEach ($UnifiedGroup in $UnifiedGroups){
If($UnifiedGroup.SharePointSiteUrl -ne $null) { $UnifiedGroupSite=Get-SPOSite -Identity $UnifiedGroup.SharePointSiteUrl $CustomResult += [PSCustomObject] @{ GroupName = $UnifiedGroup.DisplayName StorageUsed_inMB = $UnifiedGroupSite.StorageUsageCurrent Classification = $UnifiedGroup.ResourceProvisioningOptions -join ', '
} }} $CustomResult | FT
$CustomResult | Export-CSV "C:\\Temp\UnifiedGroupInfo-MDSL.csv" -NoTypeInformation -Encoding UTF8
0 notes
Text
https://docs.microsoft.com/en-us/azure/active-directory/hybrid/how-to-connect-install-custom
0 notes
Text
PowerShell Script File Path Check
$MSOLCompanyInformation = Get-MsolCompanyInformation $MSOLCompanyInformationDisplayName = $MsolCompanyInformation.displayname
$ClientPath = Test-Path -Path "C:\Temp\Clients" If($ClientPath -eq $False){
New-Item -ItemType Directory -Path "C:\Temp\Clients" }
$OrgPath = Test-Path -Path "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" If($OrgPath -eq $False){
New-Item -ItemType Directory -Path "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" }
$ReportPath = "C:\Temp\Clients\$MSOLCompanyInformationDisplayName" $Date = Get-Date -uformat %H%M%S_%d%m%Y $Date1 = Get-Date -Format U
0 notes
Text
Creating Cloud Users from CSV
Create an .xlxs and populate with the following fields:
UserPrincipalName
DisplayName
you can add the following if required (I have for the example and the example script):
FirstName
LastName
You can use a formula to build the required fields if needed. Populate FirstName and LastName fields:
=CONCAT(C2," ",D2)
Then to populate the UserPrincipalName field:
=CONCAT(C2,".",D2,"@s13.cloud")
Save as a .csv file to C:\Temp\user.csv
If you open the csv file in notepad, it should look like:
To create the users in Office 365 and export the randomly generated passwords to a .csv file, connect to MSOL-Service and run the following:
$Users = Import-CSV C:\Temp\Users.CSV
$Users | ForEach-Object {New-MsolUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName -FirstName $_.Firstname -Lastname $_.Lastname} | Export-CSV C:\Temp\NewOffice365UsersWith_RandomPassword.CSV -NoTypeInformation
0 notes
Text
Manage ADSyncScheduler
Get-ADSyncScheduler
Set-ADSyncScheduler -SyncCycleEnabled $False
0 notes
Text
Mimecast SmartHosts
eu-smtp-outbound-1.mimecast.com eu-smtp-outbound-2.mimecast.com
0 notes
Text
Sign Users Out of all Apps and Browser Sessions
Get-AzureADUser -All $True | Where{$_.userprincipalname -ne "[email protected]"} | Sort UserPrincipalName
Get-AzureADUser -All $True | Where{$_.userprincipalname -ne "[email protected]"} | Revoke-AzureADUserAllRefreshToken
0 notes
Text
Reading List
https://veronicageek.com/sharepoint/sharepoint-2013/get-nested-folders-files-count-folder-size-and-more-in-spo-document-libraries-using-powershell-pnp/2019/09/
0 notes
Text
Archiving Teams
To archive all Teams:
$Teams = Get-Team Foreach($Team in $Teams){
Set-teamarchivedstate -GroupId $Team.GroupID -Archived:$True
}
Or $False if you want to activate them.
$Teams | Select DisplayName, Archived
0 notes
Text
Removing AD -AAD Synchronization
Connect to Office 365 (MSOL) with PowerShell.
Set-MsolDirSyncEnabled –EnableDirSync $false
To check synchronization is disabled:
(Get-MSOLCompanyInformation).DirectorySynchronizationEnabled
0 notes
Text
SharePoint - Add Admin to all Sites
$AdminUser = “[email protected]”
$SPOSites = Get-SPOSite -Limit All
Foreach ($SPOSite in $SPOSites) { Write-host "Adding Site Collection Admin for:"$SPOSite.URL Set-SPOUser -site $SPOSite -LoginName $AdminUser -IsSiteCollectionAdmin $True }
0 notes
Text
Teams T2T Migration, set Owner and list Owners and Members
# Get all the teams from tenant $teams=Get-Team
#Add migration GA as Owner
$Teams | Add-TeamUser -user USERACCOUNT -Role Owner
# Loop through the teams foreach($team in $teams) { Write-Host -ForegroundColor Magenta "Getting all the owners from Team: " $team.DisplayName
# Get the team owners $ownerColl= Get-TeamUser -GroupId $team.GroupId -Role Owner
#Loop through the owners foreach($owner in $ownerColl) { Write-Host -ForegroundColor Yellow "User ID: " $owner.UserId " User: " $owner.User " Name: " $owner.Name } }
# Loop through the teams foreach($team in $teams) { Write-Host -ForegroundColor Magenta "Getting all the members from Team: " $team.DisplayName
# Get the team owners $memberColl= Get-TeamUser -GroupId $team.GroupId -Role Member
#Loop through the owners foreach($member in $memberColl) { Write-Host -ForegroundColor Yellow "User ID: " $member.UserId " User: " $member.User " Name: " $member.Name } }
0 notes