Skip to content

Instantly share code, notes, and snippets.

View mobernberger's full-sized avatar

Michael Obernberger mobernberger

  • Austria
  • 11:14 (UTC +02:00)
View GitHub Profile
@mobernberger
mobernberger / ReadMe
Last active August 29, 2015 14:12
netmftwilio
This is a quick implementation of the Twilio REST Api to send a message from the .NET Micro Framework.
You have the TwilioAccount Class, then the TwilioClient itself, which takes the parameter for the FROM Number, TO Number and the Body. The final File is a quick Test implementation.
@mobernberger
mobernberger / gist:a95b4b5578361e8ddc0fc580b8a5b79f
Last active November 23, 2019 18:40
Upload Custom iOS XML IMAP configuration via Intune Graph API
<#
.COPYRIGHT
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
See LICENSE in the project root for license information.
Added XML and JSON configuration and UPN parameter by Michael Obernberger
Version: 1.0
Date: 12.03.2019
@mobernberger
mobernberger / exo-deleted-items-30days.ps1
Last active November 24, 2019 08:09
Exchange Online - Retain Deleted Items Configuration
#Connect to Exchange Online Powershell before running this commands.
#Set the retention period for all Mailbox plans in the tenant to 30 days. This setting applies to new and newly migrated mailboxes
Get-MailboxPlan | Set-MailboxPlan -RetainDeletedItemsFor 30
#Set the retention period for all existing mailboxes to 30 days
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox -RetainDeletedItemsFor 30
#Connect to Exchange Online Powershell before running this commands.
Get-AdminAuditLogConfig | Set-AdminAuditLogConfig -AdminAuditLogAgeLimit 365
@mobernberger
mobernberger / exo-block-basic-auth.ps1
Created December 2, 2019 06:36
This set of commands creates a new authentication policy
#Connect to Exchange Online Powershell before running this commands.
#Create a new authentication policy which blocks all basic authentication
New-AuthenticationPolicy -Name "Block Basic Auth"
#Set the policy to all users and force it immediately enable by reset the refresh token.
Get-Recipient -RecipientTypeDetails UserMailbox -ResultSize Unlimited | Set-User -AuthenticationPolicy "Block Basic Auth" -STSRefreshTokensValidFrom $([System.DateTime]::UtcNow)
#Define the policy as default for your organization
Set-OrganizationConfig -DefaultAuthenticationPolicy "Block Basic Auth"
#Connect to Exchange Online Powershell before running this commands.
$Mbx = Get-Mailbox -RecipientTypeDetails UserMailbox, SharedMailbox -ResultSize Unlimited | Select DistinguishedName, DisplayName
ForEach ($M in $Mbx) {
Write-Host "Manually enabling mailbox auditing for" $M.DisplayName
Set-Mailbox -Identity $M.DistinguishedName -AuditEnabled $True }
@mobernberger
mobernberger / block-guest-for-specific-o365group.ps1
Last active March 21, 2020 17:10
With this script/commandlet you could block/allow external guests to specific Office 365 group
#Connect to Azure AD Powershell with the Preview Module: Install-Module AzureADPreview
#Search for specific group
$GroupID = get-unifiedgroup -Identity <Insert SMTP or Identity> | Select-Object -ExpandProperty ExternalDirectoryObjectId
#Check if there is already a specific group settings specified and delete it
$SettingID = Get-AzureADObjectSetting -TargetType Groups -TargetObjectID $GroupID | select-object -expandproperty ID
Remove-azureadobjectsetting -id $settingid -targettype Groups -TargetObjectID $GroupID
#Create a new setting with Guests disabled
@mobernberger
mobernberger / exo-message-size.ps1
Last active March 29, 2020 17:57
With this series of commands you could change the maximum send and receive size in Exchange Online
#Connect to Exchange Online Powershell before running this commands.
#Get the actual value for all Mailbox Plans
Get-MailboxPlan | fl name,maxsendsize,maxreceivesize,isdefault
#Set the the max send and receive size to 50MB
Get-MailboxPlan | Set-MailboxPlan -MaxSendSize [On-Prem value in MB / e.g. 50MB] -MaxReceiveSize [On-Prem value in MB / e.g. 50MB]
#Set the max send and receive size 50MB for existing mailboxes
Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'UserMailbox')} | Set-Mailbox -MaxSendSize 50MB -MaxReceiveSize 50MB
#Start an administrative powershell on your ADFS server
$msolId = "urn:federation:MicrosoftOnline"
$rptName = "Microsoft Office 365 Identity Platform"
$rptRules = (Get-AdfsRelyingPartyTrust -Identifier $msolId).IssuanceTransformRules
$newRule = '@RuleTemplate = "LdapClaims" @RuleName = "UPN Claim Rule" c1:[Type == "http://schemas.microsoft.com/ws/2012/01/passwordexpirationtime"] => issue(store = "_PasswordExpiryStore", types = ("http://schemas.microsoft.com/ws/2012/01/passwordexpirationtime","http://schemas.microsoft.com/ws/2012/01/passwordexpirationdays","http://schemas.microsoft.com/ws/2012/01/passwordchangeurl"), query = "{0};", param = c1.Value);'
$rptRules = $rptRules + $newRule
Set-AdfsRelyingPartyTrust -TargetName $rptName -IssuanceTransformRules $rptRules
#Start an administrative Powershell on your ADFS Server
Enable-AdfsEndpoint "/adfs/portal/updatepassword/"
Set-AdfsEndpoint "/adfs/portal/updatepassword/" -Proxy:$true
#This command restarts the ADFS service to enable the funcitionality (short ADFS interruption)
Restart-Service AdfsSrv -Force