Skip to content

Instantly share code, notes, and snippets.

View Apoc70's full-sized avatar

Thomas Stensitzki Apoc70

View GitHub Profile
@Apoc70
Apoc70 / Disable-IPv6ExoMX.ps1
Created September 25, 2024 16:11
Disable MX IPv6 for all accepted domains in Exchange Online
$domains = Get-AcceptedDomain
PS C:\SCRIPTS> $domains | %{Disable-IPv6ForAcceptedDomain -Domain $_.DomainName}
@Apoc70
Apoc70 / Move-ArchiveMailboxes.ps1
Last active September 17, 2024 10:02
Move archive mailboxes from a selected mailbox database to other databases
# fetch archive mailboxes from database
$database = 'MBDB1925'
$mbx =Get-Mailbox -Database $database -Archive | ?{$_.ArchiveDatabase -eq $database}
# some variable
$file = ('e:\Temp\{0}ArchiveUsers.csv' -f $database)
$batchName = ('{0}-Archive-Offboarding' -f $database)
# prepare batch user CSV file
$mbx | Select-Object -Property @{Name = 'EmailAddress'; Expression = {$_.PrimarySMTPAddress}} | Export-Csv -Path $file -Encoding UTF8 -NoTypeInformation
@Apoc70
Apoc70 / Move-UserMailboxes.ps1
Last active September 17, 2024 08:59
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
# Primary and an exisiting archive
@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 / Set-TLS12.ps1
Last active July 24, 2024 13:08
PowerShell script to enable TLS 1.2 in preparation for Entra ID Connect, and to disable legacy TLS for Exchange Server 2019.
param (
[switch]$DisableLegacyTls
)
# Last updated: 2024-02-21
if($DisableLegacyTls) {
# Disable TLS 1.0 and 1.1
# Following https://learn.microsoft.com/exchange/plan-and-deploy/post-installation-tasks/security-best-practices/exchange-tls-configuration?view=exchserver-2019&WT.mc_id=M365-MVP-5003086
# Disable TLS 1.0
@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 |
@Apoc70
Apoc70 / Single-Name-Certificate-Request.inf
Last active September 13, 2023 13:13
Beispiel einer .inf-Datei für die Erstellung eines Einzelnamen-Zertifikates
[Version]
Signature="$Windows NT$"
[NewRequest]
Subject = "CN=mail.varunagroup.de,OU=IT,O=Varunagroup AG,L=Berlin,S=BE,C=DE" ; Remove to use an empty Subject name.
Exportable = TRUE ; TRUE = Private key is exportable
KeyLength = 2048 ; Valid key sizes: 1024, 2048, 4096, 8192, 16384
KeySpec = 1 ; Key Exchange – Required for encryption
KeyUsage = 0xA0 ; Digital Signature, Key Encipherment
@Apoc70
Apoc70 / SAN-Certificate-Request.inf
Created June 16, 2018 17:39
Beispiel einer .inf-Datei für die Erstellung eines SAN-Zertifikates
[Version]
Signature="$Windows NT$"
[NewRequest]
Subject = "CN=mail.varunagroup.de,OU=IT,O=Varunagroup AG,L=Berlin,S=BE,C=DE" ; Remove to use an empty Subject name.
Exportable = TRUE ; TRUE = Private key is exportable
KeyLength = 2048 ; Valid key sizes: 1024, 2048, 4096, 8192, 16384
KeySpec = 1 ; Key Exchange – Required for encryption
KeyUsage = 0xA0 ; Digital Signature, Key Encipherment