Archive for October, 2013

October 27, 2013

SQL Server Client Network Utitily

If you are working with a number of SQL Server instances or have really complex server/instance names, its good to use aliases with easy naming conventions. The same can be used to connect to SQL Server instancess. For you to create these aliases you can use the SQL Server Client Network utitily programs (cliconfg). Aliases would secure the real instance names of the SQL Server in any case if its exploited by an external hacker.

cliconfg

Launch “cliconfg” by Start > Run > CliConfg. Then go to Alias tab and click the add button to add the alias.

October 27, 2013

AppFabric installation failed because installed MSI returned with error code: 1603

I was getting the below error at the time of running the pre-requistes for a fresh installation of Sharepoint 2013 and SQL Server 2012. Rest of the prerequisites are getting installed without any problem but only the app fabric instllation getting failed. When i check the logs (AppServerSetup1_1_CustomActions(2013-10-27 11-09-45).log) located under path C:\Users\<username>\AppData\Local\Temp and was able to find the below:

27/10/2013 10:38:47 EXEPATH=powershell.exe PARAMS=-command “$content = Get-Content \”c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\”; $content = ForEach-Object -InputObject $content { $_ -replace \”INSTALLPATH\”, \”c:\Program Files\AppFabric 1.1 for Windows Server\\\” }; Set-Content -value $content -path \”c:\Program Files\AppFabric 1.1 for Windows Server\\AppFabricServer.xml\” ” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
ExitCode=0
27/10/2013 10:38:48 EXEPATH=powershell.exe PARAMS=-command “$content = Get-Content \”c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\”; $content = ForEach-Object -InputObject $content { $_ -replace \”INSTALLPATH\”, \”c:\Program Files\AppFabric 1.1 for Windows Server\\\” }; Set-Content -value $content -path \”c:\Program Files\AppFabric 1.1 for Windows Server\\Consolidator.xml\” ” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.SQMTaskInstallAction
SQMTaskInstall areguments –  /create /tn “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” /xml “c:\Program Files\AppFabric 1.1 for Windows Server\Consolidator.xml”
Output: SUCCESS: The scheduled task “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” has successfully been created.
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\sc.exe PARAMS=privs AppFabricCachingService SeChangeNotifyPrivilege LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: [SC] ChangeServiceConfig2 SUCCESS
ExitCode=0
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\sc.exe PARAMS=sidtype AppFabricCachingService unrestricted LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: [SC] ChangeServiceConfig2 SUCCESS
ExitCode=0
27/10/2013 10:38:50 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall add rule enable=no profile=any dir=in action=allow description=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-203″ name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-202″ protocol=TCP program=”c:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Ok.
ExitCode=0
27/10/2013 10:38:51 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall add rule enable=no profile=any dir=out action=allow description=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-207″ name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-206″ protocol=TCP program=”c:\Program Files\AppFabric 1.1 for Windows Server\DistributedCacheService.exe” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Ok.
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.FirewallExceptionAction
27/10/2013 10:38:51 EXEPATH=powershell.exe PARAMS=-command “$str = [System.Environment]::GetEnvironmentVariable(\”PSModulePath\”, [System.EnvironmentVariableTarget]::Machine); $str = $str+\”;c:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules\”; c:\Windows\system32\setx.exe /M PSModulePath \”$str\”” LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Error: ERROR: Invalid syntax. Default option is not allowed more than ‘2’ time(s).
Error: Type “SETX /?” for usage.
ExitCode=1
27/10/2013 10:38:54 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall delete rule name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-206″ LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Deleted 1 rule(s).
Output: Ok.
ExitCode=0
27/10/2013 10:38:54 EXEPATH=c:\Windows\system32\\netsh.exe PARAMS=advfirewall firewall delete rule name=”@c:\Program Files\AppFabric 1.1 for Windows Server\ApplicationServerResources.dll,-202″ LOGFILE=C:\Users\mssadmin\AppData\Local\Temp\AppServerSetup1_1_CustomActions(2013-10-27 10-38-40).log
Output: Deleted 1 rule(s).
Output: Ok.
ExitCode=0
Executing action : Microsoft.ApplicationServer.InstallHelper.SQMTaskUninstallAction
Output: SUCCESS: The scheduled task “\Microsoft\Windows\AppFabric\Customer Experience Improvement Program\Consolidator” was successfully deleted.

based on the above error log could notice that ” is getting amended to the PSModulePath path. So for this what you have to do is to remove that ” from the PSModulePath enviornmentabl variable.

envvvariable

references:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/8cf55972-e441-4107-8c0d-1692ad03213d/error-with-installation-of-appfabric-11-on-psmodulepath?forum=velocity

http://social.msdn.microsoft.com/Forums/sharepoint/ja-JP/290ff740-d8f1-426c-b7f0-1152dc481779/appfabric-installation-failed-because-installer-msi-returned-with-error-code-1603?forum=sharepointgeneralprevious

http://social.msdn.microsoft.com/Forums/vstudio/en-US/8338a53e-6b4f-44a8-ac7b-a287f3b4b20e/installation-problem-msi-error-1603-win-7-x64-appfabric-11?forum=velocity

http://support.microsoft.com/kb/310519/en-us

October 9, 2013

Activating and Deactivating Features using PowerShell

Installing a feature:

Install-SPFeature FeatureFolderName

To activate a feature:

Enable-SPFeature FeatureFolderName -Url http://server/site/

To deactivate a feature:

Disable-SPFeature FeatureFolderName -Url http://server/site/

To uninstall a feature:

Uninstall-SPFeature FeatureFolderName
October 4, 2013

Hiding the ribbon – SharePoint 2013

Add the following code to hide the ribbon in Share Point 2013.

<SharePoint:SPSecurityTrimmedControl PermissionsString="FullMask" runat="server">
<div id="ms-designer-ribbon">
<!--SID:02 {Ribbon}-->
<!--PS: Start of READ-ONLY PREVIEW (do not modify) --><div class="DefaultContentBlock" style="background:rgb(0, 114, 198); color:white; width:100%; padding:8px; height:64px; overflow:hidden;">
In true previews of your site, the SharePoint ribbon will be
here.</div><!--PE: End of READ-ONLY PREVIEW -->
</div>
</SharePoint:SPSecurityTrimmedControl> 

Once you apply the above code snippet the vertical bar would be get hidden.  For you to get the ribbon back, you have to over ride the style attribute of the body, so for that add the attribute to the style=”overflow: scroll !important” to the BODY element of your master page. Once you apply the same you will get the vertical scroll bar back. The reason behind this is that the master pages have a link to corev15.css. This stylesheet sets overflow to hidden for the BODY element, which removes the scroll bar.

more about the SPSecurityTrimmedControl you can find it in the below link : http://msdn.microsoft.com/en-us/library/jj822366.aspx

October 1, 2013

Restore-SPSite : 0x80070003

I was restoring a SharePoint site from a lab environment to Production.  This is one of the frequently used powershell commands that we use in addition to the Backup-SPSite.

Restore-SPSite http://ggvstg01:12160/discussionforum/GeneralDiscussi

-Path C:\Users\user\Desktop\Backup\GeneralDiscussion.bak –Force

Come on man, was worried to see the below error.

**Restore-SPSite : 
<nativehr>0x80070003</nativehr>
<nativestack></nativestack>
At line:1 char:1
2

So started to search on this error hence this is the first time I saw this error. Some posts says its related to managed path issue, advice us to check the managed path in both the environments. I checked, so in my case its nothing to do with the managed paths Hence the site had only one root site collection. In some post it says the SharePoint versions are different. I thought this might be correct hence in my lab environment it was the SharePoint enterprise version with the trial license. But in production it was the SharePoint Enterprise. Suddenly I thought of checking the SharePoint logs and the event viewer. I couldn’t see any specific error in the Share Point logs. Then moved to check on the Event Viewer. Ohhhh man, it was something related to the login which I used to execute the power shell command “insufficient SQL Database permission for user named domainaame\username”.

3

Finally logged into the SQL Server and applied the above said user the “sysadmin”permission and executed the restore command without any issue. 😀