Friday, August 3, 2018

Get IIS App Pool status of specific server in a SharePoint farm

Use below one line statement to get the App pool status on specific server in a farm. $name variable contains the fully qualified domain name of the server. Below example get the details of IIS application pool named "SharePoint Web Services Root".

$name = "<insert Server FQDN>";
$aps=Invoke-Command -ComputerName $name {Import-Module WebAdministration; Get-ChildItem IIS:\AppPools | where{$_.Name -eq "SharePoint Web Services Root"}}


Find SharePoint Server Name hosting Central Admin site using powershell.

Took me sometime to figure this out. I am using two commands in a single line statement to fetch the server name which is hosting central administration website in a SharePoint farm.

Note-: Output of this will show you two servers in case you have configured central admin on two servers in a farm.


Get-SPServer |where {(Get-SPServiceInstance -Server $_.Address |Where {$_.Status -eq "online" -And $_.TypeName -eq "Central Administration"}) }


Friday, April 20, 2018

set Lock State (No Access, ready only, no additions, unlock) of all site collections in a SharePoint farm using powershell

Normally site lock functionality is available at site collection level only and not at farm level or even web application level, I came across a requirement where in I was asked to lock all site collections in farm. Since my farm has more than 20000 site collection it would have been a tedious task if I had to to it manually one by one.

-----------------------------------------------------------------------------------------------------------------------
Have created a Powershell script to set the all site collection in a farm to "NO Access" mode.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue;
Start-SPAssignment -Global;
$webapps= Get-SPWebApplication;
$LockState= "NoAccess"; 
Write-Host "Setting all web applications to $($LockState)..." -ForegroundColor Yellow;
foreach ($webapp in $webapps)
{
$sites= Get-SPSite -WebApplication $webapp -Limit All;
$sites | ForEach-Object{
Write-Host "Setting site collection $_.Url to $($LockState)..." -ForegroundColor Yellow;
        Set-SPSiteAdministration -LockState $LockState -Identity $_.url;}
}
Stop-SPAssignment -Global;
Write-Host "Finished!" -ForegroundColor Green;

------------------------------------------------------------------------------------------------------------------------

Below are the valid values for LockState variable 

  • Unlock to unlock the site collection and make it available to users.
  • NoAdditions to prevent users from adding new content to the site collection. Updates and deletions are still allowed.
  • ReadOnly to prevent users from adding, updating, or deleting content.
  • NoAccess to prevent users from accessing the site collection and its content. Users who attempt to access the site receive an error message.

Get Site collection count in a farm

Use the below script to get count of all site collections in a farm.
$AllWA = Get-SPWebapplication;
foreach($wa in $AllWA){$WA.Sites | Measure-Object | Format-List Count};

Thursday, December 7, 2017

Fix:Failed to Sql Query data XEvent collector on SQL server. The error is Object reference not set to an instance of an object.

This is a common error message you will see in ULS logs. The reason for this error are the diagnostics jobs which need Serveradmin/sysadmin role to be granted to Farm admin account. it would make sense to grant farm account server admin role on sql server if we are interested to get the data which these diagnostics jobs collect. But in most of the cases I have found that we would not need these jobs nor we would like to grant farm account sysadmin role on SQL server. This issue common to both SharePoint 2010 and SharePoint 2013.

To get list of diagnostics jobs execute the below powershell command

PS C:\Windows\system32> Get-SPDiagnosticsProvider

Name                                                    Retention  MaxTotalSi Enabled   
                                                                   zeInBytes            
----                                                    ---------  ---------- -------   
job-diagnostics-blocking-query-provider                 15         6200000000 False     
job-diagnostics-sql-dmv-provider                        15         1000000... True      
job-diagnostics-uls-provider                            15         1000000... True      
job-diagnostics-performance-counter-sql-provider        15         6200000000 True      
job-diagnostics-performance-counter-wfe-provider        15         1000000... True      
job-diagnostics-event-log-provider                      15         6200000000 True      
job-diagnostics-changed-objects-provider                15         6200000000 True      
job-diagnostics-sql-blocking-report-provider            15         6200000000 True      
Search Health Monitoring - Trace Events                 15         1290000... True      
job-diagnostics-io-intensive-query-provider             15         1000000... True      
job-diagnostics-change-types-provider                   15         6200000000 True      
job-diagnostics-sql-memory-provider                     15         1000000... False     
job-diagnostics-sprequestusage-provider                 15         6200000000 True      
job-diagnostics-sql-deadlock-provider                   15         6200000000 True    
In order to get rid of the error message from ULS logs, either we need to grant farm account sysadmin role on SQL server or disable the diagnostics jobs.

Use the below script to disable the diagnostic jobs.

providers = Get-SPDiagnosticsProvider
foreach($provider in $providers)
{
   if(($provider.Name -eq "job-diagnostics-sql-blocking-report-provider") 
-or ($provider.Name -eq "job-diagnostics-io-intensive-query-provider") 
-or ($provider.Name -eq "job-diagnostics-sql-deadlock-provider"))
    {
        $provider.IsDisabled = $true;
        $provider.Update();
    }
}
Now execute the Get-SPDiagnosticsProvider command to make sure that enabled attribute is set to false.

Tuesday, July 4, 2017

Change Top Bar text of Central Administration site.

Use the below powershell commands to change the top bar text of central admin site. I use this text to concur the farm environment, like test, QA or Prod

$ca= Get-SPWebApplication -IncludeCentralAdministration | ?{$_.IsAdministrationWebApplication -eq $true};

$ca.SuiteBarBrandingElementHtml = “<div class=’ms-core-brandingText’>Central Administration- QA</div>“;

$ca.Update();



Sunday, October 16, 2016

Install SharePoint 2013 with Product key that has number of allowed installation exceeded--SharePoint 2013-AutoSPInstaller product bug(not recommended)

Note-: Please try this at your own risk. this is no means to promote piracy. I hope Microsoft fixes this bug with future patches/installation media.

Recently I had a situation where in customer had already initiated purchase of SharePoint license key as the number of installations had exceeded the number of permitted installation with the existing product key. if we try to use this key in SharePoint installation wizard, it will promptly give us an error message stating the key is invalid. since number of valid/allowed installations is already over.

I normally use AutoSPInstallater for SharePoint installation as I prefer having meaningful database names and also having one single script to install and provision sharePoint services.

So here come the bug part. I used this license key in AutoSPinstaller and SharePoint does not complains about it and proceeds with installation and provisioning of service application.

No issues detected while running sharepoint. After few days we got a new valid product key and we replaced it in farm.

Always please use genuine products as product developers deserve to be paid for hard work which has gone into making these softwares.

This article is just to highlight the product bug which I discovered in SharePoint 2013 and I hope MS will improve SharePoint by fixing this.

Restore Site collection backup from Lower to Higher SharePoint CU version 2013 and vice versa

Recently I had faced an issue where QA and test were on May 16 CU where as Prod was on March 15 CU. With SharePoint 2013, it does not allows to restore site collection backups if both source and destination farms have different SharePoint version like in above case and we will get error when use Restore-SPSite command.

There are two way to solve this issue....

1) Database copy approach 

This approach is pretty simple. you need to take backup of database having site collection you want to restore and restore database in destination SQL server. Mount database with desired web application and upgrade database using powershell.

2) Hack site collection backup file

  • Backup your site collection from Source farm using Backup-SPSite command.
  • Download HXD editor for editing backup file which is in hexadecimal format.
  • Post installing HXD, Run it.
  • Open site collection backup file in above tool
  • Site collection backup file should look something like below...
  • image
  • If we try to find the version, which we got from error message from the log, we will find that it is located in the beginning of the file
  • best things about backup file version is that version is stored only once and that too at beginning of file.
  • change source version to the target in the hex editor now.
  • image
  • If you unsure about target SharePoint version, you can get from central admin-->Upgrade and Migration-->Check product and patch installation status
  • Or you can take site collection backup of any blank site in destination farm and open with HXD to get SP version number.
  • Once source SP version is replaced with destination SP version save the backup file in HXD.
  • Run the Restore-SPSite command again and site collection would be restored without any issues.


Wednesday, August 3, 2016

This page can't be displayed - Turn on TLS 1.0, TLS 1.1, and TLS 1.2.....SharePoint-problems with SSL negotiation.

This is one of the issues I have faced lately where in users used to get error (mentioned in subject) when they tried to browse the SharePoint site hosted over https. In my case we had a two server farm (app and WFE). upon initial investigation we found that whenever the load balancer was forwarding request to WFE, user used to get TSL error, Pages displayed properly when the request was forwarded to app server. Strange things was the TSL protocols were already enabled in user's internet explorer.

IIS settings were same on both server (when I have checked/compared with IISCrypto tool). user request did not even reached the IIS or SharePoint layer as I could not see any log entries in either IIS or SharePoint logs. from IIS console prospective its had same SSL certificate and all settings just looked fine.

Decided to use  WireShark Tool to see the network traffic and to check is the request were reaching server or not. I had modified host file of my laptop for site URL to point it directly to server (which was having issues), bypassing the load balancer.

Important thing which I noticed with Wireshark packet capture was that Client's PC sent request (client hello packet) and server sends ACK packet (acknowledging the the web request). but next packet just after that ACK is a FIN and ACK packet, which indicated the server was gracefully closing/finishing the session. And post that client also acknowledges the FIN flag.

In order to understand why server was setting FIN flag was time since one has to understand SSL negotiation architecture and understand how it internally works. You can follow this link to understand SSL architecture.

So in my case first phase of SSL negotiation (client hello) went successfully. but did not see server hello in wireshark logs. instead saw FIN flag.

So my investigation initiated with 2nd phase where http.sys does reading before server sends out a server hello packet.

Normally if you have a site with SSL binding and an IP assigned to it. there will be a corresponding registry key as well in the registry which Http.sys read to know what SSL cert is assigned to the IIS site. What I noticed was in my case was this registry specific to my site was missing from registry even though I have tried rebinding the SSL certificate to site in IIS. IIS was just not creating the key.

Registry key that HTTP.sys check looks like below format

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\SslBindingInfo\<IP address:SSLport number>

Finally I had to manually add this key to registry and site started working after this.

Tuesday, April 12, 2016

Get Web application people picker settings using Powershell

Below command will get all Web Applications and show the people picker settings for each one

Get-SPWebApplication -IncludeCentralAdministration | %{Write-Host $_.url; $_.peoplepickersettings | select * | fl }


Set people picker at web application level

#Get WebApplication name where you want to fix this issue
$webApp = Get-SPWebApplication http://server:port


# we need to repeat the following block for all the domains you want People Picker to work for on this particular web app
# ——————————————————————————————————————————
$domainInfo = new-object Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain
$domainInfo.DomainName ='domain.net';  # specify the fqdn
$domainInfo.ShortDomainName ='domain'; # specify the netbios name

# =====================================
# This section is only required if there is a one-way trust to the domain and the application pool account does not have access

# First you have to run setapppassword on every server in the farm.
# This sets the encryption key used with the password you enter for the account you specify for $newdomain.loginname
stsadm -o setapppassword -password "Password"
# Where <password> is any string you want to use as an encryption key.
# This needs to be run on every server using the same value for <password>

$domainInfo.loginname = 'domain\sp_farm' # Specify an account that has access to the remote domain
# Do not change anything in the next two lines, it will prompt you to enter the password.
[System.Security.SecureString]$secureStringValue = Read-Host “Enter the account password: ” -AsSecureString
$domainInfo.setpassword($secureStringValue)
# =====================================

$webApp.PeoplePickerSettings.SearchActiveDirectoryDomains.Add($domainInfo)
# Repeat end
# ——————————————————————————————————————————-
# Finally save settings for the web app
$webApp.update()

Friday, April 10, 2015

list all site collections in all databases of database server using Powershell

Someone asked me how to retrieve list of all site collection residing in all content database of a database server. So have prepared a small script for this...

To Get the list of server execute below command

Get-SPServer

Above command will list all server in the farm.

Copy the SQL/Database server you intend to query...

$DBServerInstance = "XXXXXXXX"

Replace xxxx with the database server name/Alias if you are using alias.

$dbserver = Get-SPDatabase –ServerInstance $DBServerInstance

foreach ($db in $dbserver)
  {
                $db
                Get-SPSite –ContentDatabase $db – Limit all | Select URL

  }

You can redirect the output of foreach loop contents to a text file.


Wednesday, February 5, 2014

Download all InfoPath within SharePoint Web Application using PowerShell

Below PowerShell script can be used to download/Backup all infoPath forms residing within a Web Application with a folder structure similar to the URL.

========================================================================

#Change below url to your web app URL
$SPWebApp = Get-SPWebApplication ('https://YourWebApplication.com/')
$destination = "d:\\temp\\InfoPathBackup\\"

"Site Name`tList Name`tUrl`tDocs`tLast Mod`tWF`tLive WF`tLive WF Names`tTemplate" > d:\temp\AllIPDocLibs.csv

#loop through each site in the site collection
 $cnt = $SPWebApp.Sites.count.toString()
  "Total Site collection -: $cnt "
foreach ($SPSite in $SPWebApp.Sites) #loop through all site collection
{
   $cnt = $SPSite.allwebs.count.toString()
  "Total number of Sites in collection -: $cnt "
   $SiteTitle = $SPSite.url.toString()
   "PROCESSING Site collection $SiteTitle"
 
$url = $SiteTitle
$req = [system.Net.WebRequest]::Create($url)
$req.UseDefaultCredentials = $true
try {
       $res = $req.GetResponse()
     } catch [System.Net.WebException] {
       $res = $_.Exception.Response
     }

if ( $res.StatusCode -eq "OK" )
{
  $ErrorActionPreference="SilentlyContinue"
   foreach($webs in $SPSite.allwebs)
   {
       
#use this for output
$webTitle = $webs.title.toString()
"PROCESSING site $webTitle"

#loop though each list in the current website
for($i=0;$i -ne $webs.lists.count;$i++)
{
$list = $webs.lists[$i]
#this is used for output and to make the code a little more readable
$listTitle = $list.toString()
$listUrl = $list.DefaultViewUrl
$listCount = $list.ItemCount

if( $list.BaseType -eq "DocumentLibrary"  -and
$list.BaseTemplate -eq "XMLForm")
{
$listModDate = $list.LastItemModifiedDate.ToShortDateString()
$listTemplate = $list.ServerRelativeDocumentTemplateUrl
$listWorkflowCount = $list.WorkflowAssociations.Count
$listLiveWorkflowCount = 0
$listLiveWorkflows = ""
foreach ($wf in $list.WorkflowAssociations)
{
if ($wf.Enabled)
{
$listLiveWorkflowCount++
if ($listLiveWorkflows.Length -gt 0)
{
$listLiveWorkflows = "$listLiveWorkflows, $($wf.Name)"
}
else
{
$listLiveWorkflows = $wf.Name
}
}
}
"$webTitle`t$listTitle`t$listUrl`t$listCount`t$listModDate`t$listWorkflowCount`t$listLiveWorkflowCount`t$listLiveWorkflows`t$listTemplate" >> d:\temp\AllIPDocLibs.csv
#Downloading file to local drive
#Ensure destination directory
        $destinationfolder = $destination + "/" + $listUrl.Substring(0,$listUrl.LastIndexOf("/"))
$file.Name = $listTemplate.Substring($listTemplate.LastIndexOf("/") + 1)
        if (!(Test-Path -path $destinationfolder))
        {
            $dest = New-Item $destinationfolder -type directory
      }
#Download file
$binary = $file.OpenBinary()
$stream = New-Object System.IO.FileStream($destinationfolder + "/" + $file.Name), Create
$writer = New-Object System.IO.BinaryWriter($stream)
$writer.write($binary)
$writer.Close()
}
}
$webs.Dispose()
    }
}
else
   {  Add-Content d:\temp\DeadSites.txt "`n $SiteTitle" } #dead or inaccessible sites encountered during loop.
    $SPSite.Dispose()
}
    [GC]::Collect()
#Dispose of the site object
$SPWebApp.Dispose()
"Done"
========================================================================

Get list of all InfoPath forms (with URL/Path) within a Web application-SharePoint using PowerShell

Below script helps to get list of infopath forms within a web application with their path/URL. Script also collects the names of dead/inaccessible sites (which the scripts encounters during the looping of all site collections within the web application) and outputs into a text file.

========================================================================
#change the URL to match web application where you would like to search InfoPath forms
$SPWebApp = Get-SPWebApplication ('http://yourwebapplication.com/') 

"Site Name`tList Name`tUrl`tDocs`tLast Mod`tWF`tLive WF`tLive WF Names`tTemplate" > d:\temp\AllIPDocLibs.csv

#Loop through each site in the site collection
 $cnt = $SPWebApp.Sites.count.toString()
  "Total Site collection -: $cnt "
foreach ($SPSite in $SPWebApp.Sites) #loop through all site collection
{
   $cnt = $SPSite.allwebs.count.toString()
  "Total number of Sites in collection -: $cnt "
   $SiteTitle = $SPSite.url.toString()
   "Processing Site collection $SiteTitle"
   
$url = $SiteTitle
$req = [system.Net.WebRequest]::Create($url)
$req.UseDefaultCredentials = $true
try {
       $res = $req.GetResponse()
     } catch [System.Net.WebException] {
       $res = $_.Exception.Response
     }

if ( $res.StatusCode -eq "OK" )
{
  $ErrorActionPreference="SilentlyContinue"
   foreach($webs in $SPSite.allwebs)
   {
        
#use this for output
$webTitle = $webs.title.toString()
"PROCESSING site $webTitle"

#loop though each list in the current website
for($i=0;$i -ne $webs.lists.count;$i++)
{
$list = $webs.lists[$i]
#variables for output.
$listTitle = $list.toString()
$listUrl = $list.DefaultViewUrl
$listCount = $list.ItemCount

if( $list.BaseType -eq "DocumentLibrary"  -and
$list.BaseTemplate -eq "XMLForm")
{
$listModDate = $list.LastItemModifiedDate.ToShortDateString()
$listTemplate = $list.ServerRelativeDocumentTemplateUrl
$listWorkflowCount = $list.WorkflowAssociations.Count
$listLiveWorkflowCount = 0
$listLiveWorkflows = ""
foreach ($wf in $list.WorkflowAssociations)
{
if ($wf.Enabled)
{
$listLiveWorkflowCount++
if ($listLiveWorkflows.Length -gt 0)
{
$listLiveWorkflows = "$listLiveWorkflows, $($wf.Name)"
}
else 
{
$listLiveWorkflows = $wf.Name
}
}
}
"$webTitle`t$listTitle`t$listUrl`t$listCount`t$listModDate`t$listWorkflowCount`t$listLiveWorkflowCount`t$listLiveWorkflows`t$listTemplate" >> d:\temp\AllIPDocLibs.csv
}
}
$webs.Dispose()
    }
}
else
   {  Add-Content d:\temp\DeadSites.txt "`n $SiteTitle" }
    $SPSite.Dispose()
}
    [GC]::Collect()
#Dispose of the site object
$SPWebApp.Dispose()
"Done"
========================================================================

Find last login timestamp for service/user account from Active directory using PowerShell

Below script will be helpful in finding the last login timestamp of the users/service accounts used by SharePoint farm. This script helps us in identifying orphan accounts which can deleted or reused elsewhere.

Logic of this script is pretty simple. Read the XML file having list of Active directory accounts. Loop through each domain controller and check and compare for the value of lastlogin with other DC. the one with the highest value is the last login timestamp value for that account. Finally the output of this is stored in a txt file.
============PowerShell Script================================================
Import-Module ActiveDirectory

$Path = "D:\Sharepoint\Lastlogintimestamp\sharepointUsers.xml"
# load it into an XML object:
$xml = New-Object -TypeName XML
$xml.Load($Path)
# note: if your XML is malformed, you will get an exception here
# always make sure your node names do not contain spaces
$rsltObj = New-Object PSObject;
$results = @();
$hostname ="";
$user =$Null;
# simply traverse the XML nodes and loop through account names:
foreach ($node in $xml.Accounts.ChildNodes) 
{
$username = $node.InnerText;
write-host "Checking last login time for....  $username `n";
$dcs = Get-ADDomainController
  $time = 0
  foreach($dc in $dcs)
  { 
    $hostname = $dc.HostName
      $user = Get-ADUser $userName | Get-ADObject -Server $hostname -Properties lastLogon;
if( $user -ne $Null)
{
if($user.LastLogon -gt $time) 
{
   $time = $user.LastLogon
   $hostname = $dc.HostName
}
}
  }
$dt = [DateTime]::FromFileTime($time)
$rsltObj= "$username last logged on at: $dt authenticated by $hostname `n";
write-host $rsltObj;
$results += $rsltObj;
}
$results | Out-File C:\temp\SharePoint-Lastlogintimestamp.txt;
Write-host "Data saved in c:\temp\SharePoint-Lastlogintimestamp.txt";
========================================================================

===================XML File format========================================
<?xml version="1.0" encoding="UTF-8" ?>
<Accounts>
<Name>SP_Farm</Name>
<Name>SP_Service</Name>
<Name>SP_Search</Name>
</Accounts>
======================================================================
You can add more XML nodes to xml file to add more accounts which you would like to check.

Thursday, June 27, 2013

How to check If blackberry phone is unlocked

To determine if your BlackBerry is "unlocked" for use on carriers other than for which it is branded:

1. On your BlackBerry, go to Options > Advanced Options > Sim Card.

2. At that screen type MEPD (see note below) on your keyboard. A new menu will pop up.
* If your BlackBerry has a SureType keyboard (71xx and 81xx devices) you will need to double-tap the P, so the actual keys entered become M E P P D. 

3. Look for Network in the list.

4. If your device is "unlocked", it should say Disabled or Inactive. If it says Active, it's still locked to that carrier. 

Monday, May 27, 2013

SharePoint 2013 Workflow Manager configuration (Server /client)

1.              Workflows in SharePoint 2013


Workflows in SharePoint 2013 allow you to model and automate business processes. These business processes can be as simple as a document approval process with a single approver (shown in below figure), as complex as customer-facing product catalog using web service calls and database support, or as formidable as virtually any structured business process, full of conditions, loops, user inputs, tasks, and custom actions.

A simple SharePoint workflow
powerful new foundation for SharePoint workflows. Build on Windows Workflow Foundation. Workflow Manager Client 1.0 provides advantages over previous versions that reflect the commitment of SharePoint to the model for apps for SharePoint and cloud-based computing.

1.              Workflow Manager 1.0

Workflow Manager 1.0 is a new server which introduces new capabilities for authoring, hosting and managing workflows. These workflows will run at high scale and density, and will support execution in a multi-tenant environment. The service builds on the successful programming model, runtime and activity library that was introduced with Windows Workflow Foundation (WF) in .NET Framework 4.

Workflow Manager 1.0 is used by SharePoint 2013 to run SharePoint workflows, and will be an inherent part of most Office 365 subscriptions.

High-level architecture of the workflow infrastructure

Obove image depicts a high-level view of the SharePoint 2013 workflow framework. Notice, first, how the new workflow infrastructure introduces Workflow Manager Client 1.0 as the new workflow execution host. Whereas in previous versions workflow execution was hosted in SharePoint itself, this has changed in SharePoint 2013. Workflow Manager Client 1.0 is external to SharePoint and communicates using common protocols over the Windows Azure service bus, mediated by OAuth. Notice that there is also an implementation of the SharePoint 2010 workflow host (that is, the Windows Workflow Foundation 3 engine) for backward compatibility.

Workflow Manager Client 1.0 is represented in SharePoint 2013 in the form of the Workflow Manager Client 1.0 Service Application Proxy. This component allows SharePoint to communicate and interact with the Workflow Manager Client 1.0 server. Server-to-server authentication is provided using OAuth.

SharePoint events for which a workflow is listening, like itemCreateditemUpdated, and so on, are routed to Workflow Manager Client 1.0 using the Windows Azure service bus. For the return trip, the platform uses the SharePoint Representational State Transfer (REST) API to call back into SharePoint.

There are also additions to the SharePoint workflow object model, called collectively the Workflow Services Manager, which allow you to manage and control your workflows and their execution. The primary zones of interaction for the services manager are deployment, messaging, instance control, and interoperability with SharePoint 2010 workflows.

Finally, there is the workflow authoring component. SharePoint Designer can now create and deploy both SharePoint 2010 and SharePoint 2013 workflows. Visual Studio 2012 not only provides a designer surface for creating declarative workflows, but it can also create apps for SharePoint and solutions that fully integrate Workflow Manager Client 1.0 functionality.

1.              Prerequisites for Workflow Manager 1.0 Installation


Web Platform Installer checks for these prerequisites before it installs Workflow, and it automatically installs any prerequisites that it does not find. You do not need to install any prerequisites separately.
·         .NET Framework 4 Platform Update 3 or .NET Framework 4.5
·         Service Bus 1.0
·         Workflow Client 1.0
·         PowerShell 3.0
The following additional requirements must be met before you can run Configuration Wizard to configure Workflow:
·         Instance of SQL Server 2008 R2 SP1, SQL Server Express 2008 R2 SP1, or SQL Server 2012.
·         TCP/IP connections or named pipes must be configured in SQL Server.
·         Windows Firewall must be enabled.
·         Ports 12290 and 12291 must be available.

The following topologies are supported:
·         SQL Server can be installed on the same physical machine with Workflow 1.0 and Service Bus, or on a different one.
·         The Service Bus databases can reside on multiple machines as well. All of them need not be created on a single database server.

For more information on system requirements for installing and configuring Workflow Manager 1.0 follow this MSDN article.

2.              Online Installation of Workflow Manager 1.0


1.            You can install Workflow Manager by clicking this installation link.
a)      If Web Platform Installer 4.5 (Web PI) is not installed on the computer, clicking the link initiates the installation for Web PI. After you accept the license terms and the installation of Web PI completes, the prerequisite page for Workflow Manager 1.0 starts.
b)      If Web PI 4.5 is already present on the computer, clicking the link starts the prerequisite installation page for Workflow Manager 1.0.
If the computer has an older version of Web PI, clicking on the installation link will start a prompt for upgrading Web PI. Accept it to continue with the installation.
               2.       The Prerequisites dialog appears with a list of prerequisite components that are not present on your computer but that Web PI downloads and installs, including third-party components for which you have not accepted licensing terms.
Check the components and click the I Accept button at the bottom of the dialog to accept the license terms. 

Click View license terms beneath any component to read the licensing terms for that component before you accept the terms.
Depending on the prerequisites that Web PI installs, you may need to reboot your machine, or your machine may reboot automatically. After the machine reboots run Configuration Wizard manually to configure the installation.

1.               Web PI downloads and installs any missing prerequisites, then installs Workflow Manager.
2.               When the missing prerequisites and Workflow Manager are installed you can startConfiguration Wizard. Click the Continue button to start the wizard.
Web PI starts Configuration Wizard. The following Web PI dialog indicates that the installation and configuration have completed successfully.
1.               Click Finish to end the installation process.

1.              Offline Installation of Workflow Manager 1.0


Workflow Manager 1.0 is installed using the Microsoft Web Platform Installer 4.5. If the target machine does not have internet access (for example for security reasons), then the online Web PI installation of Workflow Manager cannot be used, and the components must be installed offline. This section describes how to download the required components and perform an offline installation of Workflow Manager 1.0.

To download the files
1.      On a machine with internet access, download the Web Platform Installer v4 command line (WebPICMD.exe) and expand the files to a new folder.


Warning
If you have WebPI v3 or v4 installed, do not extract these files to the existing WebPI directories. Please extract the files to a new directory.
2.      Open an elevated command line prompt and navigate to the folder where WebPICMD.exe was extracted in the previous step and enter the following command.

webpicmd /offline /Products:WorkflowManager /Path:c:\WorkflowManagerFiles

The Path command line parameter specifies the location of the downloaded files. If the specified folder does not already exist it is created. In this example theC:\WorkflowManagerFiles path is used.

To copy the files to the target machine
Note
The steps in this procedure may be skipped if the steps in To download the files were performed on the target machine. If the files were downloaded on a different machine, then the steps in this procedure must be followed to copy the files along with WebPICmd.exe to the target machine.

Copy the folder and all subfolders and files from step 2 of To download the files to a folder on the target machine.
Note
It is not necessary to copy WebPICmd.exe to the target machine as it is included as part of the files downloaded in step 2 of To download the files.
1.      To install the files
2.      On the target machine, open an elevated command line prompt and navigate to thec:\WorkflowManagerFiles\bin folder. (If you used a different folder, replace C:\WorkflowManagerFiles with the name of the folder that you used.)
3.      Run the following command.
WebpiCmd.exe /Install /Products:WorkflowManager /XML:c:/WorkflowManagerFiles/feeds/shadow-webproductlist.xml
The XML command line parameter specifies the location of the downloaded files. Replace the first part of the path (in this example it is C:\WorkflowManagerFiles) with the folder name on your target machine.
Once the installation completes, Workflow Manager 1.0 can be configured by following the steps at Configuring Workflow Manager 1.0 using Configuration Wizard or Configuring Workflow Manager 1.0 using PowerShell.

2.              Configure Workflow Manager 1.0 Using Wizard


Warning
You can either configure Workflow Manager using Workflow Configuration Wizard or PowerShell. Using them interchangeably is not supported.

After Web PI/offline installer finishes installing Workflow Manager it automatically runs the Workflow Manager Configuration Wizard. You can also start Workflow Manager Configuration Wizard manually at any time. Use the following procedure:
·         Open the Start menu.
·         In All Programs, go to Workflow Manager 1.0. Click the Workflow Configuration shortcut to start Workflow Configuration Wizard.

The configuration adds your machine to a new or existing server cluster, known as a farm. If you decide to create a new farm, you can either choose to use the default settings or enter custom values for settings that identify and configure the farm you are creating. The Workflow Manager Configuration Wizard supports the following operations.

2.1.           Create a New Farm

Workflow Configuration Wizard creates a new farm and assigns the server on which you have installed Workflow Manager to the new farm. You are required to run this process only once per farm, before you add nodes to the farm.
You can create a farm using defaults for many of the required settings, or you can add additional customizations to the new farm by specifying values for those settings.
If an error occurs or you are forced to reboot during the farm creation, the farm management database that is created may be left in a corrupt state. In that case, when you try to join a farm the process may display an error that says that the machine you are trying to add to the farm is not a part of any farm. When you encounter such an error, you must drop the farm management database and recreate it before you can join any new nodes to the farm.
With Default Settings-:
When you create a new farm using the default configuration settings, both the Workflow Manager and Service Bus farms are created using the same settings. Use the following procedure to create a new farm and assign the Workflow Manager server to the farm using the default settings.
      1.     Select Configure Workflow Manager Farm with Default Settings (Recommended).New Farm Configuration page appears.
2.      In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. Refer to the SQL Server section in System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements. To verify that the instance name you have entered points to a valid instance, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, a message will be displayed in the wizard.

By default, the wizard connects to the SQL server using Windows Authentication with the account of the current user. SQL Authentication can be set by using the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
3.      Under Configure Service Account, your user ID appears in the USER ID text box to identify the user account under which services run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the formatusername@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password. The same user credentials are used for Workflow Manager Services and Service Bus services.
4.      Under Certificate Generation Key, enter a key in the first text box, and then re-enter it one more time in the text box under CONFIRM CERTIFICATE GENERATION KEY to confirm the first key you entered. The wizard checks the keys to make sure that they match. If the keys do not match the wizard notifies you to re-enter the keys. Record the key for future use because you will need to provide it every time you add a new computer to this farm.
The configuration cmdlets use this key for generating certificates. You can specify the custom certificate with the custom settings option.
5.      Check Allow Workflow Management over HTTP on this computer if you want to allow HTTP access in addition to HTTPS access to the Workflow Manager endpoint. You must enable this option individually on each machine of the farm. 
Note
Enabling HTTP support is not recommended in a production environment.
6.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
7.      Select Next. The wizard displays the Summary screen, which lists the values that you have entered along with the default values for the remaining configuration options. The screen also displays the configuration options and values for the farm as a whole and for Workflow Manager individually.
The wizard will also validate if the configuration values are valid for this computer. With any error the wizard will display the error page and will not allow you to proceed further. You can either go back to change the configuration that is causing the error or, if possible, fix the error outside the wizard.
For some errors it may not be possible to continue with the default configuration. For example, if the default port used for Workflow Manager Management is blocked by some application it may not possible to get it unblocked. If it is not possible to continue with the default configuration you must create the new farm with custom settings.
Tip
If there are any errors that you fix outside the wizard, you can use the re-validate button to validate the configuration again.
Tip
If you want to configure using PowerShell, you can generate the script based on the current configuration on this page by clicking on Get PowerShell Commands link.
1.      Click the Apply button to approve the listed options, to create the new farm, and to add the server to the new farm. Click the Back button to return to the New Farm Configuration page and to change the entries you have made.
Use Custom Settings-:
When you create a new farm using the custom configuration settings, the new farm may contain both the Workflow Manager and Service Bus.
1.      Configure databases required for Workflow Manager.
Workflow Manager requires three databases. 
o    Farm management database that manages the farm configuration.
o    Instance manager database that contains information about each running and terminated instance of the currently running Workflow Manager.
o    Resource management database that manages the workflow artifacts in Workflow Manager.
You can specify the SQL Server Instance and database name for each of these databases. In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. The current user needs to have SysAdmin privilege on this SQL Server instance. Refer to the SQL Server section in System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements.
By default, the wizard connects to the SQL server using Windows Authentication with the account of the current user. SQL Authentication can be set by using the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
To verify that the instance name you entered points to a valid instance and the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, place the mouse cursor over the red X in the error message to see the reason for the connection failure.
Check Use the above SQL server instance and settings for all databases checkbox if you want to use the same SQL server instance and associated settings for all databases.
2.      Under Configure Service Account, your user ID appears in the USER ID text box to identify the user account under which services run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the formatusername@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password.
3.      Under Configure Certificate you can specify whether the wizard should generate certificates for you or take certificates specified by you. The wizard will generate the certificates by default. In this case you will have to specify a certificate generation key. Enter the key in the CERTIFICATE GENERATION KEY text box, and re-enter it in the CONFIRM CERTIFICATE GENERATION KEY text box. The wizard checks the keys to make sure they match and notifies you to re-enter them if they do not.
Record the key for future use because you will need to provide it every time you add a new computer to this Workflow Manager farm. 
If you clear the Auto-Generate checkbox, the wizard will allow you to specify two certificates. These certificates should already be installed on the Local Machine\Personal store. You will also need to install these certificates on all the computers in the farm. The following certificates are configured.
o    The Workflow Manager SSL certificate secures HTTPS communications between Workflow Manager and clients. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
o    The Configure Workflow Outbound Signing Certificate option determines the certificate that Workflow Manager requires to secure communications between workflows. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
o    The Encryption certificate is used for encrypting all of the Workflow connection strings stored in the Workflow Management database. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) for more information on certificate requirements.
4.      In Configure Port you can specify the ports on which Workflow Manager listens to management requests. You can specify the HTTPS and HTTP ports for this purpose. If you want to enable HTTP access, check Allow Workflow Management over HTTP on this computer. You must enable this option individually on each machine of the farm.
Note
Enabling HTTP support is not recommended in a production environment.
5.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
6.      In the text box under Configure Admin Group enter the name of the user group. This is the user group for which you want to grant access for all databases that you are adding to the farm and service configuration.

By default, the administrative group name is used. BUILTIN\Administrators appears by default. Every user in this group has administrative access to the databases that are part of the farm. If this group is local, ensure that the group also exists on all computers in the farm and on the SQL Server that you specified earlier.
Click the Next link. The wizard displays the Service Bus Configuration page.
The page displays configuration options for Service Bus. Each option has a default value already filled in.
1.      Service Bus requires you to configure three databases:
a.              The farm management database for managing the farm configuration.
b.              The gateway database that load-balances and manages incoming Service Bus requests.
c.              The message container database that where Service Bus keeps its message queues and topics.
You can specify SQL Server Instance and database name for each of these databases.

In the SQL SERVER INSTANCE text box, the name of the SQL Server instance on the current computer appears by default. To specify a different SQL Server, type the complete name of the SQL Server instance that will host the databases for the farm. The current user needs to have SysAdmin privilege on this SQL Server instance. Refer to the SQL Server section in 
System Requirements (Workflow Manager 1.0) for understanding SQL Server requirements.

To verify that the instance name you entered points to a valid instance and the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, hover the cursor over the red X in the error message to see the reason for the connection failure.
2.      Under Configure Service Account, you can opt to use the same service account credentials as Workflow. The User ID of the current user appears in the USER ID text box to identify the user account under which Service Bus services will run. To change the user ID for the user account, enter a new user ID in the USER ID text box. The user ID must be in the format username@domain-name or domain\user. Then enter the password for that user ID in the PASSWORD text box. The wizard validates the user ID and password combination and if it finds an error notifies you to re-enter the user ID and password.
3.      Under Configure Certificate you can specify whether the wizard should generate certificates for you or take certificates specified by you. The wizard will generate the certificates by default. In this case you will have to specify a certificate generation key. If you had provided a certificate generation key for Workflow, you can reuse the same key by checking the Use the same certificate generation key provided for Workflow. Otherwise, enter the key in the CERTIFICATE GENERATION KEY text box, and re-enter it in the CONFIRM CERTIFICATE GENERATION KEY text box. The wizard checks the keys to make sure they match and notifies you to re-enter them if they do not. Record the key for future use because you will need to provide it every time you add a new computer to this Workflow Manager farm.

If you clear the Auto-Generate checkbox, the wizard will allow you to specify certificates required by Service Bus. 
The farm certificate secures HTTPS communications between Service Bus 1.0 and Workflow Manager. Click the Browse button to select an existing certificate. Refer to the Certificates section in System Requirements (Workflow Manager 1.0) to understand certificate requirements.
4.      The options under Configure Ports determine the TCP ports that Service Bus uses to communicate with its clients and the range of ports that Service Bus nodes use to communicate with one another. Under TCP PORT and COMMUNICATION PORT RANGE enter a TCP port number in the text box. The HTTPS port is used for SSL communication with Service Bus. The Message Broker port is used for message broker port communications. For COMMNICATION PORT RANGE the port number you enter represents the first of six ports that nodes can use to communicate.
5.      Check the Enable Firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager and Service Bus may fail to start.
6.      In the text box under Configure Admin Group, enter the name of the user group to which you want to grant access for all databases that you are adding to the farm and service configuration. By default, the administrative group name is used. BUILTIN\Administrators appears by default.
7.      Select Next. The wizard displays the Summary page that lists the values that you have entered along with the default values for the remaining configuration options. The page displays the configuration options and values for the farm as a whole and for Workflow Manager.

The wizard validates the configuration values for this computer. If there is any error, the wizard displays the page with an error and does not allow you to proceed further. You can either go back to change the configuration that is causing the error or, if possible, fix the error outside the wizard.
Tip
If there are any errors that you can fix outside the wizard, you can use the re-validate button to validate the configuration again.
Tip
If you want to configure using PowerShell, you can generate the script based on current configuration on this page by clicking on PowerShell Commands link.
8.      Click the Apply button to add the server to the new farm, or Click the Back link to return to the Farm Configuration page and change the entries you made.

The wizard displays the Configuration progress page that shows the installation progress and the details of the current installation operation in the Details list. If any errors occur during the installation, you can click the View log link to see which installation step caused the error.

1.1.           Joining an existing farm

We can increase size of the farm using the Join Farm option in the configuration wizard.
Use the following procedure to join an existing farm.
When the Workflow Manager Configuration Wizard page appears, click Join an Existing Workflow Farm. The Join Farm page appears.
1.       
2.      Under Provide Workflow Farm Management Database type the complete name of the SQL Server farm management database instance for the existing Workflow Manager farm in the SQL SERVER INSTANCE text box. If the farm management database has a custom database name, also type that database name in the DATABASE NAME text box.
By default, the wizard connects to the SQL server using Windows Authentication, using the account of the current user. SQL Authentication can be used by setting the advanced options. If your SQL server requires SSL connections, you can enable it using the advanced options.
To verify that the instance name you entered points to a valid instance, and that the specified database name exists, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, place the mouse cursor over the red X in the error message to see the reason for the connection failure.

Check Use the above SQL server instance and settings for all databases checkbox if you want to use the same SQL server instance and associated settings for all databases.
3.      Under Provide Service Bus Farm Management Database type the complete name of the SQL Server farm management database instance for the existing Service Bus farm in the SQL SERVER INSTANCE text box. If you had checked Use the above SQL server instance and settings for all databases, this field will be read-only. If the farm management database has a custom database name, also type that database name in the DATABASE NAME text box.
To verify that the instance name you entered points to the correct database, click the Test Connection button to the right of the text box. A green check mark icon appears next to the button if the connection is made correctly. If an error occurs, hover the cursor over the red X in the error message to see the reason for the connection failure.
4.      Click the Next link to retrieve the configuration provided during farm creation. Join Workflow Farm page is displayed.
5.      Under Service Account Password type the password for that user account in the PASSWORD text box. The user ID must be the same as the user ID that you specified when you created the Workflow Manager farm.
The wizard validates the user ID/password combination and notifies you to re-enter them if it finds an error.
6.      If you specified auto generation of the certificate, you must also provide the certificate generation key. Under Provide Certificate Generation Key, enter the key used to auto generate certificates for the Workflow Manager farm in the text box. This key must be the same as the farm key that you specified when you created the Workflow Manager farm.
7.      Check Allow Workflow Management over HTTP on this computer if you want to allow HTTP access in addition to HTTPS access to the Workflow Manager Management endpoint for this computer.
Warning
Enabling HTTP support is not recommended in a production environment.
8.      Check the Enable firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager may fail to start.
9.      Click the Next link to retrieve the configuration provided during farm creation. Join Service Bus Farm page is displayed.
10.  Under Service Account Password, type the password for that user account in the PASSWORD text box. The user ID must be the same as the user ID that you specified when you created the Service Bus farm.
The wizard validates the user ID/password combination and notifies you to re-enter them if it finds an error.
If you had used the same service account for Workflow Manager and Service Bus while creating the farm, you can copy the password by checking the Use the same service account credentials provided for workflow checkbox.
If you specified auto generation of certificate, you must also provide certificate generation key. Under Provide Certificate Generation Key, enter the key used to auto generate certificates for the Service Bus farm in the text box. This key must be the same as the farm key that you specified when you created the Service Bus farm. If you had used the same certification generation key for Workflow Manager and Service Bus while creating the farm, you can copy the key here by checking the Use the same certification generation key provided for workflow checkbox.
11.  Check the Enable firewall rules for this computer checkbox if you want to enable firewall rules. If firewall rules are not enabled, services required by Workflow Manager may fail to start.
12.  Click the Next link to view the summary page that contains the farm configuration that will be applied on this computer. A message is displayed on the summary page if there is any error, such as a missing certificate or a blocked port.
Tip
If you want to configure using PowerShell, you can generate the script based on current configuration on this page by clicking on the PowerShell Commands link.

13.  Click the Apply link to approve the listed options, to join the farm, and to verify that any custom certificates specified during farm creation are installed on this computer.


Tip
Configuration Wizard uses ‘WorkflowDefaultNamespace’ as the Service Bus service namespace for use by Workflow Manager. When joining a farm, Configuration Wizard will create this service namespace if it does not exist.

1.1.           Leaving the Farm

Workflow Manager Configuration Wizard provides a way for you to remove a server on which you have installed Workflow Manager from a farm.
Use the following procedure to leave a farm.
When the Workflow Manager Configuration Wizard page appears, click Leave Farm. The Leave Farm page appears.
1.       
2.      Under Farm Management Database the name of the SQL Server farm management database instance for both Workflow Manager and Service Bus farms appears. You do not need to provide input at this point.
3.      Click the Apply link to approve the listed options, specify the farm, and to remove the server from the farm, or click the Back link to return to the welcome screen. 
The wizard displays the Configuration progress screen, which shows the progress of the deletion operation and the details of the current deletion operation in the Details list. If any errors occur during installation, you can click the View log link to see which installation step caused the error.
When you leave a farm, the uninstaller leaves any certificates that you installed on the machine. If you want to remove those certificates, you must do so manually.
Tip
The farm management database instance and name come from the registry. They are removed and services cleaned up from the computer even if the connection with SQL Server is down. To clean up the entry from SQL Server, you should use the Remove-WFHost and Remove-SBHost cmdlets as described in section Configuring Workflow Manager 1.0 using PowerShell.
Removing a server from a farm is essential when you need to rename a machine or to reduce a farm to a single machine.
To rename a machine that belongs to a farm:
1.      Remove the machine from the farm.
2.      Rename the server
3.      Add the computer back to the farm as described in Joining an Existing Farm.
To reduce the farm to a single computer farm:
1.      Remove all the computers from the farm.
2.      Add the computer you want to be part of the farm.
Note
When reducing the farm to a single computer, it is important to remove all of the computers from the farm, and add the single computer back.

1.              Configure Workflow Manager 1.0 using PowerShell


To run PowerShell manually and enter configuration cmdlets:
1.              Open the Start menu.
2.              In All Programs, go to Workflow Manager 1.0. Then click the Workflow PowerShellshortcut to RunAs administrator PowerShell console.

Below PowerShell script is the modified script originally generated by configuration wizard. The Script reads configuration values from xml file to perform the configuration. The script uses auto-generate key for certificate. Also the database name are hard-coded in the script, but you can add prefixes (like Dev, Test, QA, Prod) to the database from xml file. The script also configure App Management Service, if the service is not already created.

#Get current user full login name
$CurrentUserLoginName=[Environment]::UserName +
'@' + [Environment]::UserDomainName;
#Get current server fully qualified domain name
$HostFQDN=
"$env:computername.$env:userdnsdomain";

#Load SharePoint Snapin
if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ){ 
    Add-PsSnapin Microsoft.SharePoint.PowerShell
}

#Get DB Connection String
function GetDBConnectionString([string]$connectionStringFormat, [string]$dbPrefix, [string]$dbName){
   
if($dbPrefix -ne ""){
        $dbFullName=$(GetDBName $dbPrefix $dbName);
       
return [string]::Format($connectionStringFormat,$dbFullName);
        }
   
else {
       
return $dbName;
    }
}

#Add Dev, Test etc. environment prefix, if needed
function GetDBName([string]$dbPrefix,[string]$dbName){
   
if(($dbPrefix) -and ($dbPrefix -ne "")){
       
return $dbPrefix + "_" + $dbName;
    }
   
return $dbName;
}

#Get current Script directory
function Get-ScriptDirectory
{
  $Invocation = (Get-Variable MyInvocation -Scope 1).Value
  Split-Path $Invocation.MyCommand.Path
}

function ConfigureWFManager([string]$settingsFile){
    [xml]$wfsettings = Get-Content $settingsFile
    $settings=$wfsettings.Settings;
    $SharePointSiteUrl=$settings.SiteUrl;
    $dbPrefix=$settings.DBPrefix;
    $CertificateKey=$settings.CertificationKey;
    $databaseServer=$settings.DBServer;
    $ConnectionStringFormat=
"Data Source=$databaseServer;Initial Catalog={0};Integrated Security=True;Encrypt=False";
    $RunAsAccount=$settings.WFManagerRunAsUser;
    $RunAsPasswordPlain=$settings.WFManagerRunAsPassword
    $WorkflowNamespace=$settings.WorkflowNamespace;
   
if(ShouldIProvision($settings.AppManagementService))
    {
        ProvisionAppManagementService($settings);
    }

   
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.
   
# Create new Service Bus Farm
    $SBCertificateAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;

    New-SBFarm -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'SBManagementDB')  -InternalPortRangeStart 9000 -TcpPort 9354 -MessageBrokerPort 9356 -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -GatewayDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBGatewayDB') -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -MessageContainerDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'SBMessageContainerDB') -Verbose;

   
# To be run in Workflow Manager PowerShell console that has both Workflow Manager and Service Bus installed.

   
# Create new Workflow Farm
    $WFCertAutoGenerationKey = ConvertTo-SecureString -AsPlainText  -Force  -String $CertificateKey -Verbose;


    New-WFFarm -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'WFManagementDB') -RunAsAccount $RunAsAccount -AdminGroup 'BUILTIN\Administrators' -HttpsPort 12290 -HttpPort 12291 -InstanceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFInstanceManagementDB') -ResourceDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix 'WFResourceManagementDB') -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

   
# Add Service Bus Host
    $SBRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-SBHost -SBFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'SBManagementDB') -RunAsPassword $SBRunAsPassword -EnableFirewallRules $true -CertificateAutoGenerationKey $SBCertificateAutoGenerationKey -Verbose;

    Try
    {
       
# Create new Servie Bus Namespace
        New-SBNamespace -Name $WorkflowNamespace -AddressingScheme
'Path' -ManageUsers $RunAsAccount,$CurrentUserLoginName -Verbose;

        Start-Sleep -s 90
    }
    Catch [system.InvalidOperationException]
    {
    }

   
# Get Service Bus Client Configuration
    $SBClientConfiguration = Get-SBClientConfiguration -Namespaces $WorkflowNamespace -Verbose;

   
# Add Workflow Host
    $WFRunAsPassword = ConvertTo-SecureString -AsPlainText  -Force  -String $RunAsPasswordPlain -Verbose;


    Add-WFHost -WFFarmDBConnectionString $(GetDBConnectionString $connectionStringFormat $dbPrefix
'WFManagementDB') -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -EnableHttpPort  -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;

    Write-Host
"Registering workflow host (HTTP) to site: $SharePointSiteUrl";
    Register-SPWorkflowService –SPSite $SharePointSiteUrl –WorkflowHostUri $(
"http://$HostFQDN" + ":12291") –AllowOAuthHttp
}

function ProvisionAppManagementService([System.Xml.XmlNode] $settings){

    $appManagementServices=Get-SPServiceApplication | Where-Object { $_.GetType().ToString()
-eq "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication"}
     If($appManagementServices
-ne $null)
     {
         Write-Host
"An App Managemetn service is already running. Returning.." -ForegroundColor Yellow
       
return;
     }   
   
    Write-Host
"Provisioning App Management Service";
    $appManagementService=$settings.AppManagementService;
    $appPool=$(GetAppPool $appManagementService)
    $dbName=$(GetDBName $settings.DBPrefix $appManagementService.DBName);
    $appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPool -Name $appManagementService.Name -DatabaseName $dbName
    New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc
}

function GetAppPool([System.Xml.XmlNode] $appManagementService){
    $pool = Get-SPServiceApplicationPool -Identity $AppManagementService.AppPoolName -ErrorVariable err -ErrorAction SilentlyContinue
    If ($err) {
       
# The application pool does not exist so create.
        Write-Host -ForegroundColor White
" - Getting $($appManagementService.ManagedAccountUserName) account for application pool..."
        $managedAccount = (Get-SPManagedAccount -Identity $appManagementService.ManagedAccountUserName -ErrorVariable err -ErrorAction SilentlyContinue)
        If ($err) {
            If (($appManagementService.ManagedAccountPassword
-ne "") -and ($appManagementService.ManagedAccountPassword -ne $null))
            {
                $appPoolConfigPWD = (ConvertTo-SecureString $appManagementService.ManagedAccountPassword -AsPlainText -force)
                $accountCred = New-Object System.Management.Automation.PsCredential $appManagementService.ManagedAccountUserName,$appPoolConfigPWD
            }
            Else
            {
                $accountCred = Get-Credential $appManagementService.ManagedAccountUserName
            }
            $managedAccount = New-SPManagedAccount -Credential $accountCred
        }
        Write-Host -ForegroundColor White
" - Creating applicatoin pool $($appManagementService.AppPoolName)..."
        $pool = New-SPServiceApplicationPool -Name $appManagementService.AppPoolName -Account $managedAccount
    }
   
return $pool;
}

Function ShouldIProvision([System.Xml.XmlNode] $node)
{
    If (!$node) {Return $false}
# In case the node doesn't exist in the XML file
   
# Allow for comma- or space-delimited list of server names in Provision or Start attribute
    If ($node.GetAttribute(
"Provision")) {$v = $node.GetAttribute("Provision").Replace(","," ")}
    ElseIf ($node.GetAttribute(
"Start")) {$v = $node.GetAttribute("Start").Replace(","," ")}
    ElseIf ($node.GetAttribute(
"Install")) {$v = $node.GetAttribute("Install").Replace(","," ")}
    If ($v
-eq $true) { Return $true; }
    Return $false;
}

Write-Host
"Configuring WF Manager"
$location=Get-ScriptDirectory
ConfigureWFManager
"$location\Dev_WFFarmSettings.xml"

1.1.           XML file for Configuration Script


The following XML file provides the input settings for the above PowerShell script (named as Dev_WFFarmSettings.xml in the above PowerShell script)
<Settings>
  <SiteUrl>http://siteulr</SiteUrl>
 
  <!--Delete DBPrefix tag, if you don't want any prefix-->
  <DBPrefix>Dev_</DBPrefix>
 
  <!--Key used to generate certificates-->
  <CertificationKey>DevCertificationKey</CertificationKey>
 
  <!--Database server name, database names are hardcoded in powershell-->
  <DBServer>Dev_SQLServer</DBServer>
 
  <!--Format should be USERNAME@DOMAIN-->
  <WFManagerRunAsUser>user@domain</WFManagerRunAsUser>
  <WFManagerRunAsPassword>Password</WFManagerRunAsPassword>

  <!--dot (.) not allowed-->
  <WorkflowNamespace>Dev_WorkflowNamespace</WorkflowNamespace>
 
  <!--To work with workflow, app management service need to be provisioned-->
  <AppManagementService Provision="true">
    <Name>App Management Service Application</Name>
    <DBName>AppManagementServiceDB</DBName>
    <!--If managed account already exists with the same name, the existing one will be used-->
    <ManagedAccountUserName></ManagedAccountUserName>
    <ManagedAccountPassword></ManagedAccountPassword>
    <AppPoolName>App Management Service App Pool</AppPoolName>
  </AppManagementService>
</Settings>

For configuring individual components of Workflow Manager 1.0 using PowerShell please refer to this MSDN Article.

2.              Workflow Manager Client 1.0 installation


Workflow Manager Client 1.0 contains core assemblies including activities and client APIs for Workflow Manager 1.0 and Workflow Manager Tools 1.0 for Visual Studio 2012. Workflow Manager Client must be installed on machines that run Workflow Manager Client applications, and on machines that are used to develop Workflow Manager Applications.
Note
Workflow Manager Client 1.0 is installed as part of the Workflow Manager 1.0 setup. If Workflow Manager applications are developed or run on a machine where Workflow Manager is installed, then Workflow Manager Client does not need to be re-installed.

Workflow Manager Client 1.0 is installed using the Web Platform Installer. Click the following link to install Workflow Manager Client.
·                 Workflow Manager Client 1.0 installation
·                 Clicking on the above link will launch web installer
·         Click on the Install button as show below...
·         Accept the agreement.

1.              Connecting Workflow Manager 1.0 with SharePoint Server 2013


Once Workflow Manager 1.0 (Server) has been installed we need to connect it to SharePoint Server 2013.
Note-:
If workflow is installed on a separate server, which is not part of the sharepoint farm, you need to download and install the “workflow manager client” on the sharepoint server which you are configuring to use workflow.
Workflow Manager Client 1.0 can be downloaded from this link.

Follow the steps below to connect Workflow Manager 1.0 to SharePoint Server 2013…

1.1.           Getting Workflow Manager Ports

To find out HTTP and HTTPS ports the Workflow has been installed to. Open to the IIS manager (StartàRunàInetmgr), open Workflow Management site, and look at the bindings:
To obtain ports using PowerShell cmdlets, open the Workflow PowerShell console, and execute the following commands (for HTTP and HTTPS ports)...

Get-WFFarm | ft HttpPort
Get-WFFarm | ft HttpsPort

1.1.           Connect to SharePoint

Post obtaining the workflow ports, we need to connect it to SharePoint. Follow the steps below….

·         Open the SharePoint Management Shell (PowerShell) console.
·         Depending on if we want to use HTTP, or HTTPS-execute the following command...
Register-SPWorkflowService –SPSite "http://server/sitecollection" –WorkflowHostUri "http://WorkflowHost:PORT" –AllowOAuthHttp

·         Replace the SPSite, WorkflowHostUri and PORT with appropriate values.
·         SPSite is your site collection where you want to use Workflow.
·          WorkflowHost is the server where you have installed the Workflow.
·         PORT is the port number, determined in the previous step, depending if we want to use HTTP or HTTPS.
·         Above command takes some time to create the connection. It’s a silent command, we will not see any progress indicator, or status message that the connection has been successful.

1.2.           Verifying the connection

To verify that command executed in above section has created the connection, follow the steps below…

·          go to the Central Administration, Service Applications, and look for the “Workflow Service Application Proxy”

·         It should be started, and when you click on it, you should get the Workflow Service status.