Skip to content

Instantly share code, notes, and snippets.

<#
.SYNOPSIS
Script to create a new list or document library in SharePoint Online.
.DESCRIPTION
This script connects to SharePoint Online using the specified SiteURL and creates a new list or document library based on the provided parameters.
.PARAMETER SiteURL
The URL of the SharePoint site where the list or document library will be created.
<#
.SYNOPSIS
This script generates a JWT token and accesses a token from a consumer tenant for registering a container type.
.DESCRIPTION
This script is used to generate a JWT token using a private key certificate and then use that token to access an access token from a consumer tenant.
It then registers the container type in the consumer tenant using the obtained access token.
.PARAMETER ClientId
Specifies the Entra ID application client Id.
@jaloplo
jaloplo / Create-SPOContainerType.ps1
Last active March 4, 2024 17:09
PowerShell script for registering a new container type in a consumer tenant.
<#
.SYNOPSIS
Registers a new container type in a consumer tenant.
.DESCRIPTION
This script connects to SharePoint Online and registers a new container type.
.PARAMETER SpoAdminUrl
SharePoint Online Central Administration URL.
.PARAMETER ContainerTypeName
Name of the container type to register.
.PARAMETER EntraAppId
@jaloplo
jaloplo / Uninstall-Module.ps1
Created March 3, 2024 18:12
PowerShell script for remove and uninstall a module from the current session.
param (
[Parameter(Mandatory=$true)]
[string]$moduleName
)
# Check if the module is imported
$moduleImported = Get-Module -Name $moduleName -ErrorAction SilentlyContinue
if ($moduleImported) {
Write-Host "Unimporting module '$moduleName'..."
@jaloplo
jaloplo / Install-NightlyModule.ps1
Last active March 3, 2024 18:34
PowerShell script to import in the current the latest version published of the module including prerelease ones. It installs the module if it is not.
param(
[Parameter(Mandatory=$true)]
[string]$ModuleName,
[switch]$Force
)
Write-Host "Checking if module '$ModuleName' is installed..."
$moduleInstalled = Get-Module -Name $ModuleName -ListAvailable
@jaloplo
jaloplo / Install-Module.ps1
Last active March 3, 2024 18:34
PowerShell script to import a module in the current session. It installs the module if it is not.
param(
[Parameter(Mandatory=$true)]
[string]$ModuleName
)
Write-Host "Checking if module '$ModuleName' is installed..."
$moduleInstalled = Get-Module -Name $ModuleName -ListAvailable
if (-not $moduleInstalled) {
Write-Host "Module '$ModuleName' is not installed. Installing..."
@jaloplo
jaloplo / Create-OpenSslScript.ps1
Created March 3, 2024 16:21
PowerShell script for generating the script to create public and private keys using the openssl tool
param(
[Parameter(Mandatory=$true)]
[string] $Path,
[Parameter(Mandatory=$true)]
[string] $Name,
[Parameter(Mandatory=$true)]
[string] $OutFile
)
# Set the paths for the certificate, private key, and PEM files
const CELSIUS_SCALE = 'Celsius';
const FAHRENHEIT_SCALE = 'Fahrenheit';
const KELVIN_SCALE = 'Kelvin';
const TransformationMethodsHandler = function() {
let collection = {};
return {
// Returns the transformation method by getting the source and target types
// This is a solution for the **Daily Challenge #5 - Ten Minute Walk** challenge
// The link to reach this is https://dev.to/thepracticaldev/daily-challenge-5-ten-minute-walk-1188
function getWalkSteps(walkTime) {
if(walkTime % 2 > 0) {
throw new Error('You cannot come back');
}
const distance = walkTime/2;
const x = Math.floor(Math.random(distance) * distance);
// This is a solution for the **Daily Challenge #4 - Checkbook Balancing** challenge
// The link to reach this is https://dev.to/thepracticaldev/daily-challenge-4-checkbook-balancing-hei
const input = `1233.00
125 Hardware;! 24.8?;
123 Flowers 93.5
127 Meat 120.90
120 Picture 34.00
124 Gasoline 11.00
123 Photos;! 71.4?;