Skip to content

Instantly share code, notes, and snippets.

View Apoc70's full-sized avatar

Thomas Stensitzki Apoc70

View GitHub Profile
@Apoc70
Apoc70 / events-tipps.json
Created September 11, 2024 14:37
Selected configuration examples for a single calendar event. This is not a usable JSON file. It is for reference only.
{
"eventAction": "create|delete",
"eventData": {
"isAllDay": true,
"showAs": "busy|oof|free|tentative|workingElsewhere",
"isreminderOn": false
}
@Apoc70
Apoc70 / Move-UserMailboxes.ps1
Created July 30, 2024 06:58
A few PowerShell lines for creating a new local mailbox migration batch
# Fetch all user mailboxes from database MBXDB01
$mbx = Get-Mailbox -Database MBXDB01
# Export fetched mailboxes to CSV
# Export using EmailAddress as fixed column header for batch creation
$mbx | Select-Object -Property @{Name = 'EmailAddress'; Expression = {$_.PrimarySMTPAddress}} | Export-Csv -Path C:\Temp\MBXDB01Users.csv -Encoding UTF8 -NoTypeInformation
# Create new migration batch with automatic start and automatic complete
# Distribute mailboxes to target databases MBXDB11, MBXDB12, MBXDB19
New-MigrationBatch -Name 'MBXDB01-Offboarding' -CSVData ([System.IO.File]::ReadAllBytes("C:\Temp\INMB1901Users.csv")) -Local -TargetDatabases MBXDB11,MBXDB12,MBXDB19 -AutoStart -AutoComplete -NotificationEmails someone@varunagroup.de
@Apoc70
Apoc70 / Get-ExchangeInfo.ps1
Last active June 26, 2024 08:56
Get Exchange org information for on-premises or Exchange Online as Xml
<#
.SYNOPSIS
This script exports On-Premises Exchange Org and Exchange Online Org configurations to Xml
.DESCRIPTION
The script exports dat using Export-CLixml to the folder \Output
You must create the folder prior to excurting the script.
.PARAMETER Environment
The envrionment to query, either OnPremises or ExchangeOnline
@Apoc70
Apoc70 / Get-ExchangeSecurityGroupsNestedMembers.ps1
Last active November 30, 2023 09:19
Export Exchange security group members
# This script exports all Exchange security groups that have members
# Empty groups are not included in the CSV output.
# Your domain DN
$Domain = 'DC=varunagroup,DC=de'
# Preferred domain controller FQDN
$DomainControllerFQDN = 'testms01.varunagroup.de'
# Fetch Exchange security groups
@Apoc70
Apoc70 / Get-IisTlsBindings.ps1
Created October 25, 2023 13:28
Query the current IIS SSL Bindings and provide the IIS Site and bound certificate as output
# Original source: https://techstronghold.com/scripting/@rudolfvesely/powershell-script-to-get-all-iis-bindings-and-ssl-certificates/
# Updated the script for a sorted output on Exchange Servers
Import-Module -Name WebAdministration
Get-ChildItem -Path IIS:SSLBindings | Sort-Object Port | ForEach-Object -Process `
{
if ($_.Sites)
{
$certificate = Get-ChildItem -Path CERT:LocalMachine/My |
# Get EXO mailboxes by size
Get-ExoMailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Get-ExoMailboxStatistics | Sort TotalItemSize -Descending | Format-Table DisplayName, TotalItemSize, ItemCount
# New B2B user email address
$newEmailAddress = "user@setebos-ag.com"
# Update primary SMTP address for a selected user
$B2BUserToUpdate = 'USER_varunagroup.de#EXT#'
Set-MailUser $B2BUserToUpdate -ExternalEmailAddress "SMTP:$newEmailAddress" -WindowsEmailAddress $newEmailAddress
# Fetch all mail users
$DomainNameFilter = '*varunagroup.de'
Get-MailUser -ResultSize Unlimited | ?{$_.ExternalEmailAddress -like $DomainNameFilter} | Sort-Object DisplayName | Select-Object DisplayName, PrimarySmtpAddress
@Apoc70
Apoc70 / MessageModify.cs
Created March 10, 2023 17:24
Example for intercepting email messages in an Exchange 2010 transport queue
// AttachmentModify
// ----------------------------------------------------------
// Example for intercepting email messages in an Exchange 2010 transport queue
//
// The example intercepts messages sent from a configurable email address(es)
// and checks the mail message for attachments have filename in to format
//
// WORKBOOK_{GUID}
//
// Changing the filename of the attachments makes it easier for the information worker
@Apoc70
Apoc70 / Add-EXOSmtpGatewayConnectors.ps1
Created February 5, 2023 08:43
This PowerShell script creats an Exchange Online inbound and outbound connector, and adds a transport rulle for the outbound connector.
# Name of the on-premises SMTP gateway
$GatewayName = 'NoSpamProxy'
# TLS certificate common name for incoming connection to EOP
$InboundTlsCN = 'smpto.varunagroup.de'
# TLS certificate common name for outgoing connection to EOP
$OutboundTlsCN = 'smpto.varunagroup.de'
# Fully qualified domain name (FQDN) of the on-premises SMTP gateway