Monday, July 7, 2014

Security Token Service is down or showing errors?



Some examples of errors that may show up in your ULS log.


Run the following commands, it will do a new provisioning of the Security Token Service.

$h = Get-SPServiceHostconfig
$h.Provision()
$services = Get-SPServiceApplication
foreach ($service in $services) { $service.provision();
write-host $service.name}


Perform an IIS Reset and try to browse the STS, http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc

Thursday, June 5, 2014

Set user default regional settings from website default

$spweb = Get-SPWeb http://yourURL.com
$user = get-spuser -Web $spweb -Identity "DOMAIN\USER"
$reg = $user.RegionalSettings
$newReg = new-object Microsoft.SharePoint.SPRegionalSettings($spweb);
$user.RegionalSettings = $newReg;
$user.Update();

Wednesday, June 4, 2014

Powershell script activate developer dashboard on demand in your Sharepoint 2013 environment

$svc = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dds = $svc.DeveloperDashboardSettings
$dds.DisplayLevel = "OnDemand"
$dds.TraceEnabled = $true;
$dds.Update()

Monday, April 7, 2014

Add list column to list contenttype

$web = Get-SPWeb -Identity "URL to your site"
$list = $web.Lists["List name"]
$ct = $list.ContentTypes["Contenttype Name"]
$field = $list.Fields["Field Name"]
#$field = $list.Fields[{GUID}]
$fieldLink=New-Object Microsoft.SharePoint.SPFieldLink($field)
$ct.FieldLinks.Add($fieldLink);
$ct.Update()
$web.Dispose()