Skip to content

Instantly share code, notes, and snippets.

zaab_it mrik23

View GitHub Profile
@mrik23
mrik23 / AADSigninsReport.ps1
Created Sep 21, 2018
PowerShell script using the Microsoft Graph API to retrieve Azure AD Audit Log Sign-ins and send the report by email using Microsoft Flow. This script is ready to be used with Azure Functions.
View AADSigninsReport.ps1
<#
This script retrieves Azure Active Directory Sign-in logs for privileged users from the Microsoft Graph API and send an email report.
Only the sign-ins for the last day will be retrieved (that can be modified with $startDate $endDate).
See the official documentation for more info on the Audit logs API:
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/signin
To connect to the Microsoft Graph API you need to provide ClientId, ClientSecret and TenantDomain.
@mrik23
mrik23 / SharePoint-Modern-Page-ClientSideText.html
Last active Sep 18, 2018
HTML content example from SharePoint modern page Text Webpart. See image example https://ibb.co/ffB0Ge.
View SharePoint-Modern-Page-ClientSideText.html
<p>Normal text<strong> Bold text</strong><em> italic text</em><u> Underline text </u><span class="fontSizeSmall">Font size 12 </span><a data-interception="off" href="https://www.google.com">Link</a></p>
<p><span class="fontColorThemePrimary">Color theme primary</span><span class="fontColorRed"> Color pick red</span>&nbsp; <span class="highlightColorYellow">Highlight color yellow</span></p>
<p style="text-align:center;">Centered text</p>
<p style="text-align:right;">Left text</p>
<p style="text-align:justify;">Justified text</p>
@mrik23
mrik23 / MicrosoftTeams-GetTeamLink.ps1
Last active Sep 3, 2018
Script to construct team link using Microsoft Teams PowerShell module
View MicrosoftTeams-GetTeamLink.ps1
@mrik23
mrik23 / SPO-GetSiteExternalUsersModernSharing.ps1
Created Apr 8, 2018
PowerShell script to retrieve external users that have been added via modern sharing experience on files and folders (with verification code to email). These users are not retrieved with Get-SPOExternalUser and not present in Azure AD.
View SPO-GetSiteExternalUsersModernSharing.ps1
<#
Script to retrieve external users that have been added via modern sharing experience on files and folders (with verification code to email).
These users are not retrieved with Get-SPOExternalUser cmdlet and not added as guest users in Azure AD.
Requires: SharePoint Online Management Shell > https://www.microsoft.com/en-us/download/details.aspx?id=35588
#>
Connect-SPOService -Url https://<tenantName>-admin.sharepoint.com
@mrik23
mrik23 / Test-LeakedPasswordHIBP.ps1
Last active Mar 13, 2019
PowerShell script to check password against leaked password database from https://haveibeenpwned.com/ using the Pwned Passwords V2 API. Only the first 5 characters of the password string hash is checked against the API (k-anonymity). More info on the HIBP API at https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/.
View Test-LeakedPasswordHIBP.ps1
#requires -version 4
<#
.SYNOPSIS
Check password against leaked password database from https://haveibeenpwned.com/ using the Pwned Passwords V2 API https://api.pwnedpasswords.com/range/<hashPrefix>.
.DESCRIPTION
Only the first 5 characters of the password string hash is checked against the API (k-anonymity). The API returns a list of all passwords matching the hash prefix, then the script checks if the suffix is present or not.
@mrik23
mrik23 / AADRiskySigninsNotification.ps1
Last active Oct 22, 2018
PowerShell script using the Microsoft Graph REST API to retrieve Azure AD Risky Sign-ins events and send an email notification using also the Microsoft Graph API. This script can be used in Azure Function and using the application settings variables. Go to https://medium.com/@zaab_it/azure-ad-risky-sign-ins-email-notification-6cbfac32f6de for mo…
View AADRiskySigninsNotification.ps1
<#
This script retrieves Azure Active Directory Risk Sign-in Events from the Microsoft Graph API and send an email alert report.
Only the active events from the last 30 days will be retrieved (that can be modified via the $filter value in uriGraphEndpoint or removed to get all events).
See the official documentation for more info:
https://docs.microsoft.com/en-us/azure/active-directory/active-directory-identityprotection-graph-getting-started
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_sendmail
#>
@mrik23
mrik23 / SPO-Column-Formating-Example08.json
Created Feb 3, 2018
SharePoint Online JSON script to custom format a person column with a mailto link. This example shows how to convert a column date content to a string. The operators toString() or toLocaleString() could also be used, depending on the desired format output.
View SPO-Column-Formating-Example08.json
{
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"debugMode": true,
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding-right": "8px"
},
@mrik23
mrik23 / EOL-DisableMailboxAccessForAllProtocols.ps1
Created Jan 30, 2018
PowerShell one-liner script to remove email access for one user (disable POP IMAP MAPI OWA ActiveSync and Outlook app for iOS and Android). Tested on Exchange Online.
View EOL-DisableMailboxAccessForAllProtocols.ps1
Set-CASMailbox -Identity someone@contoso.com -PopEnabled $False -ImapEnabled $False -MAPIEnabled $False -OWAEnabled $False -ActiveSyncEnabled $False -OWAforDevicesEnabled $false -EWSEnabled $False -EwsBlockList @{Add="Outlook-iOS/*","Outlook-Android/*"}
### Re-enable all protocols ###
#Set-CASMailbox -Identity someone@contoso.com -PopEnabled $true -ImapEnabled $true -MAPIEnabled $true -OWAEnabled $true -ActiveSyncEnabled $true -OWAforDevicesEnabled $true -EWSEnabled $true -EwsBlockList @{Remove="Outlook-iOS/*","Outlook-Android/*"} -EwsApplicationAccessPolicy $null
@mrik23
mrik23 / Windows10-Unbloating-v1.ps1
Created Dec 27, 2017
PowerShell script to remove bloatware shipped in Windows 10 and disabled unwanted features. Tested on version 1709.
View Windows10-Unbloating-v1.ps1
# Windows 10 Unbloating
# Inspired by:
# https://github.com/W4RH4WK/Debloat-Windows-10/blob/master/scripts/remove-default-apps.ps1
# https://github.com/Disassembler0/Win10-Initial-Setup-Script/blob/master/Win10.ps1
# Uninstall default Microsoft applications
$MsftBloatApps = @(
"Microsoft.3DBuilder"
"Microsoft.BingFinance"
"Microsoft.BingNews"
@mrik23
mrik23 / EOL-RemoveAllMailboxFolderPermissions.ps1
Created Dec 12, 2017
Exchange Online PowerShell script to remove added permissions on all foldders of an user's mailbox. Can be used with Exchange Online PowerShell module with MFA.
View EOL-RemoveAllMailboxFolderPermissions.ps1
<#
.SYNOPSIS
EOL-RemoveAllMailboxFolderPermissions.ps1
.DESCRIPTION
A script to remove permissions from all folders present in a particular user mailbox.
.OUTPUTS
Console output for progress.
You can’t perform that action at this time.