Translate

Saturday, November 30, 2013

Provisioning a SharePoint 2010 Farm Service Applications using a PowerShell Script

 
This video is best if watched in Full Screen mode:  http://www.youtube.com/watch?v=3HAjO8yiANM  and any references to completed services should really say, the powershell script has completed creating the service application and you still need to manually configure it, just as you would if the service were created by the White Wizard.  Difference with this method is that it generates a SharePoint environment containing database names that are GUID free.
 




Here's another video of this process


Contents of Bus.ps1 Replaces the White Wizard\Farm Wizard

It places all the service applications under one application pool in IIS

#####################################################
This script replicates most of the functionality found in the SharePoint Products Configuration Wizard with the EXCEPTION of the USER PROFILE SERVICE
##################################################### 
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

## Settings you may want to change ##
$databaseServerName = “2010SQL”
$searchServerName = “2010WEB1” #Front end Server that will run central admin, the server you’re on right now
$saAppPoolName = “SharePoint Web Services Default”
$appPoolUserName = “DOMAIN\MyFarmer” #farm admin account for Timer and Central admin, check that both services are running under this account before
# running this script

## Service Application Service Names ##
$accesssSAName = “Access Services”
$bcsSAName = “Business Data Connectivity Service”
$excelSAName = “Excel Services Application”
$metadataSAName = “Managed Metadata Web Service”
$performancePointSAName = “PerformancePoint Service”
$searchSAName = “SharePoint Server Search”
$stateSAName = “State Service”
$secureStoreSAName = “Secure Store Service”
$usageSAName = “Usage and Health Data Collection Service”
$userProfileSAName = “User Profile Synchronization Service”
$visioSAName = “Visio Graphics Service”
$WebAnalyticsSAName = “Web Analytics Service”
$WordAutomationSAName = “Word Automation Services”


$saAppPool = Get-SPServiceApplicationPool -Identity $saAppPoolName -EA 0
if($saAppPool -eq $null)
{
Write-Host “Creating Service Application Pool…”

$appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0
if($appPoolAccount -eq $null)
{
Write-Host “Please supply the password for the Service Account…”
$appPoolCred = Get-Credential $appPoolUserName
$appPoolAccount = New-SPManagedAccount -Credential $appPoolCred -EA 0
}

$appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName -EA 0

if($appPoolAccount -eq $null)
{
Write-Host “Cannot create or find the managed account $appPoolUserName, please ensure the account exists.”
Exit -1
}

New-SPServiceApplicationPool -Name $saAppPoolName -Account $appPoolAccount -EA 0 > $null

}


Write-Host “Creating Usage Service and Proxy…”
$serviceInstance = Get-SPUsageService
New-SPUsageApplication -Name $usageSAName -DatabaseServer $databaseServerName -DatabaseName “UsageDB” -UsageService $serviceInstance > $null

 Write-Host “Creating Access Services and Proxy…”
New-SPAccessServiceApplication -Name $accesssSAName -ApplicationPool $saAppPoolName > $null
Get-SPServiceInstance | where-object {$_.TypeName -eq “Access Database Service”} | Start-SPServiceInstance > $null

 Write-Host “Creating BCS Service and Proxy…”

New-SPBusinessDataCatalogServiceApplication -Name $bcsSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName “BusinessDataCatalogDB” > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Business Data Connectivity Service”} | Start-SPServiceInstance > $null

 Write-Host “Creating Excel Service…”
New-SPExcelServiceApplication -name $excelSAName –ApplicationPool $saAppPoolName > $null
 

Set-SPExcelFileLocation -Identity “http://” -ExcelServiceApplication $excelSAName -ExternalDataAllowed 2 -WorkbookSizeMax 10 -WarnOnDataRefresh:$true

Get-SPServiceInstance | where-object {$_.TypeName -eq “Excel Calculation Services”} | Start-SPServiceInstance > $null

Write-Host “Creating Metadata Service and Proxy…”

New-SPMetadataServiceApplication -Name $metadataSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName “MetadataDB” > $null
 

New-SPMetadataServiceApplicationProxy -Name “$metadataSAName Proxy” -DefaultProxyGroup -ServiceApplication $metadataSAName > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Managed Metadata Web Service”} | Start-SPServiceInstance > $null


 Write-Host “Creating Performance Point Service and Proxy…”

New-SPPerformancePointServiceApplication -Name $performancePointSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName “PerformancePointDB” > $null
 

New-SPPerformancePointServiceApplicationProxy -Default -Name “$performancePointSAName Proxy” -ServiceApplication $performancePointSAName > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “PerformancePoint Service”} | Start-SPServiceInstance > $null


##START SEARCH

Write-Host “Creating Search Service and Proxy…”
Write-Host ” Starting Services…”
Start-SPEnterpriseSearchServiceInstance $searchServerName
Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $searchServerName

Write-Host ” Creating Search Application…”
$searchApp = New-SPEnterpriseSearchServiceApplication -Name $searchSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName “SearchDB”
$searchInstance = Get-SPEnterpriseSearchServiceInstance $searchServerName

Write-Host ” Creating Administration Component…”
$searchApp | Get-SPEnterpriseSearchAdministrationComponent | Set-SPEnterpriseSearchAdministrationComponent -SearchServiceInstance $searchInstance


##Crawl
Write-Host ” Creating Crawl Component…”
$InitialCrawlTopology = $searchApp | Get-SPEnterpriseSearchCrawlTopology -Active
$CrawlTopology = $searchApp | New-SPEnterpriseSearchCrawlTopology
$CrawlDatabase = ([array]($searchApp | Get-SPEnterpriseSearchCrawlDatabase))[0]
$CrawlComponent = New-SPEnterpriseSearchCrawlComponent -CrawlTopology $CrawlTopology -CrawlDatabase $CrawlDatabase -SearchServiceInstance $searchInstance
$CrawlTopology | Set-SPEnterpriseSearchCrawlTopology -Active

Write-Host -ForegroundColor white ” Waiting for the old crawl topology to become inactive” -NoNewline
do {write-host -NoNewline .;Start-Sleep 6;} while ($InitialCrawlTopology.State -ne “Inactive”)
$InitialCrawlTopology | Remove-SPEnterpriseSearchCrawlTopology -Confirm:$false
Write-Host

 ##Query
Write-Host ” Creating Query Component…”
$InitialQueryTopology = $searchApp | Get-SPEnterpriseSearchQueryTopology -Active
$QueryTopology = $searchApp | New-SPEnterpriseSearchQueryTopology -Partitions 1
$IndexPartition= (Get-SPEnterpriseSearchIndexPartition -QueryTopology $QueryTopology)
$QueryComponent = New-SPEnterpriseSearchQuerycomponent -QueryTopology $QueryTopology -IndexPartition $IndexPartition -SearchServiceInstance $searchInstance
$PropertyDatabase = ([array]($searchApp | Get-SPEnterpriseSearchPropertyDatabase))[0]
$IndexPartition | Set-SPEnterpriseSearchIndexPartition -PropertyDatabase $PropertyDatabase
$QueryTopology | Set-SPEnterpriseSearchQueryTopology -Active

 Write-Host ” Creating Proxy…”
$searchAppProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name “$searchSAName Proxy” -SearchApplication $searchSAName > $null


#####END SEARCH


Write-Host “Creating State Service and Proxy…”
New-SPStateServiceDatabase -Name “StateServiceDB” -DatabaseServer $databaseServerName | New-SPStateServiceApplication -Name $stateSAName | New-SPStateServiceApplicationProxy -Name “$stateSAName Proxy” -DefaultProxyGroup > $null

 Write-Host “Creating Secure Store Service and Proxy…”

New-SPSecureStoreServiceapplication -Name $secureStoreSAName -Sharing:$false -DatabaseServer $databaseServerName -DatabaseName “SecureStoreServiceAppDB” -ApplicationPool $saAppPoolName -auditingEnabled:$true -auditlogmaxsize 30 | New-SPSecureStoreServiceApplicationProxy -name “$secureStoreSAName Proxy” -DefaultProxygroup > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Secure Store Service”} | Start-SPServiceInstance > $null
#USER PROFILE SERVICE Creation commented out because there are still known issues
with creating it via powershell
 #Write-Host “Creating User Profile Service and Proxy…”
#$userProfileService = New-SPProfileServiceApplication -Name $userProfileSAName -ApplicationPool $saAppPoolName -ProfileDBServer $databaseServerName -#ProfileDBName “ProfileDB” -SocialDBServer $databaseServerName -SocialDBName “SocialDB” -ProfileSyncDBServer $databaseServerName -ProfileSyncDBName “SyncDB”
#New-SPProfileServiceApplicationProxy -Name “$userProfileSAName Proxy” -ServiceApplication $userProfileService -DefaultProxyGroup > $null
#Get-SPServiceInstance | where-object {$_.TypeName -eq “User Profile Service”} | Start-SPServiceInstance > $null

 Write-Host “Creating Visio Graphics Service and Proxy…”

New-SPVisioServiceApplication -Name $visioSAName -ApplicationPool $saAppPoolName > $null
 

New-SPVisioServiceApplicationProxy -Name “$visioSAName Proxy” -ServiceApplication $visioSAName > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Visio Graphics Service”} | Start-SPServiceInstance > $null

 Write-Host “Creating Web Analytics Service and Proxy…”
$stagerSubscription = “”
$reportingSubscription = “”

New-SPWebAnalyticsServiceApplication -Name $WebAnalyticsSAName -ApplicationPool $saAppPoolName -ReportingDataRetention 20 -SamplingRate 100 -ListOfReportingDatabases $reportingSubscription -ListOfStagingDatabases $stagerSubscription > $null

New-SPWebAnalyticsServiceApplicationProxy -Name “$WebAnalyticsSAName Proxy” -ServiceApplication $WebAnalyticsSAName > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Web Analytics Web Service”} | Start-SPServiceInstance > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Web Analytics Data Processing Service”} | Start-SPServiceInstance > $null

 Write-Host “Creating Word Conversion Service and Proxy…”

New-SPWordConversionServiceApplication -Name $WordAutomationSAName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName “WordAutomationDB” -Default > $null
 

Get-SPServiceInstance | where-object {$_.TypeName -eq “Word Automation Services”} | Start-SPServiceInstance > $null
############################################## End Script

Now proceed to manually configuring your service applications (e.g. the Secure Store Service for Excel Services, Visio graphics, and performance point. The managed meta data service for a content type hub)

See this post starting at step 8 for steps to configure the  User Profile Service

Saturday, November 23, 2013

Links to Software to create a home lab

Pre-requisite:  A server with at least 16 GB of RAM
 



http://technet.microsoft.com/en-us/evalcenter/default - all Evaluation Software

http://technet.microsoft.com/en-US/evalcenter/dn407368 - previous editions (e.g. windows server 2008 R2, Sharepoint 2010, etc)


Here are your  high level steps:

On your server with 16-32 GB of ram and xeon processors, run up either Vmware, or install Windows Server 2012 Datacenter and install the Hyper-V role

Then create a VM and
Install DNS or just wait for active directory to install it on your first DC
Install Active Directory Domain Services,



Create another domain controller and join it into the domain for redundancy
Create some Host (A) records in DNS

Start creating your vm’s for your farm
Install Windows
Install SQL
Install SharePoint

Saturday, November 16, 2013

What are Crawled Properties, iFilters, and Connectors in SharePoint 2010?

This post lists links to various TechNet resources, along with a brief  regarding each resource:


Crawled Properties:  this page details the properties that are included in the index by default.  You can modify the default properties to provide a richer index that is targeted in relation to your objectives.

For example, is a person's work phone or job title part of the default content that is indexed from MySites?  check this page to find out.

http://technet.microsoft.com/en-us/library/hh134087(v=office.14).aspx

to change that, click on Metadata Properties off the Search Service Administration page, available by navigating to Application management > Manage Service Applications

Default iFilters:  this page details the file types that are supported by default. And, it lists whether the file types are included in the search administration file types page under the "file type included by default" column.  If you don't see your file type listed, (e.g. adobe acrobat pdf), you have to download and install the iFilter, an image file for the crawl server to use next to pdf's, and then register the iFilter in registry.

http://technet.microsoft.com/en-us/library/gg405170(v=office.14).aspx

Default connectors:  this page explains the various types of connectors that are supported out of the box.  Ever wonder what sps3 was for?  check out this page.

http://technet.microsoft.com/en-us/library/gg153530(v=office.14).aspx

Saturday, November 9, 2013

Move SharePoint Server IIS to a different drive

To move IIS to a different drive is a fairly straightforward procedure.

This blog - -> http://blogs.iis.net/thomad/archive/2008/02/10/moving-the-iis7-inetpub-directory-to-a-different-drive.aspx has detailed the steps very neatly.

In a nutshell, and to adapt them to a SharePoint install, here is what I recommend.

1. Run the SharePoint pre-requisite installer and say no to running the SharePoint products and Technologies Wizard.

2. Run the MoveIIS7root.bat from the site above

3. Use xcopy to copy all content to the new location

4. Verify that E:\inetpub was created, and verify ACL's and content with what is on C:\InetPub

5. navigate to HKLM\Software\Microsoft\InetSTP and make sure physical path to IIS is set to the path you selected when running MoveIIS7root.bat and verify that it does not contain two \\'s.  it should read e:\ not e:\\

6. Verify that you can delete the C:\InetPub folder, and if you can not, then take ownership starting at the deepest directories and work your way up to the C:\inetpub, deleting as you go.

7. Stop and start www service (sc stop w3svc, sc query w3svc, then after is stopped, sc start w3svc - or via services.msc)

8. Stop and start IIS admin service (sc stop iisadmin, sc query iisadmin, sc start iisadmin)

9. Restart server, make sure recovery settings for services are set to restart on failures
.
10. Continue with the SharePoint install by running the SharePoint Product and Technologies Wizard

Saturday, November 2, 2013

How to - IIS moving sites and applications

In this completely, hypothetical, situation, you are the web administrator for a website named ChiNet.  Chinet is an old, antiquated site, but you love it nonetheless and want to move it to a completely different server.  The URL to Chinet is http://chinet.yourdomain.com

1. Open inetmgr (iis manager)

2. Then right click on the web you want to move to another server, or right click on the entire server if you want

3. Click on deploy and if you dont see deploy, click here

4. Click on export application

5. Copy the zip file to your destination server

6. Make sure the physical path to your web exists, and any local users and groups exist, on the destination server (e.g. d:\inetpub\chihome\wwwroot  or whatever, and then the local users) - - this would be the relative same physical path where the site was stored, only now it is on the new server.

7. Open iis manager (inetmgr)

8. Create a new site that points to the physical path that you created in step 6

9. Right click on the site, click deploy, click import application

10. Navigate to the location where you placed the zip file

11. Place the contents of it in the root (watch this, it will try to double root you, maybe  chihome/chihome,   remove the second chihome)

12. Next through

13. Begin enjoying your website named chinet on the new server

14. Get the cname record in dns switched to point to this servers host name (A record)

Saturday, October 26, 2013

A few Random development tricks - slighted trickery


CSS to block quicklaunch etc.


<style>
.ms-quicklaunch
{
display:none;
}
.ms-navframe
{
display: none;
}
.ms-globalTitleArea {
display: none;

}
</style> 

The following code is for a sharepoint redirect, just add it to a content editor web part

<meta http-equiv="refresh" content="10;url=http://MYSERVERNAME.com/Pages/default.aspx">

This code, below, taken from http://pathtosharepoint.com  will ADD the quicklaunch using a CEWP

<!-- Load and display Quick Launch - iframe version -->
<!-- Questions and comments: Christophe@PathToSharePoint.com -->
<!-- Paste the URL of the source page below: -->

< iframe id="SourcePage" style="display:none;" src="http://[YourSite]/default.aspx" onload="DisplayQuickLaunch()"></iframe>
<script type="text/javascript">
function DisplayQuickLaunch()
{
var placeholder = document.getElementById("LeftNavigationAreaCell");
var quicklaunchmenu = null;
var SourcePage = document.getElementById("SourcePage");
try {
   if(SourcePage.contentDocument)
      // Firefox, Opera

      {quicklaunchmenu = SourcePage.contentDocument.getElementById("LeftNavigationAreaCell") ;}
   else if(SourcePage.contentWindow)
      // Internet Explorer
      {quicklaunchmenu = SourcePage.contentWindow.document.getElementById("LeftNavigationAreaCell") ;}
   else if(SourcePage.document)
      // Others?
      {quicklaunchmenu = SourcePage.document.getElementById("LeftNavigationAreaCell") ;}
}
catch(err) { alert ("Loading failed");}
var allDescendants = quicklaunchmenu.getElementsByTagName("*");
for (i=0;i<allDescendants.length;i++) {
allDescendants[i].removeAttribute("id");
allDescendants[i].removeAttribute("onclick");
allDescendants[i].removeAttribute("onfocus");
allDescendants[i].removeAttribute("onmouseover");
}
placeholder.innerHTML = quicklaunchmenu.innerHTML;
}
</script>

Friday, October 18, 2013

Migrating to Windows 2008 R2 from a 32-bit (x86) Server


Overview

Since Windows 2008 R2 only comes in a 64-bit flavor it is impossible to perform an in place upgrade on a Server running on x86 architecture for P2V or for whatever reason.  As such, a migration to a new 64Bit server is required.  These are the two possible options:

  • Deploy a new machine and manually copy, recreate share permissions, Local users, groups etc.
  • Use Windows Server Migration tools to copy and create local users and groups, copy data, copy share and folder permissions, etc.

This document covers the second bullet point.

Prepare the Target:

  1. Deploy the target machine from an approved template.
  2. After target is joined into the domain, install Windows Server Migration tools feature:
  3. Open Server manager click on features, then click on add features
  4. Scroll down and select the migration tools option, as shown:
  5.  After selecting the Windows Server Migration tools, install it.
  6. Open a command prompt and navigate to c:\Windows\System32\ServerMigrationTools
  7. Share out a folder that the administrator account will be able to access across the network from the source machine, create this migration folder on the target server.  In other words, Just create a folder named migration, share it so that you’ll be able to access it from the source.
  8. Create the migration package, go back to your command prompt and into the server migration tools directory under system32 and input the following command.  Note: the shared folder used in this example is named Migration and is on the C:\
SmigDeploy.exe /package /architecture X86 /os WS03 /path C:\Migration



(Image of actual command being run in a window on  a machine that has the path to the servermigrationtools folder defined in its environment variable)

Prepare the Source

  1. Install powershell v 1.0 or higher on the source, go to this site http://support.microsoft.com/kb/968929 scroll towards the bottom and download and install the appropriate version of powershell for your servers architecture.  (WARNING: don’t install x64 architecture onto x86 machines or vice versa).  A restart is not needed to complete the install for version 2.0 powershell.
  2. Make sure .Net Framework 2.0 or higher is installed, if it isn’t go here and download the appropriate installer for you architecture: http://www.microsoft.com/net/download , A restart will be needed to complete the install.
  3. Navigate to the migration shared folder that you created on the target
  4. Copy the entire folder from within the migration folder to the C:\ drive of the source machine.  If you created a package to migrate from a windows Server 2003 32 bit machine the folder you will be copying in this step is named SMT_WS03_X86.
  5. Open a command prompt with admin priviledges (e.g. right click cmd.exe and choose run as administrator)
  6. Navigate into the folder that you just copied in step 2, (e.g. cd c:\smt_ws03_x86)
  7. Run the following command to register the tools in the 2003 machines registry

.\smigdeploy.exe

  1. This will register the migration tools and open a powershell command window allowing you to proceed to the next section.

Migrate Local users and groups

Migrate the local users and groups prior to migrating files, folders, IIS webs, ntfs permissions, and share permissions. 

Firewall Pre-Requisites

To do this you’ll need to run the following commands on your windows 2008 R2 target and might have to run one command on the 32 bit machine:

2008 or 2008 R2

netsh advfirewall firewall add rule name=ServerMigration(TCP-In) dir=in program=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe action=allow protocol=TCP localport=7000

 

netsh advfirewall firewall add rule name=ServerMigration(UDP-In) dir=in program=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe action=allow protocol=UDP localport=7000

The 2003 machine will more than likely not have the firewall enabled and as a result will not need this command.

2003

 

netsh firewall add allowedprogram program=%windir%\System32\WindowsPowerShell\v1.0\powershell.exe name="ServerMigration" mode=ENABLE

 

  1. In the powershell window that opened after you registered the migration package on the source computer enter the following command:

Export-SmigServerSetting -User All -Group -Path \\ServerName\Migration –Verbose

Notice: the –Path points to the server name and the migration share; so, if you shared your migration folder out as WindowsMigration, the path would be different.

  1. Go to the target server, open a Windows PowerShell session with elevated user rights. To do this, click Start, click All Programs, click Accessories, open the Windows PowerShell folder, right-click Windows PowerShell, and then click Run as administrator.
  2. Enter the following:

Add-PSSnapin Microsoft.Windows.ServerManager.Migration

(Note: this loads the server migration tools snap in into powershell)

Then enter,

Import-SmigServerSetting -User All -Group -Path c:\Migration –Verbose

Notice: the –Path points to C:\ drive and the migration folder since it is on this server

  1. Wait for the task to complete and then verify local users and groups from the source to the target
  2. Once you have verified that all users and groups were migrated, you’re ready to migrate files, folders, shares, etcetera

Migrate Files and folders

Source server – Step One

  1. In the elevated powershell window enter the following:

Send-SmigServerData -ComputerName <DestinationServer> -SourcePath d:\users -DestinationPath d:\ users -Recurse -Include All -Force

Note: <DestinationServer> = the netname of your destination server and there is a space in between/ in front of -, but it is hard to see.

Hint: If you make the source path the same as the destination path, the migration will create the folder on the destination and copy all files into the destination folder while creating all permissions, share permissions, and webs.  We found that running the send-smigserverdata prior to the receive works better in SSANet.

If this fails, reverse steps one and two.

Target Server – Step Two

  1. In an elaveted powershell window make sure you have the migration tools snap in loaded (see step 3 from the previous section).  Note: if you didn’t close the powershell window from the import you’re good to go.
  2. Enter the following within 5 minutes of kicking off the send

Receive-SmigServerData

All progress will be shown on the source server, don’t restart the server or close the powershell windows on either source or target.

References:

http://technet.microsoft.com/en-us/library/dd379474(v=ws.10).aspx  - Contains detailed instructions, including what was described in this document.
Technet Video on Migration tools install into a 32 bit or 64 bit server. - http://technet.microsoft.com/en-us/windowsserver/ee914657.aspx

Good luck and Cheers, Stacy

Popular Posts