This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Generates 100 random bitlocker recovery key ID and keys | |
#By Michael Mardahl github.com/mardahl | |
#Use it for whatever... | |
$hash = @{} | |
for($i = 0;$i -lt 100;$i++) { | |
$id = "$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})-$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 100 -maximum 999)$((97..102) | Get-Random -Count 1 | % {[char]$_})$((97..102) | Get-Random -Count 1 | % {[char]$_})$(Get-Random -minimum 10 -maximum 99)$((97..102) | Get-Random -Count 1 | % {[char]$_})" | |
$key = "$(Get-Random -minimum 100000 -maximum 999999)-$(Get-Random -minimum 100000 -maximu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#license MIT | |
#Author Michael Mardahl github.com/mardahl | |
#region declarations | |
$env:CF_API_KEY = 'axxxxxxxxxxxxxxxxxxxx' | |
$env:CF_API_EMAIL= '[email protected]' | |
$domains = $(Get-Content .\domains.txt) #text file with 1 domain per line | |
#endregion declarations | |
#region execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region declarations | |
$apikey = 'axxxxxxxxxxxxxxxxx6a4f5bxxxxxxxxxxxxx' | |
$email = '[email protected]' | |
$accountid = 'b6xxxxxxxxxxxxxxxxx8e57xxxx' | |
$domains = $(Get-Content .\domains.txt) #text file with 1 domain per line | |
#endregion declarations | |
#region execute | |
foreach ($domain in $domains){ | |
$headers = @{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Description: Small helper script to quickly start an AADSync but just double clicking on this script file. | |
REM Author: Michael Mardahl - github.com/mardahl | |
echo Starting AD Sync (Delta)... | |
powershell.exe -ex bypass -command "ipmo adsync;Start-ADSyncSyncCycle delta;" | |
echo Finished script execution. | |
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Define central storage for the log files to be collected. | |
#Make sure all users that run this script have write permissions on this share | |
$logFile = "\\fileserver.domain.local\share\$($env:USERNAME)_OutlookAccounts.csv" | |
#Testing for Outlook 2013 and newer | |
If (Test-Path 'hkcu:\Software\Microsoft\Office\15.0\Outlook\Profiles') { | |
$regPath = 'hkcu:\Software\Microsoft\Office\15.0\Outlook\Profiles\*\9375CFF0413111d3B88A00104B2A6676\*' | |
}elseif(Test-Path 'hkcu:\Software\Microsoft\Office\16.0\Outlook\Profiles'){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try{ | |
Connect-ExchangeOnline -ErrorAction Stop | |
} catch { | |
Throw "Failed to logon to Exchange Online" | |
} | |
$dkim = Get-DkimSigningConfig | |
foreach($obj in $dkim){ | |
Write-Host "Enabling 2048-bit DKIM for $($obj.Domain)" -ForegroundColor Green |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -RunAsAdministrator | |
Set-ExecutionPolicy Bypass -Confirm:$false -Force | |
Install-Module ExchangeOnlineManagement | |
Import-Module ExchangeOnlineManagement | |
try{ | |
Connect-ExchangeOnline -ErrorAction Stop | |
} catch { | |
Throw "Failed to logon to Exchange Online" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This script will create a send connector that can relay through exchange online protection in Office 365 | |
#Must be run from the on prem Exchange Management Shell | |
#WARNING: This will use the wildcard * for sending, so please consider changing "addressSpaces" to some testing domains, so you know this works before routing everything. | |
#WARNING: You must remove your existing internet send connector if you wish for this to work with 100% of all email. | |
#Author: @michael_mardahl (github.com/mardahl) | |
#License: MIT - please keep author credits. | |
$hybridConnector = Get-SendConnector *365* | |
$smartHost = Resolve-DnsName $hybridConnector.AddressSpaces.Address -Type MX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function VerifyCertificateExists($issuer, $templateName){ | |
#function that validates existence of required certificate. | |
#input issuer and template name (wildcards will automatically be added). | |
#example : VerifyCertificateExists -issuer "myCompany" -templateName "myCertTemplate" | |
#MIT license - github.com/mardahl | |
try { | |
Write-Verbose "Verifying existence of required certificate..." -Verbose | |
$certs = Get-ChildItem -Path cert:\currentuser\my | Where-Object Issuer -like "*$issuer*" -ErrorAction Stop | |
$cert = $certs | Where-Object{ $_.Extensions | Where-Object{ ($_.Oid.Value -eq '1.3.6.1.4.1.311.21.7') -and ($_.Format(0) -like "*$templateName*") }} -ErrorAction Stop | |
if(!$cert){throw} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As a default, sharing links with anyone is disabled on Office 365 groupSites, which in turn also means Microsoft Teams Sites. | |
# Even if you have Anyone sharing enabled at the tenant level! | |
# This script can help y remove that requirement from a specific site. | |
# MIT licensing, keep author credits if reusing | |
# Author: Michael Mardahl @michael_mardahl on twitter | |
# https://github.com/mardahl | |
Install-Module -Name Microsoft.Online.SharePoint.PowerShell | |
ipmo Microsoft.Online.SharePoint.PowerShell |
NewerOlder