Skip to content

Instantly share code, notes, and snippets.

zaab_it mrik23

Block or report user

Report or block mrik23

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrik23
mrik23 / MSOL-BulkRemoveDirectAssignedLicense.ps1
Last active Nov 17, 2019
Remove in bulk direct assigned license to users who have group assigned license with Azure AD PowerShell v1
View MSOL-BulkRemoveDirectAssignedLicense.ps1
<#
Modified version of the script from Microsoft Documentation.
Removed the part that checks if the users is assigned more products than the group assigned license.
Added connection part and help to find Sku and Group Object ID.
This script requires Azure AD (aks MSOL) PowerShell v1. It doesn't seem possible to do so with v2.
Ref: https://docs.microsoft.com/en-us/azure/active-directory/active-directory-licensing-ps-examples
#>
Import-Module MSOnline
$UserCredential = Get-Credential
@mrik23
mrik23 / PnP-SharePointOnline-RestAPI-AuthAccessToken.ps1
Last active Jul 9, 2019
PowerShell script to demonstrate how to make calls to SharePoint Online API using authorization token retrieved with PnP PowerShell
View PnP-SharePointOnline-RestAPI-AuthAccessToken.ps1
<#
PowerShell script to demonstrate how to make calls to SharePoint Online API using authorization token retrieved with PnP PowerShell
This should work if the SharePoint tenant has LegacyAuthProtocolsEnabled as FALSE (legacy form based auth not authorized)
You need to have SharePoint Online PnP PowerShell installed https://github.com/SharePoint/PnP-PowerShell
#>
$spoUrl = "https://<tenant>.sharepoint.com"
$connection = Connect-PnPOnline -Url $spoUrl -Credentials UserCredential -ReturnConnection
@mrik23
mrik23 / AADSigninsReport.ps1
Last active Jul 3, 2019
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 / AADRiskySigninsNotification.ps1
Last active Jun 6, 2019
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 / Test-LeakedPasswordHIBP.ps1
Last active May 8, 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 / 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 / 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 / AzureRM-CreateVmDiskEncryptionEnabled.ps1
Last active Jul 9, 2018
This PowerShell script create a new VM and enable disk encryption. Necessary components like Azure AD app and Key Vault are also created.
View AzureRM-CreateVmDiskEncryptionEnabled.ps1
#Azure PowerShell v2
#Check documentation https://docs.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0
Import-Module AzureRM
$credential = Get-Credential
Login-AzureRmAccount -Credential $credential
#Set variables
$location = "eastus" #Find the choice of location with 'Get-AzureRmLocation | select location'
$rgName = "myResourceGroup" + (Get-Random -Maximum 99).ToString()
@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
You can’t perform that action at this time.