Skip to content

Instantly share code, notes, and snippets.

View estruyf's full-sized avatar
:octocat:
Front Matter

Elio Struyf estruyf

:octocat:
Front Matter
View GitHub Profile
/* Long Version */
$(".list li").sort(asc_sort).appendTo('.list');
// ascending sort
function asc_sort(a, b){
return ($(b).text().toUpperCase()) < ($(a).text().toUpperCase()) ? 1 : -1;
}
// descending sort
function desc_sort(a, b){
$farm = Get-SPFarm
$solution = $farm.Solutions.Item("YourSolution.wsp").SolutionFile
$solution.SaveAs("c:\temp\YourSolution.wsp")
$site = Get-SPSite -Identity "http://YourSiteCollectionUrl"
# Retrieve used SharePoint groups
$groupsInUse = $site.AllWebs | % {$_.RoleAssignments | Select-Object Member}
$groupsInUse = $groupsInUse | % {$_.member.Tostring()}
$groupsInUse = $groupsInUse | Sort-Object | Get-Unique
$groupsInUse = $groupsInUse | ? {$_ -notmatch '\\' -and !$_.ToString().StartsWith('c:0(.s|') }
# Retrieve all SharePoint groups
$allGroups = $site.RootWeb.SiteGroups | Select-Object name
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword
$site = Get-SPSite -Identity "http://YourSiteCollectionUrl"
try {
$site | Get-SPWeb -limit all | ForEach-Object {
$_.CustomMasterUrl = $site.RootWeb.CustomMasterUrl
$_.AllProperties["__InheritsCustomMasterUrl"] = "True"
$_.MasterUrl = $site.RootWeb.MasterUrl
$_.AllProperties["__InheritsMasterUrl"] = "True"
$_.AlternateCssUrl = $site.RootWeb.AlternateCssUrl
$_.AllProperties["__InheritsAlternateCssUrl"] = "True"
cls
Write-Host "Loading SharePoint Commandlets"
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Write-Host -ForegroundColor Green " Commandlets Loaded ..."
Write-Host
## Global Functions
function Get-ScriptDirectory {
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path