Friday, April 8, 2016

What is "DevOps" anyway?

When I first time saw the word "DevOps", I thought it's quite straightforward: a system administrator with software development skill. That's why it is called "DevOps", not "OpsDev", isn't it?

No. Based on wikipedia, it's the opposite.

It seems that the "DevOps" concept is created purely for software development improvements.

All right. Then what should we call it as "a system administrator with software development skill"? Don't know. And unfortunately, I am one of that kind of guys.

:-)


( This post is inspired by Managed services killed DevOps )

Wednesday, February 17, 2016

How to generate new Visual Studio Solution from existing solution?

Most of posts on Internet suggest to create a new solution and feature in Visual Studio, then copy/attach the files to the new project. (such as this one)

I find another opotion.

After copying the whole Visual Studio solution/project to new folder, there are 4 parts we need to replace.

1. DLL new key
2. Solution ID
3. Feature ID
4. Change the Solution name, Feature name, Assembly name (and webpart / workflow action name if needed).

The first two steps are easy. Open the project in Visual Studio, then do the change straight away.

But the third step is tricky: we cannot just go to "Feature Designer" and replace the GUID in "Feature Id" property.  This ID is used in 7 different places and we cannot change them all in Visual Studio.

I did that through the famous freeware "Notepad++", go to "Search", then "Find in Files"



Below is the search result after clicking "Find All" button.  We can click "Replace in Files" button to replace all old Feature Id with new GUID.



Step 4 is similar to step 3.

That's it.

Now we can compile and publish the new solution file (.wsp) in Visual Studio, and then deploy it SharePoint.

PS:

To use new solution and feature to replace old solution and feature in farm, don't forget to uninstall the old feature and solution first, if you don't want to change the solution name or feature name.

Below is the PowerShell script.

Get-SPSite -Limit ALL | ForEach-Object {Disable-SPFeature -identity "FeatureName" -URL $_.URL -confirm:$false -ErrorAction SilentlyContinue}

Get-SPFeature | ?{$_.DisplayName -eq "FeatureName"} | Uninstall-SPFeature -confirm:$false -force

Get-SPSolution | ?{$_.DisplayName -like "SolutionName"} | Remove-SPSolution -confirm:$false -force

You can go to SharePoint system folder "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions" on all SharePoint servers, then search for the feature name, to confirm the feature is removed from farm completely.

Friday, February 12, 2016

Error: "WorkflowServiceStore is not a Farm Level Feature and is not found in a Site level defined by the Url"

When I saw the classic message "SharePoint 2013 Workflow platform is not available" in SharePoint 2013 Designer, I thought it's easy to fix.

1. Confirm Workflow Manager Client is installed on all SharePoint servers.
2. Register workflow service for the farm.
3. Enable "WorkflowServiceStore" feature on the site.

However, the script "Enable-SPFeature -Identity WorkflowServiceStore -url $webUrl -Force" throw out the error message below:

Enable-SPFeature : The Feature is not a Farm Level Feature and is not found in a Site level defined by the Url $webUrl.
At line:1 char:1
+ Enable-SPFeature -Identity WorkflowServiceStore -url $webUrl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Share...etEnableFeature:
   SPCmdletEnableFeature) [Enable-SPFeature], SPCmdletException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature

After 30 minutes struggling, finally I realized that the site was still in "SharePoint 2010 mode", so the SPWeb level feature "WorkflowServiceStore" doesn't exist!

The error is quite obvious, but, I wish SharePoint 2013 Designer could provide more informative message  :-(

Wednesday, February 3, 2016

Let's remove all the grasses and shrubs, and only leave trees there

So, the free SharePoint Foundation Server is removed from SharePoint Server 2016.

That reminds me of an old story: a king hates all the bugs, worms and snakes, so he ordered his soldiers to remove all grasses and shrubs in the forest. "Anyway, we only need wood, right?"

What happened to the forest in the end?!

[update, 2016-02-17]

There are so many free alternatives. If Microsoft doesn't provide the free SharePoint Foundation Server, potential users will choose those platforms. Then, eventually, SharePoint will get less and less developers, administrators and users. So, its competitors will get bigger and bigger market share!

Thursday, January 28, 2016

Failed to call GetTypes on assembly Microsoft.AnalysisServices.SPAddin

After installing SharePoint 2013 CU 201601, the User Profile Sync service stopped working.   After two days of struggling, it seems the best solution is to reinstall SharePoint.

That's fine. The whole lab farm only have two servers.

I uninstalled SharePoint 2013 components on those two servers, then deleted all databases and IIS web folders. Then start to reinstall SharePoint.

Everything is fine, until I tried to join the second server to the newly created farm. An error message popped up: "Failed to call GetTypes on assembly Microsoft.AnalysisServices.SPAddin"

This is strange, as I am pretty sure that PowerPivot was uninstalled. I am not the only one who ever got this problem. It seems the easiest way is to install PowerPivot add-on on all servers.

However, I prefer not to create a clean OOTB SharePoint farm.

It turns out quite easy to fix this problem: search for "Microsoft.AnalysisServices.SPAddin" on hard disk on all servers, and then delete all relevant folders and files. Then reboot the servers.

All the files and folders are in "C:\Windows\Microsoft.NET\assembly" or "C:\Program Files\Common Files\microsoft shared\Web Server Extensions".

Thursday, November 19, 2015

How to get site relative URL through PowerShell, for SPWeb?

It's easy to get server relative URL through "ServerRelativeUrl" property, for SPWeb. But how to get the site relative URL?

Below is how I get it.

$SPSiteServerRelativeUrl = $site.ServerRelativeUrl
$SPWebServerRelativeUrl = $web.ServerRelativeUrl
$SPWebSiteRelativeUrl = ""
if ($web.IsRootWeb -eq $false)
{
$SPWebSiteRelativeUrl = $SPWebServerRelativeUrl.Replace($SPSiteServerRelativeUrl + "/", "")
}
Write-Host "SPWebSiteRelativeUrl=$SPWebSiteRelativeUrl" -f DarkYellow

Monday, October 26, 2015

PowerShell color variable

I'd like to standardize the colors in my PowerShell script outputs.  So I need something like "WarningColor", "ErrorColor", "DebuggingColor", etc.

It turns out quite easy.  Below is an example.

$DebuggingColor = [System.ConsoleColor]::DarkGreen
$HighlightColor = [System.ConsoleColor]::Green
$WarningColor = [System.ConsoleColor]::Yellow
$ErrorColor = [System.ConsoleColor]::Red

Write-Host "hello world" -f $DebuggingColor


Reference:

https://leftlobed.wordpress.com/2008/05/31/setting-powershell-console-color-when-running-elevated/