Skip to content

Instantly share code, notes, and snippets.

View ryanshripat's full-sized avatar

Ryan Shripat ryanshripat

View GitHub Profile
@ryanshripat
ryanshripat / AddCustomColumnsToView.ps1
Last active December 12, 2017 15:59
Modifies the view of a SharePoint Online list
#Add-PSSnapin "Microsoft.SharePoint.PowerShell"
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")
$siteUrl = Read-Host -Prompt "Enter Site URL"
$username = Read-Host -Prompt "Enter username"
$password = Read-Host -Prompt "Enter password" -AsSecureString
$listTitle = Read-Host -Prompt "Enter List Title"
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials
@ryanshripat
ryanshripat / ListSharePointSideLoadedAppExpiryDates.ps1
Last active September 27, 2017 11:48
This script lists the expiry dates of apps sideloaded onto an O365 SharePoint site, given the app name. Modified based on a script from https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in to accept the name of a particular app and formatted a little more clearly.
#This script lists the expiry dates of apps sideloaded onto an O365 SharePoint site, given the app name.
#Modified based on a script from https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in
#to accept the name of a particular app and formatted a little more clearly. Prerequisites for running this app are listed at the link above.
Clear-Host
Connect-MsolService
$appName = Read-Host 'Partial name of your app?'
$applist = Get-MsolServicePrincipal -all |Where-Object -FilterScript { ($_.DisplayName -like "*$appName*") -and ($_.DisplayName -notlike "*Microsoft*") -and ($_.DisplayName -notlike "autohost*") -and ($_.ServicePrincipalNames -notlike "*localhost*") }
foreach ($appentry in $applist)
{
@ryanshripat
ryanshripat / CompareAzurePortalApplicationSettings.ps1
Last active September 27, 2018 13:13
Powershell script to compare the Azure Portal Application Settings in one site to those of another
Clear-Host
Login-AzureRmAccount #Only necessary once per session
$SOURCE_SUBSCRIPTION_NAME = "YOUR SOURCE SUBSCRIPTION NAME"
$SOURCE_SITE = "YOUR SOURCE SITE NAME (xxxx in xxxx.azurewebsites.net)"
$TARGET_SUBSCRIPTION_NAME = "YOUR TARGET SUBSCRIPTION NAME"
$TARGET_SITE = "YOUR TARGET SITE NAME (xxxx in xxxx.azurewebsites.net)"
function GetSortedApplicationSettings ([string] $subscriptionName, [string] $siteName)
{
(Get-AzureRmSubscription -SubscriptionName $subscriptionName | Select-AzureRmSubscription) > $null