Skip to content

Instantly share code, notes, and snippets.

[CmdletBinding(SupportsShouldProcess)]
param(
# The URL of the Sitecollection where the recycle bin is.
[Parameter(Mandatory)]
[string]
$SiteUrl,
# Full Path of CSV file of Get-AllRecycleBin.ps1
[Parameter(Mandatory)]
[string]
<#
.SYNOPSIS
Loops through the recycle bin and output a csv string.
Uses PNP Powershell.
.EXAMPLE
-URL:'https://<tenant>.sharepoint.com/sites/<siteCollection>' -Stage:First -Path:.\FirstRecycleBin.csv
-URL:'https://<tenant>.sharepoint.com/sites/<siteCollection>' -Stage:First -Path:.\FirstRecycleBin.csv -RowLimit:200000
#>
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
<#
.SYNOPSIS
Set the New Menu on a document library.
.DESCRIPTION
Sets the New Menu on a document libary, allow you to hide content types you don't want to show. This will grab all list content types currently assigned to the library.
Default Content Types used by Microsoft 'Folder', 'Word document', 'Excel workbook', 'PowerPoint presentation', 'OneNote notebook' 'Visio drawing', 'Link'
.EXAMPLE
@pmatthews05
pmatthews05 / Restore-BatchRecycleBin.ps1
Last active July 29, 2022 10:42
Restores items from the recycle bin based on its unique ID, a GUID. Attempts in batches of 10 items, if failure occurs, will attempt to restore the items in the batch indivdually before grabbing next batch.
<#
.SYNOPSIS
Restores items from the recycle bin based on its unique ID, a GUID.
Attempts in batches of 10 items, if failure occurs, will attempt to restore the items in the batch indivdually before grabbing next batch.
- Works in CloudShell
.DESCRIPTION
Prerequistes
- Authentication this should be performed external to the script.
```ps1
@pmatthews05
pmatthews05 / projectJsonString.cs
Last active May 5, 2022 16:38
Uploading Json String to Cosmos DB
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
public class Program
{
public static async Task Main()
{
param(
#OutPut CSV File Path
[Parameter(Mandatory)]
[string]
$Path
)
$InformationPreference = 'Continue'
Write-Information -MessageData "Obtaining Module, please connect when prompted..."
@pmatthews05
pmatthews05 / MSGraphSitePermission.ps1
Created January 12, 2022 16:28
Using AZ CLI and REST commands, a simple way setting the App Registration Selected Site for MS Graph.
function Get-TenantDefaultName {
<#
.SYNOPSIS
Returns the Default and Root Tenant name.
.DESCRIPTION
Returns the Default and Root Tenant name.
.EXAMPLE
export ARM_SUBSCRIPTION="[SUBSCRIPTION_ID]"
export ARM_CLIENT_SECRET="[CLIENT_SECRET]"
export ARM_CLIENT_ID="[CLIENT_ID"
export ARM_TENANT_ID="[TENANT_ID]"
echo $ARM_SUBSCRIPTION
echo $ARM_CLIENT_ID
echo $ARM_CLIENT_SECRET
echo $ARM_TENANT_ID
Write-host "Teams Meeting Policy"
Get-CsOnlineUser -Filter {TeamsMeetingPolicy -eq 'GivenPolicyNameBlankForGlobal'} | Select UserPrincipalName