This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 3.0 | |
function Invoke-NonQuery | |
{ | |
[cmdletbinding()] | |
param( | |
[Parameter(Mandatory=$true)][string]$DatabaseName, | |
[Parameter(Mandatory=$true)][string]$DatabaseServer, | |
[Parameter(Mandatory=$true)][string]$Query, | |
[int]$CommandTimeout=30 # The default is 30 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.Online.SharePoint.Client.Tenant.dll" | |
$tenantAdminUrl = "https://contoso-admin.sharepoint.com" | |
$tenantAdminUsername = "[email protected]" | |
$securePassword = ConvertTo-SecureString 'pass@word1' -AsPlainText -Force | |
$script:PropertyName = "contoso_SiteDataClassification" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 4.0 | |
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction Stop | |
$serverNames = Get-SPServer | ? { $_.Role -ne "Invalid" } | % { $_.Address } | |
workflow Repair-ConfigCache | |
{ | |
param | |
( | |
[parameter(Mandatory=$true)][string[]]$ComputerNames, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pattern = "Get-SPSite" | |
$path = "C:\_scripts\SharePoint\OnPrem" | |
$files = Get-ChildItem -Path $path -Recurse -Include "*.ps1", "*.psm1" | |
$scanned = @() | |
foreach( $file in $files ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell | |
# prevent issues with the SharePoint API certificate validation procedures (must be after loading sharepoint snapin) | |
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} | |
function Add-FormsAuthRequestHeader | |
{ | |
param | |
( | |
[Parameter(Mandatory=$true)][Object]$ClientContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM | |
Add-Type -Path "C:\O365_CSOM\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "C:\O365_CSOM\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll" | |
$credential = Get-Credential -Message "SharePoint Online Site Administrator" | |
$context = New-Object Microsoft.SharePoint.Client.ClientContext( "https://contoso.sharepoint.com/sites/teamsite" ) | |
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($credential.UserName, $credential.Password) | |
$context.Load($context.Site.RootWeb.AllProperties) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Office365UrlandIPAddressUpdates | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$false)][int]$Days = -7 | |
) | |
begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$site = "https://contoso.sharepoint.com/sites/publishing-site" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.dll" | |
Add-Type -Path "C:\Microsoft.SharePointOnline.CSOM.16.1.6008.1200\lib\net45\Microsoft.SharePoint.Client.Runtime.dll" | |
function Get-HtmlDesignFeatureProperties | |
{ | |
[cmdletbinding()] | |
param |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$results = @() | |
Get-SPSite -Limit All | ? { -not $_.IsReadLocked } | Get-SPWeb -Limit All | ? { -not $_.IsAppWeb } | % { | |
if( $_.webTemplate -ne "STS" -and $_.WebTemplate -ne "SPSPERS" ) | |
{ | |
$totalItemCount = 0 | |
# total the item counts in all the visible lists | |
$_.Lists | ? { -not $_.Hidden } | % { $totalItemCount += $_.ItemCount } |
NewerOlder