To add your assembly in powershell script / console
Add-Type -AssemblyName System.Web
Copy string to clipboard
"your datas" | c:\windows\system32\clip.exe
Reference sharepoint in powershell console
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Set your execution policy if you see this message
set-executionpolicy -executionpolicy unrestricted
powershell.exe -executionpolicy unrestricted -command .\test.ps1
Sort and filter your collections
$l.Fields | select internalname, title, type, hidden | Where-Object {$_.Hidden -eq $false} | Sort-Object -Property internalname | Format-Table
get spfields by group
$w.Fields | Where-Object {$_.Group -eq "Site colums FDI"} | select internalName, typeasstring
List files in folder and copy to clipboard
$files = ls | select name
$files | c:\windows\system32\clip.exe
Regular expression to check file names
"toto.spx" -match "^[a-zA-Z0-9._ -]+$"
Load an assembly
Import-Module ".\Microsoft.SharePoint.Client.Runtime.dll"
Get logs from all servers on sharepoint farm
Merge-SPLogFile -Path "C:\temp\FarmMergedLog41.log" -Overwrite -Level Unexpected -StartTime (Get-Date).AddMinutes(-20)
Merge-SPLogFile -Path "C:\temp\FarmMergedLog22.log" -Overwrite -Correlation "52b2019e-d446-70aa-8f27-8efc5ec7f143" -StartTime (Get-Date).AddMinutes(-90)
Open a powershell console as another account
Start-Process powershell.exe -Credential "domain\spadmin" -NoNewWindow -ArgumentList "Start-Process powershell.exe -Verb runAs"
Export webpart from page
Create a site collection
New-SPSite -Template STS#0 -OwnerAlias fdi\spdev -Url http://fdi-sp2013-1/sites/test6541 -Verbose -Confirm:$false -Language 1036 -Name test987 -Description oio
Do not use jquery $(document).ready(function () {
Use instead :
_spBodyOnLoadFunctionNames.push("loadAnnonce");//loadAnnonce is function loadAnnonce() called
Edit page on url change
?ControlMode=Edit&DisplayMode=Design
List assemblies
[AppDomain]::CurrentDomain.GetAssemblies() | Where-Object {$_.Location -ne $null -and $_.Location -like "*t.Client.*"}
Use stringBuilder to mange string concat
$stringBuilder = New-Object System.Text.StringBuilder
List of all sharepoint features