View Get-GroupsTeamsExample.ps1
Connect-PnPOnline -ClientId c53eb8da-8bdf-44f9-8718-1fb1bbbbbb ` | |
-Thumbprint EC1E61510AEC35624AF78FEA763D00000000 ` | |
-Tenant "tenant.co.uk" -Url "https://tenant.sharepoint.com" | |
$token = Get-PnPGraphAccessToken | |
# Create header with the access token | |
$header = @{ Authorization = "Bearer $($token)" } | |
#v1.0/Beta |
View Register-AzureApp.ps1
Initialize-PnPPowerShellAuthentication -ApplicationName CaPa.Reporting ` | |
-Tenant "tenant.co.uk" -Store CurrentUser -ValidYears 2 ` | |
-CertificatePassword (ConvertTo-SecureString -String "password" -AsPlainText -Force) | |
# Output Example from PS: | |
# | |
# AzureAppId Certificate Thumbprint | |
# ---------- ---------------------- | |
# c53eb8da-8bdf-44f9-8718-1fb1bbbbbb EC1E61510AEC35624AF78FEA763D00000000 | |
# |
View set-uk-locale-runbook.ps1
[CmdletBinding()] | |
Param | |
( | |
[string]$SiteUrl | |
) | |
# Refer to https://github.com/pnp/PnP-PowerShell/tree/master/Samples/Connect.AzureAutomation | |
# for setting up Azure Automation using an App Only connection to SharePoint Online | |
# Retrieves from the Azure Automation variables and certificate stores |
View Apply-UKLocaleTemplate.ps1
Connect-PnPOnline https://tenant.sharepoint.com/sites/yoursite | |
Apply-PnPProvisioningTemplate -Path "UK-Locale-Example-Provisioning-Template.xml" |
View Set-UKLocale.ps1
Connect-PnPOnline https://tenant.sharepoint.com/sites/yoursite | |
$LocaleId = 2057 # UK | |
$TimeZoneId = 2 # London | |
$web = Get-PnPWeb -Includes RegionalSettings,RegionalSettings.TimeZones | |
$timeZone = $web.RegionalSettings.TimeZones | Where-Object {$_.Id -eq $TimeZoneId} | |
$web.RegionalSettings.LocaleId = $LocaleId | |
$web.RegionalSettings.TimeZone = $timeZone | |
$web.Update() | |
Invoke-PnPQuery |
View uk-locale-site-script.json
{ | |
"$schema": "schema.json", | |
"actions": [ | |
{ | |
"verb": "setRegionalSettings", | |
"timeZone":2, | |
"locale":2057, | |
"sortOrder":25, | |
"hourFormat":"24" |
View install-ps.sh
################################### | |
# Prerequisites | |
# Update package lists | |
sudo apt-get update | |
# Install libunwind8 and libssl1.0 | |
# Regex is used to ensure that we do not install libssl1.0-dev, as it is a variant that is not required | |
sudo apt-get install '^libssl1.0.[0-9]$' libunwind8 -y |
View install-dotnet-raspberrypi.sh
wget https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh | |
chmod +x dotnet-install.sh | |
# Ignore warnings | |
./dotnet-install.sh --channel LTS --architecture arm --install-dir ~/cli | |
# Allows running dotnet anywhere - thanks to | |
# this article https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4 | |
sudo nano .profile | |
export DOTNET_ROOT=$HOME/cli |
View Setup-AzureADApp.ps1
$Tenant = "yourtenant.onmicrosoft.com" | |
$AppName = "PnP-PowerShell Automation Example", | |
$CertificatePassword = "1234", # <-- Use a better one than this, nice a super complex | |
$ValidForYears = 2, | |
$CertCommonName = "PnP-PowerShell Automation Example", | |
$location = Get-Location # Get the location of the script to copy the script locally | |
Initialize-PnPPowerShellAuthentication -ApplicationName $AppName -Tenant $Tenant -OutPath $location ` | |
-CertificatePassword (ConvertTo-SecureString -String $CertificatePassword -AsPlainText -Force) -ValidYears $ValidForYears ` | |
-CommonName $CertCommonName |
View Get-GraphCalls.ps1
Connect-PnPOnline -ClientId "<AppId>" -CertificatePath "<C:\...\Cert\cerificate.pfx>" ` | |
-CertificatePassword (ConvertTo-SecureString -AsPlainText "<pw>" -Force) ` | |
-Url "https://<tenant>.sharepoint.com/sites/TheCoolTeam" -Tenant "<id>" | |
$token = Get-PnPGraphAccessToken | |
# Create header | |
$header = @{ | |
Authorization = "Bearer $($token)" | |
} |
NewerOlder