Tag Archives: SharePoint Tutorial and tagged affordable sharepoint 2013 hosting

SharePoint 2013 Hosting :: How to Update List Items in SharePoint 2013 and Office 365 Using PowerShell

This article willl explains updating list items in SharePoint 2013 and Office 365 using PowerShell. Here we will see how to update all the list items in a list when a requirement of such comes in.

ahp banner sharepoint-01

I have a PowerShell script here that you just need to add using Notepad and save it as a .ps1 file. In this script I am updating a choice field from a look up field.

Script

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue  
$webURL = “Your Site Url”  
$listName = “Name of your list”  
$web = Get-SPWeb $webURL  
$list = $web.Lists[$listName]  
$items = $list.items  
Foreach($item in $items)  
{  
  $prim = $item["Look Up Column field"]  
  if(!$prim)  
  {  
    write-host “Null”  
  }  
  else  
  {  
    $trim = $prim.split(‘#’)[1]  
    write-host $trim  
    $item["choice field"] = $trim  
    $item.Update()  
    write-host $item["Your Result You want to see"]  
  }  
}

How to run

  • You need to change the fields Site Url, List Name and Fields.
  • You might have a question, why am I using a split function?
    The field value when fetched from a look up field has characters like “1,#”. Using split we eliminate that extra data by giving us a correct variable.
  • Run the SharePoint PowerShell as Administrator
  • Run the .ps1 file

It will be executed and you will see the updated field values.

Here is a time saver article for my readers. Keep learning and happy coding :)

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: Customize Process Approval Email to Consist of Link to Respective Job

In SharePoint 2013 workflow architecture is drastically changed when compared with SharePoint 2010. Some new activities like “HttpSend” are introduced for the platform and some activities are improved a whole lot. On the other hand some scenarios became quite hard to implement.

ahp banner sharepoint-01
Let’s assume that we’ve a SharePoint 2013 Visual Studio primarily based workflow and require to assign a task to a user. We count on the notification e mail to contain the hyperlink to respective task. is not it ?

In SharePoint 2010 it was quite easy to include the process url in the mail. But which is not the case anymore. It’s not achievable to include the task url in the default mail. As an alternative it’s sent like below that is not user friendly.

1ivojrbIn this post I’ll show a workaround to resolve the problem. Following are the steps we need to perform

  1. Add “SingleTask” activity and configure necessary parameters2dskvb
  2. Modify WaitForTaskCompletion property to false
    This will avoid the “SingleTask” activity to wait until the approval. Furthermore change “WaiveAssignmentEmail” property value to “Yes” which avoids the notification email.2jkebfog
  3. Compose an email manually
    In this email I’ll include a link to assigned task. To get the guid of task list, I will use “GetTaskListId” activity. Furthermore I’ll get the task id from “SingleTask” activity output.From those elements I’ll construct the url of the assigned taske.g.: “http://sp13/sites/dev/DOAApprovalForm.aspx?List=”+taskListId.ToString()+”&ID=”+taskItemId+”

    Then I’ll construct the email body as I wish

    “<html><body style=’font-size:11pt;font-family:Segoe UI Light,sans-serif;color:#444444;’><div>Contract comment is : ” + contractComment+ ” </br>Please approve this <a href=”+siteUrl + “SitePages/DOAApprovalForm.aspx?List=”+taskListId.ToString()+”&ID=”+taskItemId+”>Task</a></div></body></html>”

  4. Handle Approve or Reject actions using a “Pick” activityWe will use “WaitForFieldChange” activity to pause the workflow until user presses Approve or Reject buttons. Since there are two possible values in the pausing field we need to use a “Pick” activity4juarehvo
  5. As mentioned earlier, we will use “WaitForFieldChange” activities on both branches, configured for “TaskOutcome” field.5inhgelorgFor the first “WaitForFieldChange” activity, the FieldValue is set to “Approved” and for the other one it is “Rejected”
  6. I’ll update the taskOutcome with respective values to continue the workflow6lkejnfglergbThis will allow us to modify email as we wish and pause the workflow until the task is approved or rejected
    7bckedv

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting :: How To Create Enterprise Search Center Site Collection in SharePoint 2013 Online

In this article I would like to share the procedure to create an Enterprise search center site collection in SharePoint 2013 online using an admin portal.

Enterprise Search Center

A Search Center is where users enter search queries and view the search results. In SharePoint Online, a Search Center site is automatically available at <host_name>/search/. You’ll have a default search home page and a default search results page. In addition, there are several pages known as search verticals. Search verticals are customized for searching specific content, such as People, Conversations, and Videos. Search verticals display search results filtered and formatted for a specific content type or class.

Use the following procedure to create an Enterprise Search Center site collection.

Step 1: Open the “Microsoft Online Portal” (Admin Center) in your browser.

Provide the username and password to login the portal, then you will be navigated to the online portal (Admin Center) as shown below.

Admin TabStep 2: Then click on the “Admin” DropDown on the portal. On the DropDown select the “SharePoint” as shown below.

Admin dropdownStep 3: When you click on the SharePoint, you will be navigated to “SharePoint Admin center” as shown below.

SharePoint Admin centerStep 4: Click on the “New” from the ribbon bar as shown in the following, and then select the “private site collection”.

private site collectionStep 5: Then you will get the dialog box to create the site collection, when you select the private site collection as shown below.

site collectionStep 6: On the dialog box select the enterprise tab to create an enterprise search center, by default the team site collection will be selected in your dialog box.

enterprise search centerStep 7: Then select an Enterprise Search Center template on the dialog box as in the following:

Enterprise Search Center templateStep 8: Then provide the following details in the dialog box depending on your requirements:

  • Title
  • Web site address
  • SharePoint version
  • Language
  • Type of template
  • Time zone
  • Administrator of site collection
  • Storage Quota
  • Server Resource Quota

After providing all the preceding details, click “Ok” to create the site collection.

OkFinally a Community site collection will be created in SharePoint Online.

SharePoint Online

Summary

In this article we explored how to create an Enterprise Search Center site collection in SharePoint 2013 online.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

ASPHostPortal.com Announces Powerful Sitefinity 7.3 Hosting Solution

ahp sitefinity

As a technology focused web host, ASPHostPortal are designed to support popular web development technologies. Windows and ASP.NET hosting are at the core of its business practice. They have over 10 years combined experience in .NET, PHP, Network Administration, System Integration and related technologies to support mission critical hosting for applications built on these platforms. Today, they launch Sitefinity 7.3 hosting with powerful network and affordable price.

Sitefinity by Telerik is an ASP.NET web content management platform engineered to make managing your website a more positive, empowering and usable experience. Sitefinity is the first and only CMS to enable enterprises to take full advantage of all three mobile development strategies— Responsive Web Design, mobile websites, and mobile apps, easily and effectively—and all from one CMS user interface.

Sitefinity 7.3 introduces lead scoring, integration with SharePoint Online, extended ASP .NET MVC support and more.

Directly Impact Revenue With Lead Scoring
Manage your lead scoring criteria according to various data points collected across channels.

Complement SharePoint Online
Provide a natural extension to all your SharePoint workflows and wrap a compelling presentation around your core business documents.

Build fast, and light with new ASP .NET MVC Features
MVC based widgets for each of your dynamic modules with automatically generated Razor templates.

With 7 data centers that located in USA Europe, Australia and Asia, ASPHostPortal is superior provider in the hosting market. They provides Sitefinity 7.3 Hosting only from $5/month with 30 days money back guarantee. In addition, ASPHostPortal has been awarded as one of the best hosting companies in the industry because of the good hosting performance this web host provides. To provide best hosting performance, this company always maintains the server with expert team in ASP.NET Technology. To learn more about Sitefinity 7.3 Hosting, please visit http://asphostportal.com/Sitefinity-7-3-Hosting

About ASPHostPortal.com :
ASPHostPortal.com is The Best, Cheap and Recommended ASP.NET Hosting. ASPHostPortal.com has ability to support the latest Microsoft and ASP.NET technology, such as: such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch. ASPHostPortal include shared hosting, reseller hosting, and sharepoint hosting, with speciality in ASP.NET, SQL Server, and architecting highly scalable solutions. ASPHostPortal.com strives to supply probably the most technologically advanced hosting solutions available to all consumers the world over. Protection, trustworthiness, and performance are on the core of hosting operations to make certain every website and software hosted is so secured and performs at the best possible level.

SharePoint 2013 Hosting :: How to Hide Settings Under Site Settings Page in SharePoint 2013

In this article will learn how to hide settings under site settings page in SharePoint 2013.
Here we will take a example of hiding the “Change The Look”  setting under [Look and Feel].

ahp banner sharepoint-01Few cases where you do not want to change the theme of sites by site collection administrators because theme needs to same for all sites in entire organization.  But there is a chance that site collection admin can change the theme.

So you want to hide that option using CSS so that even the site collection will be not able to change theme by hiding the “Change The Look” feature.
Follow the below steps to hide the “Change The Look” feature.

  • Open Site settings of your site
  • Fire IE developer tools and find the ID of the “Change The Look” feature. Refer below figure.
  • Edit corev15.css file and add the below css and save the file. Its always advised to take the backup of the corev15.css file before making any changes.

hide_change_the_look

Code
#ctl00_PlaceHolderMain_Customization_RptControls_Theme
{
display:none;
}

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: Developing a Site Collection in 2010 Mode in SharePoint 2013

These days I got phoned up by a buddy who asked how on earth he could programmatically produce a web site collection in 2010 mode in SharePoint 2013. Why he wanted to do this I’m not confident, and it is not the point of this post

ahp banner sharepoint-01It’s truly pretty uncomplicated if you appear at the documentation of some of the SPSiteCollection.Add() strategies which take an int as a compabilityLevel parameter. Passing in 14 in this parameter will make certain you get the 2010 appear and really feel. For reference the SPSite.SelfServiceCreateSite() technique has equivalent overloads.

SPWebApplication webApp = new SPSite(<a href="http://host/">http://host</a>).WebApplication;
SPSiteCollection siteCollections = webApp.Sites;
uint lcid = 1033;
int compatLevel = 14;
string webTemplate = "STS#0";
SPSite newSiteCollection = siteCollections.Add("sites/test", "Title", "Description", 1033, compatLevel, webTemplate,
 "DOMAIN\\User", "Name", "Email_Address", "DOMAIN\\User", "Name", "Email_Address");

If you want to do it I PowerShell you can use the following command:

New-SPSite -Url http://host/sites/test -OwnerAlias "DOMAIN\User"

And via Central Admin:

3lkdnvlr

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting :: How to Write Access 2013 Custom Web App on Office 365

Sign into Office 365 enterprise and get a free version of Office as well as SharePoint. I installed Access 2013 on my local machine and used SharePoint from the Office 365 enterprise version. Create a team site in the cloud environment and use that URL in the Web Location text box.

 

Figure 1.jpg

Choose an existing template to better understand how tables and forms are created. I have chosen the Project Management template. Then you can click on “Add table”. I have created a table called Estimation as shown below.

 

Figure 2.jpg
The Data Types available are very restricted as shown below:

Figure 3.jpg

Also I did not find an option to change the Primary Keys. When you save the table you will see two forms automatically created for you. In my case Estimation Datasheet and Estimation List. Make sure your Navigations Pane is “On”.

 

Figure 4.jpg

You will also notice that in the Projects List Form a tab for Estimation is added automatically.

Figure 5.jpg

Open the Estimation List Form. We need to add code in this form. In my case I needed to add custom logic to fill in the Per Day Effort and Calculate the Item Effort. Chose the Component Drop Down. In the Actions button you will see the allowed actions for that control. The list is control specific. Click on After Update in this case.

Figure 6.jpg

Step 4

Write your custom logic. When you click on the “After Update” as in this case the Macro Tools opens as below. It is painful to use this editor but currently there is no other choice.

Figure 7.jpg

Similarly write code for other controls as required. You can use Expression builder in the case of calculated fields as shown below.

Figure 8.jpg

For the summation of items, you need to go to the Project List Form and click on the Estimation Tab as shown below. This will add a total effort at the form below.

Figure 9.jpg

Time to launch your app. Click on the “Launch App” button. If all goes well you will see a screen as below.

Figure 10.jpg

One you add the Project and Estimation details you will see the following screen with additional summation field as below.

Figure 11.jpg

It has been a painful journey to begin with. Hope with more examples and help material on Microsoft this journey becomes enjoyable.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

 

SharePoint 2013 Hosting :: How to Create Community Site Collection in SharePoint 2013 Online

In this article I would like to share the procedure to create a Community Site collection in SharePoint 2013 online using an Admin portal.

What a Community Site is

In SharePoint 2013 a Community Site is a new site template that provides a forum experience in the SharePoint environment. Use communities to categorize and cultivate discussions among a broad group of people across organizations in a company. Communities promote open communication and information exchange by enabling people to share their expertise and seek help from others with knowledge in specific areas of interest. You can deploy a Community Portal to promote communities to users within your enterprise.

Procedure to create a Community Site collection

Step 1: Open the “Microsoft Online Portal” (Admin Center) in your browser as in the following:

URL: https://portal.microsoftonline.com/default.aspx

Provide the username and password to login the portal, then you will be navigated to the online portal (Admin Center) as shown below.

Step 2: Then click on the “Admin” dropdown on the portal. On the dropdown select the “SharePoint” as shown below.

Step 3: When you click on SharePoint you will be navigated to “SharePoint Admin center” as shown below.

Step 4: Click on “New” from the ribbon bar as shown in following and then select “private site collection”.

Step 5: Then you will get the dialog box to create the site collection when you select the private site collection as shown below.

Step 6: By default the team site collection will be selected in your dialog box, there you can choose the Community Site template as shown below.

Step 7: Then provide the following details on the dialog box as you need.

  • Title
  • Web site address
  • SharePoint version
  • Language
  • Type of template
  • Time zone
  • Administrator of site collection
  • Storage Quota
  • Server Resource Quota

After providing all the preceding details click “Ok” to create the site collection.

Finally Community Site collection will be created in SharePoint Online.

Summary

In this article we explored how to create a Community Site collection in SharePoint 2013 online.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 – ASPHostPortal.com :: Workflow Manager Installation and Configuration

SharePoint 2013 introduced a brand new way of workflow management. Now workflow could be hosted in separate server – so scalable and reduces load on SharePoint Net Front End server. Nevertheless this introduce a new level of complexity that we need to be conscious of.

ahp_freehostSHP(1)

To utilize a windows server as workflow manager you have to install/configure Workflow Manager inside the windows server. Workflow manager is a new form of application server that host/manage workflow execution. SharePoint 2013 workflow is primarily based on .net framework 4.0. Workflow Manager is designed with Window Azure hosting in mind, but now it supports on-premise installation. If organizations now want to host the workflow on-premise they could still use Workflow Manager but in future if they desire to move to Windows Azure hosting for their workflow, the migration will likely be smoother with this Workflow Manager.

Before start installing/developing SharePoint Manager you need to know few points:

  • You should not use SharePoint ‘system account’ to test workflow. If you use ‘system account’ to develop/run workflow, the workflow will fail to run.
  • You need to make sure User Profile Service (UPS) is running and the user who is running workflow has profile in UPS. Workflow Manager use UPS under the hood.
  • Make sure App Management Service is created and running. You don’t need to configure SharePoint 2013 App settings in the server, just creating App Management service (with proxy) will do.
  • SharePoint 2013 workflow is declarative – means you can only define workflow in XML. You can’t write any C# code inside workflow as you used to do before. All your custom logic should be put outside of SharePoint, inside WCF Service. Then you will call the service from workflow to implement your custom logic in code.

To register workflow Server with SharePoint, a SharePoint site collection URL is provided (see the section Register Workflow Service with SharePoint later in the post). Apparently it seems, each and every site collection need to be registered with workflow server. But it’s not, registering a single SharePoint site  collection, will enable workflow manager for all SharePoint web applications/site collections.

Install/Configure Workflow Manager

The first step in workflow setup/configuration is to install workflow manager in the workflow server (either Web Front End or a separate server). To install the workflow Manager download it from Microsoft Site or alternatively you can download it from Web Platform Installer. The installation contains few components:

  • Workflow Manager: This is the host that runs workflows.
  • Workflow Manager Client: It contains the API to allow clients to communicate with Workflow host.
  • Workflow Tool: It needs to be installed in the development server to develop SharePoint 2013 workflow. It supports the workflow development in Visual Studio 2012.

Workflow Manager client needs to be installed in every SharePoint WFE server.

After installing Workflow Manger, you can configure workflow manager with Workflow Manager Configuration Wizard. The configuration involves two steps: Workflow Manager Configuration and Service Bus Configuration.

  • Workflow Manger Configuration (first step in the wizard) is the configuration related to work host server
  • Service Bus configuration (second step in the wizard): Service Bus is used to manage communication between Workflow Server and it’s client (so, SharePoint). Service Bus queues the income request to workflow manage, provide REST interface for Workflow Manager etc.

In workflow configuration wizard don’t use any admin or SharePoint setup user, create a new service user for workflow and use that user:

1fhbeneIf you want SharePoint Server to communicate with Workflow Server over HTTP, you can select the option shown below. But please make sure this is secure in your case. For public site, this might not be secure but in case of Local Intranet with firewall, this might be secure.

2regerhIf you want to use the same service account (as well as auto generated key for certificate), you can use so as shown below:

3grfmrmrIf you want to use the same service account (as well as auto generated key for certificate), you can use so as shown below:

Register Workflow Service with SharePoint

Once you have installed/configured Workflow Server, you need to register the workflow service to SharePoint Server. The registration depends on how the SharePoint and Workflow server is connected to each other. You can find more details at technet site. The workflow manager creates an HTTPS endpoint at port 12291 and HTTP port at 12290. If you use HTTP for communication you need to provide ‘AllowOAuthHttp’ switch in the PowerShell command. The PowerShell command looks like below:

Communication over HTTP

Register-SPWorkflowService –SPSite http://sharepointsite –WorkflowHostUri http://workflowhost:12291 –AllowOAuthHttp

Communication over HTTPS

Register-SPWorkflowService –SPSite http://sharepointsite –WorkflowHostUri https://workflowhost:12290

PowerShell Script to Install/Configure Workflow Manager

I have modified the wizard-generated PowerShell script a bit to make it more reusable. The Script reads configuration values from xml file and apply 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, prod) to the database from xml file. The script also configure App Management Service, if the service is not already created. The sample PowerShell Script is provided below:

#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\WFFarmSettings.xml"

The following XML file provides the input settings for the above PowerShell script (named as WFFarmSettings.xml in the above PowerShell script). Though you will use a site collection to register the workflow and SharePoint communication, I’ve found that workflow work for all others site collections/web application in the SharePoint Server.

<Settings>
  <SiteUrl>http://siteulr</SiteUrl>
  
  <!--Delete DBPrefix tag, if you don't want any prefix-->
  <DBPrefix>DEV</DBPrefix>
  
  <!--Key used to generate certificates-->
  <CertificationKey>CertificationKey</CertificationKey>
  
  <!--Database server name, database names are hardcoded in powershell-->
  <DBServer>DBServer</DBServer>
  
  <!--Format should be USERNAME@DOMAIN-->
  <WFManagerRunAsUser>user@domain</WFManagerRunAsUser>
  <WFManagerRunAsPassword>Password</WFManagerRunAsPassword>

  <!--dot (.) not allowed-->
  <WorkflowNamespace>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>