Category: SharePoint Administration

SharePoint Administration

Create SharePoint sites using Powershell

Home | SharePoint Administration | Create SharePoint sites using Powershell

I was trying to create the SharePoint Site Provisioning using PowerShell. The following PowerShell script will help us to create a SharePoint sites based on Site Address, Site Name and Site Template parameters.

# This is Script to  Create the Sites, based on the Siteadress and Templates, given by the user.
# Use Get-SPWebTemplate cmdlet to get the list of the installed Site templates.


PARAM 
(
[Parameter(Mandatory=$true, Position=0)]
[string] $YourSiteAddress,

[Parameter(Mandatory=$true, Position=1)]
[string] $YourSiteName,


[Parameter(Mandatory=$true, Position=2)]
[string] $YourSiteTemplate
#,

#[Parameter(Mandatory=$true, Position=3)]
#[bool] $OverWrite =$false
)

$OverWrite ='N'
$web = Get-SPWeb $YourSiteAddress -erroraction silentlycontinue
if ($web -ne $null)
{
     Write-Host ("Web site already present with same name : {0}"-f $YourSiteAddress)
     $OverWrite = Read-Host "If want to overwrite the current website Please enter [Y] else enter [N]"
     
    if($OverWrite -eq 'Y')
    {
            Write-Host ("Removing the Site {0}" -f $YourSiteAddress)
            Remove-SPWeb $YourSiteAddress -Confirm:$false -erroraction silentlycontinue
            Write-Host (" {0} - Site Removed" -f $YourSiteAddress)
    }

     $web = Get-SPWeb $YourSiteAddress -erroraction silentlycontinue
}


if($web -eq $null)   
{
    Write-Host ("Creating the Site {0}"-f $YourSiteAddress)
    New-SPWeb     –url $YourSiteAddress     -name $YourSiteName     -template $YourSiteTemplate     –AddToTopNav:$false   
    –UniquePermissions    -UseParentTopNav:$false
 }
else
 {
    Write-Host "use OverWrite =[Y]  to overwrite this Site upon getting the prompt, once you rerun the script"
 }
 Subscribe to my blog

SharePoint Multi tenancy – Faqs

Home | SharePoint Administration | SharePoint Multi tenancy – Faqs

1. What is multi-tenancy in SharePoint ?

The SharePoint platform has the capability to isolate and separate data from different web sites while sharing Service Application resources across same sites. This capability is called as Multi-tenancy. It primarily relies on Site Subscriptions and Subscription Ids

2. How data is partitioned in a hosted environment in SharePoint ?

The data is partitioned in a hosted environment in SharePoint by using the concept of Site Subscriptions. Site Subscription group tenant data across all site-collections owned by tenant, and provide the ability to separate and group each tenant’s data in a shared environment.

3. What is the role of Administrator in the context of hosted SharePoint environments ?

The administrators can centrally deploy and manage features & services, while providing tenants full control over the usage and experience.

4. What is the role of Subscription Ids with respect to SharePoint multi-tenancy ?

The site-collections of each and every tenant are grouped based on a common subscription ID. The Subscription ID helps to map features and services to tenants and also to partition service data according to tenant.

5. Can multiple subscriptions be hosted be hosted in a single web application ?

Yes, multiple Subscriptions can be hosted inside a single web application. Again, multiple subscriptions can also reside in the shared content database.

6. How administrators manage subscriptions and features for each tenant?

Administrators can define which services are available and activated for each tenant. The Subscription ID for a tenant can be used to map service partitions to site-collections

7. Can a service data be shared across multiple tenants ?

Yes, the service data can be shared across multiple tenants, so that all the tenants can share data for a specific service.

8. Can a service data be partitioned for each and every tenant ?

Yes, the service data can be partitioned for each and every tenant, ensuring that sensitive data is not exposed to other tenants. In this case, service data for a single tenant need to be implemented within a separate partition for that service.

9. What are the various roles involved when it comes to Tenant Administration ?

  • Hosting Company
  • Hosted Company Administrator
  • Hosted Company

10. What are the roles of a Hosting Company when it comes to Tenant Administration ?

The following are the typical roles of a Hosting Company for Tenant Administration:

  • Manages the farm-level settings and hardware
  • Controls the database configurations
  • Installs all new approved features and solutions
  • Brands the Tenant Administrator pages

11. What are the roles of a Hosted Company Administrator when it comes to Tenant Administration ?

The following are the typical roles of a Hosted Company when it comes to Tenant Administration :

  • Purchases space, features, and bandwidth from hosting company
  • Controls the architecture of customer sites but not the content
  • Reviews usage statistics

12. What are the roles of a Hosted Company when it comes to Tenant Administration ?

The following are the typical roles of a Hosted Company when it comes to Tenant Administration :

  • Owns a site collection
  • Installs or removes set of features and solutions
  • Configures features and services
  • Reviews usage statistics

 Subscribe to my blog

Add heading and link to SharePoint Global Navigation through Powershell

Home | SharePoint Administration | Add heading and link to SharePoint Global Navigation through Powershell

I was wondering whether there is a way to add the heading and link to the Top Navigation of SharePoint site using PowerShell Script. It is feasible, here is the full workable script below :-

$web = Get-SPWeb "http://yourserver:9090/sites/yoursite/"
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)



function AddHeading($HeadingName,$Link)
{


$CreateSPNavigationNode = [Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode]::CreateSPNavigationNode

$qlNav = $pubWeb.Navigation.CurrentNavigationNodes

$headingNode = $CreateSPNavigationNode.Invoke($HeadingName, $Link, [Microsoft.SharePoint.Publishing.NodeTypes]::Heading, $qlNav)

$web.Update()

}



function AddLink($HeadingName,$DisplayName,$URL,$External)

{
Start-Sleep -Seconds 5

$qlNav1 = $web.Navigation.QuickLaunch

$qlNav1 | select Title, ID

$qlink = $qlNav1 | where {$_.Title -eq $HeadingName}

$linkNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($DisplayName,$URL,$External)

$qlink.Children.AddAsLast($linkNode)

}


AddHeading "Heading" "http://microsoft.com"
AddLink "Heading" "Link" "http://hotmail.com" "True"

 Subscribe to my blog

Add heading and link to SharePoint left navigation through powershell

Home | SharePoint Administration | Add heading and link to SharePoint left navigation through powershell

I was wondering whether there is a way to add the heading and link to the left navigation of a SharePoint site using Powershell script. It is feasible, here is the full workable script below:-

$web = Get-SPWeb "http://yourserver:9090/sites/SCO/"
$pubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)


function AddLeftNavHeading($HeadingName,$Link)
{


$CreateSPNavigationNode = [Microsoft.SharePoint.Publishing.Navigation.SPNavigationSiteMapNode]::CreateSPNavigationNode

$qlNav = $pubWeb.Navigation.CurrentNavigationNodes

$headingNode = $CreateSPNavigationNode.Invoke($HeadingName, $Link, [Microsoft.SharePoint.Publishing.NodeTypes]::Heading, $qlNav)

$web.Update()

}


function AddLeftNavLink($HeadingName,$DisplayName,$URL,$External)

{
Start-Sleep -Seconds 5

$qlNav1 = $web.Navigation.QuickLaunch

$qlNav1 | select Title, ID

$qlink = $qlNav1 | where {$_.Title -eq $HeadingName}

$linkNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($DisplayName,$URL,$External)

$qlink.Children.AddAsLast($linkNode)

}

AddLeftNavHeading "Heading" "http://microsoft.com"
AddLeftNavLink "Heading" "Link" "http://hotmail.com" "True"

 Subscribe to my blog

Installing SharePoint Foundation 2010 on Windows 7

Home | SharePoint Administration | Installing SharePoint Foundation 2010 on Windows 7

One of the major improvement of SharePoint 2010 product is its ability to install and run on the client operating system like Windows 7. This article would elaborate the steps to install SP  Foundation 2010 on Windows 7 (X64). The configuration of my laptop is Intel I5 Processor, 4GB RAM and set up with Windows 7 Enterprise Edition (X64) & Visual studio 2010 Service Pack1.

 

Step1 –

Install WCF hotfix for Windows 7 located in  http://go.microsoft.com/fwlink/?LinkID=166231

Step2

Install ADO.NET Data Services updates for .NET 3.5 SP1 located in http://go.microsoft.com/fwlink/?LinkID=166231

Step3

The next step is to install the other additional pre-requisites. The pre-requisite installer cannot be leveraged while installing SP Foundation 2010, unlike the installation of SP Server 2010. So the following pre-requisites have to be manually installed.

 

a) Microsoft Sync Framework

b) SQL Server Native Client

c) Windows Identity Foundation

 

Step 4

Enable the set of required Windows Features by running the following scripts

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;^
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;^
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;^
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;^
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;^
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;^
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;^
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;^
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;^
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;^
WCF-NonHTTP-Activation

 

Step 5

The next task is to extract the SharePoint Foundation installer (SharePointFoundation.exe), apply required attributes for the configuration file.

Copy the SharePointFoundation.exe in to the folder where you want to install.
c:YourFolder

Extract the installer by typing the following in the command prompt
c:YourFolderSharePoint /extract:c:YourFolder

 

Open the Config.xml located in c:YourFolderfilesSetupconfig.xml

Add the following snippet inside <configuration> tag
<Setting Id="AllowWindowsClientInstall" Value="True"/>

Please make sure the the installer (SharePointFoundation.exe) is extracted only using the Extract option in Command prompt. If it is extracted using Winzip, it will given an error like “The language of this installation package is not supported”

Run SharePointFoundation.exe and install it as ‘StandAlone’

pic1

pic2

pic3

 

 

 

Run the SharePoint Configuration Wizard. If you are doing a standalone setup of SP Foundation2010, there is no need to install Microsoft SQL Server 2008 KB 970315 x64  hotfix.

Now it’s all set the SP Foundation 2010 setup is complete.

Steps to Configure SharePoint 2010 Information Worker Demonstration and Evaluation Virtual Machine

Home | SharePoint Administration | Steps to Configure SharePoint 2010 Information Worker Demonstration and Evaluation Virtual Machine

This article would cover the necessary steps to configure the SP 2010 Information Worker Demo VPC. The easiest way to have a development environment for personal learning need is to download the SharePoint 2010 Information Worker Demonstration VPC and configure it for your needs, rather then setting up a dev server-farm from scratch.

 

Though most of the steps to configure this VPC is available in Microsoft’s guidance, I’d try to cover the things which are not there in MSDN guidance and would make it more comprehensive.

1. Download the VM files from Microsoft site and run the application file 2010-7a.part01.rar

2. This would extract all the 20 files into a large VM dump (2010-7a.vhd)

3. On the extracted folder, you’ll find a configuration file

image

<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<configuration>
  <SnapShotDataRoot type="string"></SnapShotDataRoot>
  <ExternalDataRoot type="string"></ExternalDataRoot>
  <vhd>
    <source type="string">E:VMsa-andcar2010-7aVirtual Hard Disks2010-7a.vhd</source>
    <target type="string"></target>
  </vhd>
  <VmStateCopied type="bool">true</VmStateCopied>
</configuration>

4. By default the “<Source type-“string”> will have the path of E:VMsa-andcar2010-7aVirtual Hard Disks2010-7a.vhd. You need to change it to the path of your local PC, where the .vhd file is saved. Otherwise, you’ll get an error when you to run this VM in the hyper-v. In my case, I’ve changed the path to D:SP 2010 VM7a2010-7aVirtual Hard Disks2010-7a.vhd.

5. The next step is to define the Network connections in the Hyper-V.

Start Hyper-V Manager from Control Panel -> Administrative Tools

Click Virtual Network Manager

Choose New virtual network in the Virtual Networks pane

Choose Internal from the type list and click Add

 Enter a name of Internal and click OK

image

6. Start menu -> right-click Network –> Properties

    Click Change adapter settings

    Locate the adapter corresponding to ‘Internal’,

    image

    Right click and choose properties

    Double click on IPV4 and set the following IP addresses.

    image

7. The next steps is to define the Internet Connection (External) for the VPC.

On the Virtual Network Manager define an ‘External’ network connection.

image

Now you’ll see a new network connection called ‘External’ in the Network connections

image

I’ve set up wireless network connection already on my windows server 2008 hosting SP 2010 VPC. The name of the connection

is Wireless Network Connection.

image

Right click on wireless network connection –> properties –> Sharing

Check ‘ Allow other network users to connect through this computer’s internet connection’.

Under home networking connection chose the network connection name corresponding to External Adapter defined in hyper-v. In my case it is VLAN2.

image

This will allow the VM to access the internet.

8. Import the Virtual Machine into hyper-v. Otherwise, you can create a brand-new Virtual Machine with the required custom settings using the extracted .vhd file.

9.Start the virtual image

10. Once the machine starts log in as administrator and password is pass@word1

11. The next step is to do re-arming. The re-arming needs to be done after 10 days from the initial usage.

 Run “slmgr –rearm” (no quotes) in the command prompt to complete re-arming.

12. Last, but not least, add the following host entries

127.0.01                    intranet.contoso.com

127.0.01                    finweb.contoso.com

127.0.01                    lcaweb.contoso.com

127.0.01                    itweb.contoso.com

This completes the configuration for SP 2010 Information Worker demonstration VPC.

 

 Subscribe to my blog

Recycle IIS Application Pool: Cannot connect to the SharePoint site

Home | SharePoint Administration | Recycle IIS Application Pool: Cannot connect to the SharePoint site

I created a Visual Studio 2010 SharePoint Project. When i tried to build and deploy the solution from Visual Studio, i got the following error :-

Error occurred in deployment step ‘Recycle IIS Application Pool’: Cannot connect to the SharePoint site: http://samplesite/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.

I realized the i’m not the administrator of the box and also did not have the access to the SharePoint content db. I fixed this issue by doing the following :-

1. Added myself as the administrator

2.Added myself to SharePoint Farm Admin Group

3. Provided DB Owner access to SharePoint Content DB

 

 Subscribe to my blog

SharePoint 2010 Sandbox Solution Faqs

Home | Service Paradigm | SharePoint 2010 Sandbox Solution Faqs

1.What is a sharepoint solution ?
The sharePoint solution is a deployable package that contain features and assemblies. It is a .cab based file with a .wsp extension. Visual Studio 2010 SharePoint Project template helps to create .wsp files. A solution can contain multiple features. Each feature can encapsulate functionality such as web parts, list definitons, modules and event receivers.

2.What is a sandboxed solution ?
The sandboxed solution looks and behavies like a farm solution, but the assembly of a sandboxed solution is set to allow partially trusted callers.

3.Is the structure of the sandboxed solutions different from farm solution running with full-trust?
It is similar in structure, but the main difference lies in how the sandboxed solution is deployed and executed.

4.Can a sandboxed solution run as a farm-solution ?
A sharepoint solution can be executed as farm-solution by providing full-trust.

5.How site-collection administrators manage the sandboxed solutions ?
The site-collection administrators can navigate to the solution gallery at the site-collection level and can upload, activate, delete and manage solutions. The gallery also enables a site collection administrator to monitor a solution’s usage against a resource quota.

6.How to deploy the sandboxed solutions to the site-collection ?
The sandboxed solutions can be deployed to the site-collection, just by uploading the .wsp file to the gallery and activate it.

7.How to retract the sandboxed solutions ?
The sandboxed solution can be retracted by removing the solution from solution gallery. The features associated with the solution need to be de-activated before
retracting the solution.

8.How to deploy the sandboxed solution from one site-collection to another ?
Copy the solution to disk and upload solution to another site-collection from the disk.

9.Can a sharePoint 2010 visual web part be packaged as sandboxed Solution ?
The visual web part needs .ascx file to be deployed to the file-system of web front-end. The sandboxed solution can’t deploy files to the
web front-end.

10.How to debug sandboxed solutions ? How different it is from debugging of full trust solutions ?
The full-trust solutions run under IIS worker process w3wp.exe. However the sandboxed solutions run under sandboxed worker process called spucworkerprocess.exe. Visual studio automatically attaches debugger when we hit F5. If we’re debugging a sandboxed solution that is already deployed, debugger needs to be explicity attached to the sandboxed worker process called spucworkerprocess.exe

11.What SharePoint components can be performed with Sandboxed solutions?
In a sandboxed solution, web parts, list definition & instances, content types, fields, modules, declerative workflows and event receivers can be created. All the classes below SPSite like SPSite, SPWeb, SPList and SPListItem are accessible inside sandboxed solution.

12.What are the permissions that are blocked for a sandboxed web part ?
a)Data-access outside of site-collection
b)Internet Access to make web service calls
c)Access to hard-drive for read/write files
d)Access to Partially trusted code

13.How to make sandboxed solution to reach outside world for performing trusted operation ?
Leverage Business Connectivity Services to read/write data outside of sandboxed solution. The other option is to invoke an assembly(class)deployed as full-trust solution. This proxy class can be called from sandboxed solution.

14.How to monitor the farm solution ?
SharePoint 2010 provides tools to monitor and set quotas on sandboxed solution. Farm administrators can navigate to
Central Administration –> Application Managment –> Configure Quotas and Locks in site-collection to configure Quotas and Locks.

15.How Quotas and Locks are managed ?
The Resource Quota properties for the user solutions can be set in the Site Quota Information section. 

 

 Subscribe to my post

Script to automate the installation of wsp and activation of features

Home | SharePoint Administration | Script to automate the installation of wsp and activation of features

This post is regarding the usage of a simple script to automate the wsp installation and featue activation. Whenever we want to deploy components like custom web parts,  custom user control and custom application pages etc. we use sharepoint solution packages for deployment and then we activate the respective features manually. It is a tediou job to install the wsps and  activate the features manually, if we have multiple solution packages to be deployed. To automate this, we can use the the following script to install wsp and activate features. 

:begin
@echo off

set solutionName=SampleSolution
set featureSampleFeature1=SampleFeature1

rem ** Replace this value with the URL of your site **
@set url=http://yourserver/sites/rootsite/subsite

@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH% 

stsadm -o retractsolution   -name %solutionName%.wsp -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name %solutionName%.wsp -override

echo Adding solution %solutionName% to solution store...
echo ----------------------------------------------------

stsadm -o addsolution -filename %solutionName%.wsp
if errorlevel == 0 goto :deploySolution

echo ### Error adding solution %solutionName%
echo .
goto end

:deploySolution
echo Deploying solution %solutionName%...
echo ----------------------------------------------------
stsadm -o deploysolution -name %solutionName%.wsp -url %url% -immediate -allowGacDeployment -allowCasPolicies  -force
stsadm -o execadmsvcjobs 

if errorlevel == 0 goto :activateFeature

echo ### Error deploying solution %solutionName%
echo .
goto end

:activateFeature

echo Activating features in solution %solutionName%...
echo ----------------------------------------------------

stsadm -o activatefeature -name %featureSampleFeature1% -url %url% -force

if errorlevel == 0 goto :success

echo ### Error activating features
echo .
goto end

:success
echo Successfully deployed solution and activated feature(s)..
echo .
goto end

:end
pause

In the above mentioned script, you can replace the solutionName with the name of your WSP and SampleFeature1 with the name of your feature to be activated. In this example, i'm activating a single feature. 
You can also mention multiple features in the script, so that multiple feature gets activated using this script.

 Subscribe to my post

Script to retract sharepoint solution package (wsp) and deactivate features

Home | SharePoint Administration | Script to retract sharepoint solution package (wsp) and deactivate features

The following snippet contains the script to retract sharepoint solution packages and de-activate features. This would be become handy to the sharepoint adminstrators, when they want to retract multiple solution packages (wsp) and de-activate multiple features.

:begin
@echo off

rem ** declare the solution to be retracted **
set solutionName=SampleSolution

rem ** declare the set of fetures to be de-activated **
set featureSampleFeature1=SampleFeature1
set featureSampleFeature2=SampleFeature2
set featureSampleFeature3=SampleFeature3

rem ** Replace this value with the URL of your site **
@set url=http://servername/sites/sitecollectioname/sitename

@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH%

echo deactivating features in solution %solutionName%…
echo —————————————————-

stsadm -o deactivatefeature -name %featureSampleFeature1% -url %url% -force
stsadm -o deactivatefeature -name %featureSampleFeature2% -url %url% -force
stsadm -o deactivatefeature -name %featureSampleFeature3% -url %url% -force

echo Attempting to uninstallfeature and retract solution
echo —————————————————

echo Rectracting solution %solutionName% from solution store…

stsadm -o retractsolution   -name %solutionName%.wsp -immediate
stsadm -o execadmsvcjobs

echo Deleting solution %solutionName% from solution store…
stsadm -o deletesolution -name %solutionName%.wsp -override
echo.

if errorlevel == 0 goto :success
:success
echo Successfully deployed solution and activated feature(s)..
echo .
goto end

:end
pause

 

 Subscribe to my post