Tuesday, March 7, 2017

SPDesigner cache clearing

rmdir "%LOCALAPPDATA%\Microsoft\WebsiteCache\" /s /q
rmdir "%APPDATA%\Microsoft\SharePoint Designer\ProxyAssemblyCache\" /s /q

Tuesday, February 28, 2017

PowerShell snippets for SharePoint branders

1. Change Master Page for all sites in the collection



# ----- For publishing sites and non publishing sites
$site = Get-SPSite http://intranet
foreach ($web in $site.AllWebs) {
$web; $web.CustomMasterUrl = "/_catalogs/masterpage/V4.master";
$web.Update(); $web.CustomMasterUrl;
$web.Dispose()
}
foreach ($web in $site.AllWebs) {
$web; $web.MasterUrl = "/_catalogs/masterpage/v4.master";
$web.Update(); $web.MasterUrl;
$web.Dispose()
}
$site.Dispose()
write-host "Complete! V4.master is now applied";


2. Set alternate CSS

$web = Get-SPWeb http://intranet
$web.AlternateCssUrl = "/Style Library/main.css"
$web.AllProperties["__InheritsAlternateCssUrl"] = $True
$web.Update()
3. Set a site logo



(get-spsite http://intranet).AllWebs | foreach {
$_.SiteLogoUrl = "/Style%20Library/ClientLogo.png";


4. Set regional setting/locale

$site = Get-SPSite http://intranet
foreach ($web in $site.AllWebs) {
$web; $web.Locale = 1053;
$web.Update(); $web.Locale;
$web.Dispose()
}
$site.Dispose()


5. Set a theme

$SiteUrl = "http://peakfinders/"
$NewTheme = "Azure"
# Loading Microsoft.SharePoint.PowerShell
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
Write-Host "Loading SharePoint Powershell Snapin"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
# Setting site themes on sites and sub sites
$SPSite = Get-SPSite | Where-Object {$_.Url -eq $SiteUrl}
if($SPSite -ne $null)
{
$themes = [Microsoft.SharePoint.Utilities.ThmxTheme]::GetManagedThemes($SiteUrl);
foreach ($theme in $themes)
{
if ($theme.Name -eq $NewTheme)
{
break;
}
}
foreach ($SPWeb in $SPSite.AllWebs)
{
$theme.ApplyTo($SPWeb, $true);
Write-Host "Set" $NewTheme "at :" $SPWeb.Title "(" $SPWeb.Url ")"
}
}
Write-Host "Themes updated at:" $SPSite.Url -foregroundcolor Green

Uninstal workflow manager 2013

Resolution:
We executed the following steps to resolve the issue. 
  1. Deleted the following registry hives: 
HKLM\Software\Microsoft\Workflow Manager
HKLM\Software\Microsoft\Service Bus
        2.  Deleted the following databases:
SbGatewayDatabase
SbManagementDB
SBMessageContainer01
WFManagementDB
WFResourceManagementDB
WFInstanceManagementDB
       3.  Uninstalled CU1 for Workflow Manager 1.0 and CU1 for Service Bus 1.0 from Control Panel
       4.  Uninstalled Workflow Manager 1.0, Workflow Manager Client 1.0, Service Bus 1.0 and Windows Fabric in the order mentioned (Refer: http://technet.microsoft.com/en-us/library/jj193489.aspx)

       5.  Rebooted the machine hosting WFM 1.0

Monday, February 27, 2017

Timer Jobs latest changes not updating

To clear timer job cache –
Follow below steps when SharePoint 2010 timer job not updating to latest changes:
– Deploy newly updated WSP of timer job
– Stop SharePoint Timer Service
– Go to SharePoint server location –                                                                            “C:\Users\All users\Microsoft\SharePoint\Config\” 
– Backup Cache.ini
– Delete all xml files from GUID folder (GUID – this folder contains xml files with cache.ini)
– Edit Cache.ini and write 1 only
– Restart SharePoint Timer service
– XML files will create automatically
– Timer Job cache is cleared. Continue to test timer job changes

PowerShell - Event Receivers on SharePoint List


There are times when you want to check which event receivers are attached to a SharePoint list.   This can be easily achieved through use of a PowerShell script.
$spWeb = Get-SPWeb Identity http://sharepoint
$spList = $spWeb.Lists["My List"
$spList.EventReceivers | Select Name, Assembly, Type
There are also times when you might want to remove any event receivers from the list
$spWeb = Get-SPWeb Identity http://sharepoint
$spList = $spWeb.Lists["My List"
$spList.EventReceivers | Select Name, Assembly, Type

$eventsCount = $spList.EventReceivers.Count

for ($i = $eventsCount-1; $i -ge 0; $i--)
{
    $spList.EventReceivers[$i].Delete()
}

$spList.Update()