Skip to content

Instantly share code, notes, and snippets.

joerodgers

Block or report user

Report or block joerodgers

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
@joerodgers
joerodgers / Get-ExtenalUser.ps1
Last active Oct 23, 2019
Gets all External Users Assigned to a SPO/OD4B site in O365
View Get-ExtenalUser.ps1
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12
Import-Module -Name SharePointPnPPowerShellOnline -WarningAction SilentlyContinue
$tenant = "contoso"
$clientId = "8a6b10a8-1234-1234-1234-9b8e49b6f6b7"
$certPath = "E:\AppPrincipalCert.pfx"
$certPassword = ConvertTo-SecureString -String "pass@word1" -AsPlainText -Force
View Get-SuperUserReaderStatus.ps1
function Get-DomainPrincipal
{
[CmdletBinding()]
param
(
[Parameter(Mandatory=$true,ParameterSetName='DistinguishedName')]
[Parameter(Mandatory=$true,ParameterSetName='Name')]
[Parameter(Mandatory=$true,ParameterSetName='SamAccountName')]
@joerodgers
joerodgers / Set-SiteExternalSharingPolicy.ps1
Created Oct 16, 2019
Sets the site level external sharing policy on sites, groups and/or OneDrive sites in an O365 tenant.
View Set-SiteExternalSharingPolicy.ps1
Import-Module SharePointPnPPowerShellOnline
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12
$tenant = "contoso"
$clientId = "8a6b10a8-1234-1234-1234-9b8e49b6f6b7"
$certPath = "C:\AADAppPrincipalCertificates\AppPrincipalCert.pfx"
$certPassword = ConvertTo-SecureString -String "pass@word1" -Force -AsPlainText
@joerodgers
joerodgers / Merge-CSV.ps1
Created Oct 15, 2019
Merges one csv into another csv file
View Merge-CSV.ps1
function Merge-CSV
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)][string]$PrimaryCSVPath,
[parameter(Mandatory=$true)][string]$SecondaryCSVPath,
[parameter(Mandatory=$true)][string]$PrimaryCSVKey,
[parameter(Mandatory=$true)][string]$SecondaryCSVKey
View Get-FileCompressedMetaInfo.ps1
Add-PSSnapin Microsoft.SharePoint.Powershell
function ConvertFrom-HexStringToByteArray
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)][string]$String
)
@joerodgers
joerodgers / Remove-FilesBySize.ps1
Last active Oct 14, 2019
Gets files of a specific size then delete them
View Remove-FilesBySize.ps1
Add-PSSnapin Microsoft.SharePoint.Powershell
function Get-FileOfSize
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)][string]$SiteUrl,
[parameter(Mandatory=$true)][int]$Size
View Reset-SiteToDefaultOfficeTheme.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell
function Remove-ComposedLook
{
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)][string]$Name,
[Parameter(Mandatory=$true)][Microsoft.SharePoint.SPWeb]$Web
@joerodgers
joerodgers / Replace-SPFile.ps1
Created Oct 8, 2019
Downloads a file, deletes it, then uploads the same file with updated properties
View Replace-SPFile.ps1
Add-PSSnapin -Name Microsoft.SharePoint.Powershell
function Get-SPFile
{
[CmdletBinding()]
param
(
[parameter(Mandatory=$true)][string]$FileUrl
)
@joerodgers
joerodgers / Remove-PrincipalsFromSiteCollections.ps1
Created Oct 7, 2019
Removes users and security groups from all sites in the tenant.
View Remove-PrincipalsFromSiteCollections.ps1
Import-Module SharePointPnPPowerShellOnline
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12
$tenant = "contoso"
$clientId = "8a6b10a8-1234-1234-1234-9b8e49b6f6b7"
$clientSecret = "44VRi5r3bbCWoEU/WyEQQ+EMq_U]=jRT"
$certPath = "E:\AppPrincipalCert.pfx"
$certPassword = ConvertTo-SecureString -String "pass@word1" -AsPlainText -Force
@joerodgers
joerodgers / Get-FilesWithMissingEditorAndAuthor.ps1
Created Oct 7, 2019
Get/Set files with missing author and editor properties on files in document libraries
View Get-FilesWithMissingEditorAndAuthor.ps1
Add-PSSnapin Microsoft.SharePoint.PowerShell
function Set-EditorAuthorProperty
{
[cmdletbinding()]
param
(
[Parameter(Mandatory=$true)][string]$FileUrl,
[Parameter(Mandatory=$true)][string]$DefaultAuthor,
[Parameter(Mandatory=$true)][string]$DefaultEditor
You can’t perform that action at this time.