Skip to content

Instantly share code, notes, and snippets.

View kevinblumenfeld's full-sized avatar
🎯
Focusing

Kevin Blumenfeld kevinblumenfeld

🎯
Focusing
View GitHub Profile
function Invoke-TestMailboxMove {
param (
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
$UserList
)
end {
$AcceptedDomains = (Get-AcceptedDomain).DomainName
$RoutingAddress = $AcceptedDomains -match '.mail.onmicrosoft.com'
foreach ($User in $UserList) {
function Remove-TenantAddress {
<#
.SYNOPSIS
Remove all mailbox addresses with one more more domains/words
.DESCRIPTION
Remove all mailbox addresses with one more more domains/words
.PARAMETER Domains
List of domains or words to find in the email addresses
for /F "tokens=1,2 delims= " %G in ('cmdkey /list ^| findstr Target') do cmdkey /delete %H
'*******************************************************************************
' Name: OLicenseCleanup.vbs - v 1.15
' Author: Microsoft Customer Support Services
' Copyright (c) Microsoft Corporation
'
' Removes all licenses for Office 2013 and 2016
' from the (Office) Software Protection Platform
'*******************************************************************************
'Option Explicit
$licrem = join-path $env:temp OfficeProPlusLicenseRemoved.txt
if (-not (Test-Path $licrem)) {
$license = cscript "C:\Program Files (x86)\Microsoft Office\Office16\OSPP.VBS" /dstatus
$o365 = 'LICENSE NAME'
for ($i = 0; $i -lt $license.Length; $i++) {
$AllMailboxes = Import-Clixml -Path (Join-Path ([Environment]::GetFolderPath("Desktop")) AllMailboxes.xml)
$del = for ($i = 0 ; $i -lt $AllMailboxes.Count; $i++) {
[pscustomobject]@{
Count = $i
DisplayName = $AllMailboxes[$i].displayname
PrimarySmtpAddress = $AllMailboxes[$i].PrimarySmtpAddress
OU = $AllMailboxes[$i].OrganizationalUnit
}
}
$AllMailboxes = Import-Clixml -Path (Join-Path ([Environment]::GetFolderPath("Desktop")) AllMailboxes.xml)
$del = for ($i = 0 ; $i -lt $MailboxCount; $i++) {
[pscustomobject]@{
Count = $i
DisplayName = $AllMailboxes[$i].displayname
PrimarySmtpAddress = $AllMailboxes[$i].PrimarySmtpAddress
OU = $AllMailboxes[$i].OrganizationalUnit
}
}
$del | Export-csv -Path (Join-Path -Path ([Environment]::GetFolderPath("Desktop")) -ChildPath 'NumberedMailboxes.csv') -NoTypeInformation -Encoding UTF8
if (-not (Get-Module ActiveDirectory -listavailable)) {
Write-Host "Please run from a computer with AD module" -ForegroundColor Red
break
}
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force -ErrorAction SilentlyContinue
function Get-MailboxMoveOnPremisesPermissionReport {
[CmdletBinding()]
az login
az account set --subscription 'Visual Studio Enterprise'
az group create --name poshcore4 --location 'EASTUS2'
az servicebus namespace create --resource-group 'poshcore4' --name 'poshcore4' --location 'EASTUS2' --sku Basic
az servicebus queue create --resource-group 'poshcore4' --namespace-name 'poshcore4' --name messages --lock-duration "0:00:30" --default-message-time-to-live "0:01:00" --max-delivery-count 10 --max-size 1024 --enable-partitioning false --enable-dead-lettering-on-message-expiration true
az servicebus queue authorization-rule create --resource-group 'poshcore4' --namespace-name 'poshcore4' --queue-name messages --name receive --rights Listen
function Get-ExchangeDistributionGroup {
<#
.SYNOPSIS
Export Office 365 Distribution Groups & Mail-Enabled Security Groups
.DESCRIPTION
Export Office 365 Distribution & Mail-Enabled Security Groups
.PARAMETER ListofGroups
Provide a text list of specific groups to report on. Otherwise, all groups will be reported.