Monday, August 22, 2016

Start/Update Workflow for existing items in SharePoint List using PowerShell

The following script is useful to start/update workflow for existing items in SharePoint list.

#updated workflow

# URL of the Site
$web = Get-SPWeb -Identity "<<Site URL>>"

$manager = $web.Site.WorkFlowManager

# Name of the list
$list = $web.Lists["<< List Name>>"]

# Name of the Workflow
$assoc = $list.WorkflowAssociations.GetAssociationByName("<< Workflow Name>>","en-US")

$data = $assoc.AssociationData
$items = $list.Items
foreach($item in $items)
 {
 $wf = $manager.StartWorkFlow($item,$assoc,$data,$true)
 }

$manager.Dispose()
$web.Dispose()
#

Thursday, February 27, 2014

Installing the Reporting Service Add-in for SharePoint 2010


Installing the add-in before a SharePoint Product or Technology
The add-in must be installed on all servers that will run as SharePoint Web front-ends that you want integrated with the Reporting Services. If the SharePoint product or technology has not been installed yet, you can run the add-in installation wizard on all servers.
  1. Download the Setup program (rsSharepoint.msi) for the Reporting Services Add-in.
  2. As an administrator, run rsSharepoint.msi to run the Installation Wizard. The wizard displays a Welcome page, the Software license terms, and a registration information page. Setup creates SharePoint 2010 folders under %program files%\common files\Microsoft Shared\ and copies files to the folders. You must run the .msi as administrator by first opening an elevated command prompt window, and then running the rsSharepoint.msi from the command line.
  3. Configure the report server integration settings and feature activation in SharePoint Central Administration.
Installing the add-in after a SharePoint Product or Technology has been installed
When installing the add-in on servers after a SharePoint product or technology has been installed, you can run the full add-in installation on only one of the SharePoint servers. For the other SharePoint servers in the farm, you must run the files only installation of the add-in from the command line. The files-only installation installs the files but skips the custom actions section of the installation process.
After you have installed the add-in on all the servers, start SharePoint Central Administration to configure report server integration.
Files-only installation
To install the files but skip the custom action steps, run the .msi from the command line with the SKIPCA option:
  1. Open a command prompt with administrator permissions. 
  2. Run msiexec -i rsSharePoint.msi SKIPCA=1.
 
Two steps for a full installation of the add-in
If you get errors during installation, you can run Setup as a two-step process from the command line. First run Setup to install the files and skip the custom actions, and then run a custom actions executable. To install the Reporting Services Add-in for files-only mode, do the following:
  1. Open a command prompt with administrator permissions.
  2. Run msiexec -i rsSharePoint.msi SKIPCA=1.
  3. Find the rsCustomAction.exe file on the file system. This file is copied to your computer by the Setup program. The file will be located in the %Temp% directory.
To get the path information for this file, click Start, click Run, and then type %temp%. The file should be located in \Documents and Settings\<your name>\LOCALS~1\Temp.
Open a command prompt window. To do this, click Start, click Run, and type cmd. On newer operating systems, you might need to elevate your permissions and run this run this with administrator permission.
  1. Navigate to the folder that contains the rsCustomAction executable.
  2. Enter the following command. This configuration step will take several minutes to finish. The W3SVC service will be restarted during this process.
6.  rsCustomAction.exe /i

Use Full PowerShell Script for SharePoint


PowerShell Script for Activate Publishing Feature for All Sites


$siteUrl = "<Site url>"
$siteCollection = Get-SPSite $siteUrl
# iterate to all SPWeb (sub sites).
$siteCollection | Get-SPWeb -limit all | ForEach-Object{
write-host "Activating the PublishingWeb feature on " $_.Url
#Enable PublishingWeb Feature and the internal name of the SharePoint Server Publishing feature
Enable-SPFeature -Identity "PublishingWeb" -Url $_.Url
write-host "Activated the PublishingWeb feature on " $_.Url
}
$siteCollection.Dispose()

Saturday, July 28, 2012

Configuring Multi-Tenancy in SharePoint 2010


Create a SubscriptionSettings Service Application and Proxy

Subscription settings service application is used to keep track of Multi - Tenant services and subscription ID's. So go to the below path

Start the  Microsoft SharePoint Foundation Subscription Settings Service

Central Administration => Application Management => Manage services on server
Start the service "Microsoft SharePoint Foundation Subscription Settings Service".


Create Service Application and Proxy via PowerShell

 $appPool  =  New-SPServiceApplicationPool -Name Subscription_Settings_Service_Pool -Account Domain\UserName

$sa = new-spsubscriptionsettingsserviceapplication –Name SubscriptionSettingsServiceApplication –Databasename SubscriptionSettingsServiceApplicationDB –applicationpool $appPool

$sap = new-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $sa

Create Tenant Administration site

New-SPSite –url "http://<servername>:<port no>/sites/Tenant Administration" –template "tenantadmin#0" –owneralias Domain\UserName –sitesubscription $subscription -AdministrationSiteType TenantAdministration

Create Member Site

Before creating the Member\Tenant Site enable the Self Service Site Creation of the Web Application.
Click Manage Site Collection under SharePoint Site Section on the Tenant Administration Site

Click New  and enter the required information  then click ok.


Reference : http://blogs.msdn.com/b/russmax/archive/2010/04/03/sharepoint-2010-multi-tenant-hosting-part-2-configuring.aspx
 

Thursday, July 26, 2012

How to Find the SharePoint 2010 Installed version

Go to the Registry of the Below path and Identify the GUID of installed SKU's


HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\InstalledProducts
  • BEED1F75-C398-4447-AEF1-E66E1F0DF91E: SharePoint Foundation 2010
  • 1328E89E-7EC8-4F7E-809E-7E945796E511: Search Server Express 2010
  • B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0: SharePoint Server 2010 Standard Trial
  • 3FDFBCC8-B3E4-4482-91FA-122C6432805C: SharePoint Server 2010 Standard
  • 88BED06D-8C6B-4E62-AB01-546D6005FE97: SharePoint Server 2010 Enterprise Trial
  • D5595F62-449B-4061-B0B2-0CBAD410BB51: SharePoint Server 2010 Enterprise
  • BC4C1C97-9013-4033-A0DD-9DC9E6D6C887: Search Server 2010 Trial
  • 08460AA2-A176-442C-BDCA-26928704D80B: Search Server 2010
  • 84902853-59F6-4B20-BC7C-DE4F419FEFAD: Project Server 2010 Trial
  • ED21638F-97FF-4A65-AD9B-6889B93065E2: Project Server 2010
  • 926E4E17-087B-47D1-8BD7-91A394BC6196: Office Web Companions 2010 


use the below PowerShell command to get the GUID of the Installed SKUs.
 get-spfarm | select Products

Reference http://msdn.microsoft.com/en-us/library/ff721969.aspx

Thursday, July 12, 2012

Rename a SharePoint Server machine name

There are number of concerns that contribute to defining the process that you will be taking to change a machine name for a SharePoint server.

Make sure you execute the following steps in order:

  • Run the following command:
    Stsadm.exe -o renameserver -oldservername <OLD_SERVER_NAME> -newservername <NEW_SERVER_NAME>
  • Rename the machine name from the computer properties
  • Reboot the machine
  • Update credentials (if required) if you are using domain accounts and the account didn’t change you can skip this step 
    stsadm –o updatefarmcredentials –userlogin <NEW_SERVER_NAME>\username -password ********
    stsadm –o osearch –farmserviceaccount <NEW_SERVER_NAME>\username -farmservicepassword ********

    stsadm –o spsearch –farmserviceaccount <NEW_SERVER_NAME>\username -farmservicepassword ********

    stsadm –o editssp –title “SHARED_SERVICE_TITLE” -ssplogin <NEW_SERVER_NAME>\username -ssppassword ********
  • Run the this command to reset the IIS: IISRESET /NOFORCE
  • Fix the Alternate access mappings
     If you are not able to get into the central admin site yet run the following command:
        stsadm -o addalternatedomain -url http://<OLD_SERVER_NAME>:<CENTRAL_ADMIN_PORT> -urlzone extranet –incoming url http://<NEW_SERVER_NAME>: <CENTRAL_ADMIN_PORT>

    Now you should be able to go to the central admin to clean the miss in the AAM. Basicly rename all the old server names into the new server name.
  • Now through the central administration or command line, make sure that you have the right credentials for the app pools (again if you are using domain users you shouldn’t worry about this at all)
  • Reboot the machine
  • Now run the SharePoint Products and Technologies configuration wizard to seal the deal
  • Reboot the machine
  • If you get the error related to SQL Server check your Database settings and make sure that they are correct. You can use stsadm to reset the config db name if the server name has changed and the same thing with the content DBs
  • If you do any changes to the DB settings make sure that your run: "IISRESET /NOFORCE" afterwards
  • After all that, if you have the db on the same machine as the sharepoint that means that you probably need to take care of the sql server settings (server name change) do run the following SQL Queries:
  •     -In case you use the default or no sql instance name:

    EXEC sp_dropserver '<OLD_SERVER_NAME>'
    GO
    EXEC sp_addserver '<NEW_SERVER_NAME>', 'local'
    GO
  •     -In case you use a custom sql instance name:
    sp_dropserver <’OLD_SERVER_NAME\instancename'>
    GO
    sp_addserver <'NEW_SERVER_NAME\instancename'>, local
    GO
  • Then restart the Sql Service to take effect

Wednesday, July 4, 2012

SharePoint supported languages, culture names and locale IDs

Download the language pack from
here


Language Name

Culture Name

Locale ID

Arabic

ar-sa

1025

Bulgarian

bg-bg

1026

Catalan

ca-es

1027

Chinese (Simplified)

zh-cn

2052

Chinese (Traditional, Taiwan)

zh-tw

1028

Croatian

hr-hr

1050

Czech

cs-cz

1029

Danish

da-dk

1030

Dutch

nl-nl

1043

English

en-us

1033

Estonian

et-ee

1061

Finnish

fi-fi

1035

French

fr-fr

1036

German

de-de

1031

Greek

el-gr

1032

Hebrew

he-il

1037

Hindi

hi-in

1081

Hungarian

hu-hu

1038

Italian

it-it

1040

Japanese

ja-jp

1041

Kazakh

kk-kz

1087

Korean

ko-kr

1042

Latvian

lv-lv

1062

Lithuanian

lt-lt

1063

Norwegian (Bokmål)

nb-no

1044

Polish

pl-pl

1045

Portuguese (Brazil)

pt-br

1046

Portuguese (Portugal)

pt-pt

2070

Romanian

ro-ro

1048

Russian

ru-ru

1049

Serbian (Latin)

sr-latn-cs

2074

Slovak

sk-sk

1051

Slovenian

sl-si

1060

Spanish

es-es

3082

Swedish

sv-se

1053

Thai

th-th

1054

Turkish

tr-tr

1055

Ukrainian

uk-ua

1058

Saturday, May 19, 2012

Insert flash/swf file in a master page


We can insert the flash/swf file in masterpage using the below code. 


<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" id="sivaflash" style="width: 957px; height: 300px">
       <PARAM NAME=movie VALUE="/Style%20Library/siva/Banner.swf">
       <PARAM NAME=quality VALUE=High>
       <PARAM NAME=bgcolor VALUE=#ffffff>
       <param name="salign" value="T">
       <EMBED src="/Style%20Library/siva/Banner.swf" quality=High bgcolor=#ffffff
NAME="flash" ALIGN=""TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" style="width: 957px; height: 300px" salign="T"></EMBED></OBJECT>

Thursday, May 10, 2012

All Language pack Code for Sharepoint 2010


Using the below power shell script to Download the Language Packs



Import-Module BitsTransfer
## Prompt for the destination path
$DestPath = Read-Host -Prompt "- Enter the destination path for downloaded files"
## Check that the path entered is valid
If (Test-Path "$DestPath" -Verbose)
{
    ## If destination path is valid, create folder if it doesn't already exist
    $DestFolder = "$DestPath\LanguagePacks"
    New-Item -ItemType Directory $DestFolder -ErrorAction SilentlyContinue
}
Else
{
    Write-Warning " - Destination path appears to be invalid."
    ## Pause
    Write-Host " - Please check the path, and try running the script again."
    Write-Host "- Press any key to exit..."
    $null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    break
}
## We use the hard-coded URL below, so that we can extract the filename (and use it to get destination filename $DestFileName)
## Note: These URLs are subject to change at Microsoft's discretion.
$UrlList = ("http://download.microsoft.com/download/A/6/C/A6C2FAE9-58A4-410D-81E0-682E8CBF3D18/ServerLanguagePack.exe", #Arabic
            "http://download.microsoft.com/download/0/D/B/0DB91457-43D2-4BCC-A7AF-8559C3E3E1CF/ServerLanguagePack.exe", #Basque
            "http://download.microsoft.com/download/9/1/C/91CFFA84-3A8C-4B2B-BD1F-AF77073C832D/ServerLanguagePack.exe", #Bulgarian
            "http://download.microsoft.com/download/0/7/B/07B06744-859A-40CF-84BB-4C8113F9FB75/ServerLanguagePack.exe", #Catalan
            "http://download.microsoft.com/download/D/F/C/DFCC90EE-FC55-4EC3-8618-7A2ED0B6F20F/ServerLanguagePack.exe", #Chinese Simplified
            "http://download.microsoft.com/download/5/D/E/5DE5B04D-DA7E-41DD-8BB5-FE7BF02630B8/ServerLanguagePack.exe", #Chinese Traditional
            "http://download.microsoft.com/download/B/6/B/B6B2439C-EB60-4361-AB83-71CB6B890ADE/ServerLanguagePack.exe", #Croatian
            "http://download.microsoft.com/download/7/B/6/7B67B8FC-81C6-446A-9681-897C0888D592/ServerLanguagePack.exe", #Czech
            "http://download.microsoft.com/download/C/D/7/CD76DD3E-95E4-4504-93CF-F7CD6D8B7CF5/ServerLanguagePack.exe", #Danish
            "http://download.microsoft.com/download/D/8/C/D8C7212B-6DFE-439D-B7D6-EFB35D66041E/ServerLanguagePack.exe", #Dutch
            "http://download.microsoft.com/download/1/7/F/17F6BB3B-662F-4555-9760-DB44D3B3F6A4/ServerLanguagePack.exe", #English
            "http://download.microsoft.com/download/4/4/6/446DDD4D-DC67-4663-B7C5-CCFA79316703/ServerLanguagePack.exe", #Estonian
            "http://download.microsoft.com/download/1/1/6/116C7960-6DFB-468E-BBCB-15E8706783F3/ServerLanguagePack.exe", #Finnish
            "http://download.microsoft.com/download/8/0/B/80B8DB8F-D863-4DD9-98E0-A3698510EF13/ServerLanguagePack.exe", #French
            "http://download.microsoft.com/download/D/0/F/D0FE84CB-B591-4D5E-9406-CBA2476D4A94/ServerLanguagePack.exe", #Galician
            "http://download.microsoft.com/download/7/3/8/738597D9-2817-46D7-8F70-7FBBEE73ABCF/ServerLanguagePack.exe", #German
            "http://download.microsoft.com/download/5/F/0/5F03CC80-D10A-43D5-AA1D-E84C6C077E2C/ServerLanguagePack.exe", #Greek
            "http://download.microsoft.com/download/D/1/0/D10A5EC6-6C6B-4C4B-9FF1-A662B397E850/ServerLanguagePack.exe", #Hebrew
            "http://download.microsoft.com/download/7/9/5/795A36AA-D414-4D67-A84D-6815D2FB5A88/ServerLanguagePack.exe", #Hindi
            "http://download.microsoft.com/download/F/D/B/FDB09771-D7FF-4123-A66D-2F0A58687E90/ServerLanguagePack.exe", #Hungarian
            "http://download.microsoft.com/download/A/8/4/A843E91B-7AEE-47B4-A144-49F525DEBD9D/ServerLanguagePack.exe", #Italian
            "http://download.microsoft.com/download/9/4/D/94DDA001-2059-4F02-8810-8662C1098F8D/ServerLanguagePack.exe", #Japanese
            "http://download.microsoft.com/download/F/C/D/FCD57DCD-2BFB-4638-94A3-583AD688CB4D/ServerLanguagePack.exe", #Kazakh
            "http://download.microsoft.com/download/B/9/D/B9DB186A-8126-49A9-AFA8-C6D63F12AA40/ServerLanguagePack.exe", #Korean
            "http://download.microsoft.com/download/3/E/D/3EDD2930-7BEC-4490-B917-7A49CBA7C5E5/ServerLanguagePack.exe", #Latvian
            "http://download.microsoft.com/download/E/E/E/EEE0F34F-94D1-4202-B0D0-213C93E20536/ServerLanguagePack.exe", #Lithuanian
            "http://download.microsoft.com/download/D/5/9/D596FB84-8ED3-44A4-88D1-FDD4798E226A/ServerLanguagePack.exe", #Norwegian
            "http://download.microsoft.com/download/B/F/1/BF1F45F4-44A8-453D-882D-03BAC1F6A0B5/ServerLanguagePack.exe", #Polish
            "http://download.microsoft.com/download/6/9/F/69F59A23-C22F-4B22-9D72-790E84F6070E/ServerLanguagePack.exe", #Portugese (Brazil)
            "http://download.microsoft.com/download/0/E/F/0EF8F011-89A6-43AE-BD52-090918750432/ServerLanguagePack.exe", #Portugese (Portugal)
            "http://download.microsoft.com/download/8/8/0/880A4C0E-25CA-43B5-84EF-A788FA462AB2/ServerLanguagePack.exe", #Romanian
            "http://download.microsoft.com/download/2/6/D/26D339A3-0304-4B66-8062-98BDC0E0D413/ServerLanguagePack.exe", #Russian
            "http://download.microsoft.com/download/F/D/2/FD2B1BA8-9841-46F9-A4A7-B97294554249/ServerLanguagePack.exe", #Serbian (Latin)
            "http://download.microsoft.com/download/0/E/7/0E7A8426-7797-48F9-B396-AA96ADD1D899/ServerLanguagePack.exe", #Slovak
            "http://download.microsoft.com/download/0/3/5/035FD96F-04B1-4461-B8E9-6492654C8549/ServerLanguagePack.exe", #Slovenian
            "http://download.microsoft.com/download/0/D/5/0D547EA0-C094-4D06-BE15-F5111A1D4642/ServerLanguagePack.exe", #Spanish
            "http://download.microsoft.com/download/5/2/9/5296BCC9-F0ED-461F-9E22-8A816DEC75C8/ServerLanguagePack.exe", #Swedish
            "http://download.microsoft.com/download/E/E/A/EEA4DC8B-4979-44C5-AF5E-E326DA04661C/ServerLanguagePack.exe", #Thai
            "http://download.microsoft.com/download/2/1/1/2118AF0D-A747-486E-A5BB-6B35E5588247/ServerLanguagePack.exe", #Turkish
            "http://download.microsoft.com/download/5/9/D/59DEC052-7E29-4F40-A27A-9AA94A8AAA1A/ServerLanguagePack.exe"  #Ukranian
            )
ForEach ($Url in $UrlList)
{
    ## Get the file name based on the portion of the URL after the last slash and replace the word "Server" with a random string
    ## (Crude way of getting unique file names since all Lang Packs are ServerLanguagePack.exe)
    $DestFileName = $Url.Split('/')[-1] -replace "Server",(Get-Random)
    Try
    {
        ## Check if destination file already exists
        If (!(Test-Path "$DestFolder\$DestFileName"))
        {
            ## Begin download
            Start-BitsTransfer -Source $Url -Destination $DestFolder\$DestFileName -DisplayName "Downloading `'$DestFileName`' to $DestFolder" -Priority High -Description "From $Url..." -ErrorVariable err
            If ($err) {Throw ""}
        }
        Else
        {
            Write-Host " - File $DestFileName already exists, skipping..."
        }
    }
    Catch
    {
        Write-Warning " - An error occurred downloading `'$DestFileName`'"
        break
    }
}
## View the downloaded files in Windows Explorer
Invoke-Item $DestFolder
## Pause
Write-Host "- Downloads completed, press any key to exit..."
$null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")