Skip to content

Instantly share code, notes, and snippets.

Antonio Leonardo antonio-leonardo

Block or report user

Report or block antonio-leonardo

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
antonio-leonardo / Shp.RedefineMasterPage.ps1
Created Jul 18, 2019
Redefine Site Master Page to Seattle (the original SharePoint MasterPage)
View Shp.RedefineMasterPage.ps1
##Script para redefinir master page
Add-PSSnapin Microsoft.SharePoint.PowerShell
# get site collection
$site = Get-SPSite http://sharepoint-sitecollection
# get site in site collection
$web = Get-SPWeb http://sharepoint-subsite
antonio-leonardo / Shp.DeleteShpCorruptedList.ps1
Created Jul 18, 2019
Delete a corrupted SharePoint list
View Shp.DeleteShpCorruptedList.ps1
##Script para Deletar Listas corrompidas
Add-PSSnapin Microsoft.SharePoint.PowerShell
#Get the Web
$web = Get-SPWeb "<SharePoint-site-URL>"
#Get the corrupted List
$list = $web.lists["corrupted list name"]
#Set the AllowDeletion Flag to True
$list.AllowDeletion = $true
antonio-leonardo / MsSql.GetAllForeignKeysConstraintsOfTable.sql
Last active Jul 18, 2019
Two sql statements to get all Foreign Keys from Table
View MsSql.GetAllForeignKeysConstraintsOfTable.sql
SET @TABLE_NAME = 'TableName'
SELECT constraint_name
,OBJECT_NAME(f.parent_object_id) referencing_table_name
,COL_NAME(fc.parent_object_id, fc.parent_column_id) referencing_column_name
,OBJECT_NAME (f.referenced_object_id) referenced_table_name
antonio-leonardo / Shp.EmergencySPManagedAccountUpdate.ps1
Last active Nov 29, 2019
Update SharePoint Managed Account Password on all Farm Layers: IIS, Windows Services and SharePoint Services. The full article with the prerequisites to execute this script at this URL: or…
View Shp.EmergencySPManagedAccountUpdate.ps1
#Author: Antonio Leonardo de Abreu Freire, Microsoft Certified ID: 13271836
Set-Executionpolicy -Scope CurrentUser -ExecutionPolicy UnRestricted
Import-Module WebAdministration
$serviceAccount = Read-Host -Prompt "Please enter the user (in DOMAIN\username format)."
$securePass = Read-Host "Now, what is this user's password? Please enter (this field will be encrypted)." -AsSecureString
$plainTextPass = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePass))
$applicationPools = Get-ChildItem IIS:\AppPools | where { $_.processModel.userName -eq $serviceAccount }
foreach($pool in $applicationPools)
antonio-leonardo / CSharp.StringProcessment.cs
Last active Jul 18, 2019
C# Extension class that constains several roles to manipulate strings and chars
View CSharp.StringProcessment.cs
//Author: Antonio Leonardo de Abreu Freire, Microsoft Certified ID: 13271836
using System;
using System.Web;
using System.Linq;
using System.Collections.Generic;
namespace ExtensionFunctions
/// <summary>
antonio-leonardo / MsSql.ShrinkerCursor.sql
Last active Jul 18, 2019
Sql Server: Cursor that automate shrink all logs
View MsSql.ShrinkerCursor.sql
,@LogicalLogFile SYSNAME
DECLARE clear_logs_cursor CURSOR FOR
SELECT name FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb');
You can’t perform that action at this time.