Skip to content

Instantly share code, notes, and snippets.

View ChrFrohn's full-sized avatar

Christian Frohn ChrFrohn

View GitHub Profile
@ChrFrohn
ChrFrohn / AzureDevOpsPowerShellConfig.ps1
Last active October 26, 2025 14:12
AzureDevOpsPowerShellConfig.ps1
# Exchange Online configuration
$ExchangeOrganization = ""
# Configuration - Access package catalogs (add your catalog IDs to this array)
$AccessPackageCatalogs = @(
# Add your Access Package Catalog IDs here
# "12345678-1234-1234-1234-123456789012",
# "87654321-4321-4321-4321-210987654321"
)
@ChrFrohn
ChrFrohn / Get-PrimarySMTPandRemoteRoutingAddress.ps1
Created June 14, 2024 08:47
Get Primary SMTP address & Remote routing address
$UserName = "" # Sample: [email protected]
Get-RemoteMailbox $UserName | Select-Object RemoteRoutingAddress, PrimarySmtpAddress
# $ObjectId can be the users AAD object ID or email adress (UPN).
param (
[Parameter (Mandatory = $true)]
[object]$ObjectIdOrUPN
)
CREATE USER [NameOfServicerincipal] FROM EXTERNAL PROVIDER;
EXEC sp_addrolemember 'db_owner', 'NameOfServicePrincipal'
$TenantId = ""
$ApplicationID = ""
$CertificateThumbprint = ""
Connect-MicrosoftTeams -CertificateThumbprint $CertificateThumbprint -ApplicationId $ApplicationID -TenantId $TenantId
$ClientSecret = ""
$ApplicationID = ""
$TenantID = ""
$graphtokenBody = @{
Grant_Type = "client_credentials"
Scope = "https://graph.microsoft.com/.default"
Client_Id = $ApplicationID
Client_Secret = $ClientSecret
}
@ChrFrohn
ChrFrohn / SetHolidayDate.ps1
Created May 1, 2022 10:30
Blog - Add new dates to Teams holidays using PowerShell
$HolidayID = Get-CsOnlineSchedule -Id "e48d56a7-461a-46b5-962c-196f6e85145d"
$HolidayID.FixedSchedule.DateTimeRanges += New-CsOnlineDateTimeRange -Start "05/06/2022" -End "06/06/2022"
Set-CsOnlineSchedule -Instance $HolidayID -Verbose
@ChrFrohn
ChrFrohn / CreateCertForAppReg.ps1
Last active September 22, 2022 18:06
CreateCertForAppReg.ps1
$CN = "MyAppReg" #Name of your cert.
$cert=New-SelfSignedCertificate -Subject "CN=$CN" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -KeySpec Signature -NotAfter (Get-Date).AddYears(5)
#Thumbprint - Make note of this
$Thumbprint = $Cert.Thumbprint
#Export cert. to download folder - FilePath can be changed to your linking
Get-ChildItem Cert:\CurrentUser\my\$Thumbprint | Export-Certificate -FilePath $env:USERPROFILE\Downloads\AppRegCert.cer
Write-Output "$Thumbprint <- Copy/paste this (save it)"
@ChrFrohn
ChrFrohn / InstallMSGraph.ps1
Last active April 23, 2022 12:02
InstallMSGraph.ps1
#Installs the Microsoft Graph PowerShell module - Remeber to start PowerShell as admin to be able to install.
Install-Module -Name Microsoft.Graph -verbose
@ChrFrohn
ChrFrohn / ConnectToMSGrahphWithCert.ps1
Last active April 23, 2022 12:02
ConnectToMSGrahphWithCert.ps1
$AppID = ""
$TenantID = ""
$Thumbprint = ""
Connect-MgGraph -ClientId $AppID -TenantId $TenantID -CertificateThumbprint $Thumbprint