About Me

My photo
a Dynamic and Energetic guy.....

Saturday, December 14, 2013

Configure Office Web Apps For SharePoint 2013

The best Tech-Net article that I ever Read,
http://technet.microsoft.com/en-us/library/ff431687.aspx


The only thing is, we have to wait few minutes after each configuration change that we doing using Power-Shell command.

Tuesday, December 10, 2013

Schedule Task for SharePoint Site Backup

1) Open notepad
2) Create a command using STSADM
3) Set the path to store BACKUP
4) Go to TASK SCHEDULEr in server
5) Set the Schedule and account with elevated priviledges

6) Verify the backup and the location

COMMAND

@echo off
echo ===============================================================
echo Back up the farm to E:\CSKH_Backups
echo ===============================================================
cd %COMMONPROGRAMFILES%\Microsoft Shared\web server extensions\15\BIN
@echo off
stsadm.exe -o backup -url http://myportal -filename \\NASFSVS\KMSadmin_share\portalSP%date:~-2%%date:~4,2%%date:~7,2%.bak -overwrite -nositelock
echo completed

*** One Important Thing when creating TASK

How the file name set:
portalSP%date:~-2%%date:~3,2%%date:~0,2%.bak
if date is 29 - 09  - 15 ==> portalSP150929.bak
               01 2 34 5 67


Thursday, November 28, 2013

Enable Sign in as Different User Option in SharePoint 2013

1) Locate and then open the following file in a text editor:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ TEMPLATE\CONTROLTEMPLATES\Welcome.ascx

2) Add the following element before the existing "ID_RequestAccess" element:

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser" Text="<%$Resources:wss,personalactions_loginasdifferentuser%>" Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>" MenuGroupId="100" Sequence="100" UseShortId="true" />

3) Save the file

Wednesday, November 27, 2013

Alternative Access Mapping for a SharePoint Farm

We have to add Alternative Access Mapping for all application severs.

Then we have add Alternative Access Mapping for Intranet zone.
Other wise users getting FILE NOT FOUND ERROR.

Save SharePoint List as a Template giving an error

When we are going to save a SharePoint List with huge data, it gives an error.

Simply because of Data size.

So we have to increase template size using STSADM

It is easy.

Friday, October 25, 2013

Refresh SharePoint 2013 Page Automatically

1) Simply create a text file in your local machine
2) Add following content to the text file

<script type="text/javascript" language="javascript">
var reloadTimer = null;
var sURL = unescape(window.location.pathname);

function setReloadTime(secs)
{ if (arguments.length == 1)
   { if (reloadTimer) clearTimeout(reloadTimer);
       reloadTimer = setTimeout("setReloadTime()", Math.ceil(parseFloat(secs)*1000));
   }
   else
   { reloadTimer = null;
     location.reload(true);
     window.location.replace( sURL );
   }
}
setReloadTime(30);
</script>

3) Go to SharePoint and upload the text file to a Document folder (Read Permission to all users)
4) Get the file URL and copy it
5) Go to WebPart page, EDIT mode
6) Add a Content Editor WebPart
7) Set URL of File link to uploaded text file URL in Content Editor WebPart
8) Save and Hide Your Content Editor WebPart

Your page will refresh in every 30 seconds. :) :)

Tuesday, September 10, 2013

Disable Copy-Paste option of Page URL in C#

if (!Request.FilePath.Contains("Default"))
{
string strPreviousPage = "";
if (Request.UrlReferrer != null)
{
strPreviousPage = Request.UrlReferrer.Segments[Request.UrlReferrer.Segments.Length - 1];
}
if (strPreviousPage == "")
{
Response.Redirect("Default.aspx");
}


*** Add this Code inside MASTER PAGE

Sunday, August 25, 2013

Update SharePoint 2010 Farm Credentials Using PowerShell


#Input the Managed Account
#If there is only one managed account, the following line could be written as:
#$inputManagedAcct = Get-SPManagedAccount

$inputManagedAcct = Read-Host "Enter managed account as Domain\User" 
#Input the desired new password 
$inputPasswd = Read-Host "Enter new password for managed account" –AsSecureString 
#Change the password for the managed account to the new value 
Set-SPManagedAccount -Identity $inputManagedAcct -NewPassword $inputPasswd



------------------------------------------------------------------------------------------------------------------------------------------------------------       Update after AD Reset    ----------------------------------------------------------------

#Input the Managed Account
#If there is only one managed account, the following line could be written as:
#$inputManagedAcct = Get-SPManagedAccount

$inputManagedAcct = Read-Host "Enter managed account as Domain\User:" 
#Input the Managed Account 
$inputPasswd = Read-Host "Enter password from Active Directory for managed account:" –AsSecureString 
#Change the password in SharePoint for the managed account to the new value 
Set-SPManagedAccount -Identity $inputManagedAcct -ExistingPassword $inputPasswd –UseExistingPassword $true 

Tuesday, August 6, 2013

Get Last 20 Slowest SQL Queries

 SELECT TOP 20
    SUBSTRING(qt.text, (qs.statement_start_offset/2)+1,
    ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.text)
                                   ELSE qs.statement_end_offset
      END - qs.statement_start_offset)/2)+1),
    qs.execution_count,
    qs.total_logical_reads, qs.last_logical_reads,
    qs.min_logical_reads, qs.max_logical_reads,
    qs.total_elapsed_time, qs.last_elapsed_time,
    qs.min_elapsed_time, qs.max_elapsed_time,
    qs.last_execution_time,
    qp.query_plan
FROM
    sys.dm_exec_query_stats qs
CROSS APPLY
    sys.dm_exec_sql_text(qs.sql_handle) qt
CROSS APPLY
    sys.dm_exec_query_plan(qs.plan_handle) qp
WHERE
    qt.encrypted = 0
ORDER BY
    qs.total_logical_reads DESC


Thursday, July 11, 2013

Getting exclusive access to a SQL Server database for restore - Solution

*** When we restore DB we are always getting exclusive access error.

So I have written a Query to
set DB OFFLINE
RESTORE DB
Changing location of .MDF and .LDF files

ALTER DATABASE WSS_CONTENT_1545 SET OFFLINE WITH ROLLBACK IMMEDIATE

--ALTER DATABASE WSS_CONTENT_1545 SET ONLINE

USE[MASTER]
ALTER DATABASE WSS_CONTENT_1545
SET SINGLE_USER WITH ROLLBACK immediate

Restore database WSS_CONTENT_1545
from Disk = 'E:\Wss_Content_Bak.bak' with REPLACE,
move 'WSS_Content_1111' to 'E:\Intra\WSS_Content_1545.mdf',
move 'WSS_Content_1111_Log' to 'E:\Intra\WSS_Content_1545.ldf'

*** (WSS_Content_1111 is the OLD DATABASE NAME)



My Masters