kwizcom banner advertisement

Check if Service Application is Running in SharePoint using PowerShell

June 27, 2015    , , ,
Couple of times, I had to get the service application's status prior performing activities such as: Stop and Start the service, Monitoring service application's availability, etc. Here is how we can check if the service application is running / created using PowerShell. PowerShell script to check service application's status: Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue #Display Name of the Service Application $DisplayName="Managed Metadata Services" #Get the Service Application from its Name $ServiceApp = Get-SPServiceApplication | Where { $_.DisplayName -eq $DisplayName} if($ServiceApp -ne $null) { #get the Service application status $ServiceApp.Status } else { Write-Host "Service application either not found or not created!" } This script gives the service application's current status. You can also get a service application from its type. Here is how: #Type Name of the Service Application $TypeName=&quo
Check if Service Application is Running in SharePoint using PowerShell Check if Service Application is Running in SharePoint using PowerShell Reviewed by Salaudeen Rajack on June 27, 2015 Rating: 5

Create a Task in SharePoint Task List using Powershell

June 18, 2015    ,
PowerShell Script to Create a New Task in SharePoint Task List: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Parameters $WebURL="http://intranet.crescent.com" $TaskListName="Tasks" #Get web and List objects $Web = Get-SPWeb $WebURL $TaskList = $Web.Lists[$TaskListName] $NewTaskItem = $TaskList.AddItem() #Set value for Task list columns $NewTaskItem["Title"] = "New Task" $NewTaskItem["AssignedTo"]=$web.EnsureUser("Crescent\Salaudeen") $NewTaskItem["StartDate"]= (Get-Date).ToShortDateString() $NewTaskItem["DueDate"] =(Get-Date).AddDays(7) $NewTaskItem["Status"]="Not Started" $NewTaskItem["Priority"]= "(1) High" $NewTaskItem["PercentComplete"]="0" $NewTaskItem.Update() Write-host "New Task Item Created Successfully!" and here is the new task created in SharePoint 2016 task list:
Create a Task in SharePoint Task List using Powershell Create a Task in SharePoint Task List using Powershell Reviewed by Salaudeen Rajack on June 18, 2015 Rating: 5

Configuring Audit Logs Feature in SharePoint 2013

June 15, 2015    , , ,
Audit log reports in SharePoint used to track how your SharePoint site contents are being used or to meet any legal compliance requirements. Lets see how to enable auditing feature in SharePoint 2013. Enable Audit Log Feature in Central Administration: SharePoint 2013 audit settings needs to be enabled starting from Central Administration site. From SharePoint 2013 Central Administration: Under Application Management, Click on Manage service applications. Select "Secure Store Service application", and click on "Properties" from the ribbon. Scroll down and Enable Audit section, and select the Audit log enabled box. Set the number of days to keep audit logs until purged. Click OK to save your changes. Enable Auditing Feature at Site collection level Go to your top level sites settings page (Site collection settings)  Click on "Site collection audit settings" link under Site Collection Administration.  In configure auditing page, enable releva
Configuring Audit Logs Feature in SharePoint 2013 Configuring Audit Logs Feature in SharePoint 2013 Reviewed by Salaudeen Rajack on June 15, 2015 Rating: 5

Move SharePoint Web Application's IIS Physical Path to a New Location

June 15, 2015    ,
Requirement: Move SharePoint web application's IIS physical location from system drive (c:\) to application drive (d:\) due to new server support policies! Solution: SharePoint web applications, by default placed under: "C:\inetpub\wwwroot\wss\VirtualDirectories" when we create them. There is no UI/direct way to change the physical location of SharePoint IIS web sites later. However, these three steps can be utilized to move SharePoint web application's IIS physical directory to a new location: Copy all contents from the current virtual directory to new directory Change IIS website's physical path Update SharePoint web application to point to the new directory path. Lets automate these manual steps with PowerShell. PowerShell Script to Move IIS Web Site to New Physical Location: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Import IIS Module Import-Module WebAdministration #Variables $WebAppURL="http://intranet.cres
Move SharePoint Web Application's IIS Physical Path to a New Location Move SharePoint Web Application's IIS Physical Path to a New Location Reviewed by Salaudeen Rajack on June 15, 2015 Rating: 5

Content Approval: Approve All List Items in Bulk using PowerShell

June 13, 2015    
When content approval is turned-ON, approving items one by one could be hectic. To bulk approve items, We can utilize PowerShell. Here is my PowerShell script to bulk approve items pending for content approval. This was a huge time savor for me during a migration project. PowerShell script to approve List items in Bulk: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Site URL and List Name variables $WebURL="https://portal.crescent.com/sites/ops/" $ListName="Tasks" #Get all List Items $ListItems= (Get-SPWeb $WebURL).Lists[$ListName].Items #Iterate through each item foreach($Item in $ListItems) { #Approve Item $item["_ModerationStatus"] = "0" #1 to reject #Update the item $item.Update() } write-host "Total Items Approved:"$ListItems.Count This PowerShell script simply loops through all items in the given list and Approves them by setting the Approval Status field (Internal name is
Content Approval: Approve All List Items in Bulk using PowerShell Content Approval: Approve All List Items in Bulk using PowerShell Reviewed by Salaudeen Rajack on June 13, 2015 Rating: 5

How to Add Date Time Field to SharePoint List using PowerShell?

June 10, 2015    , , , , ,
Requirement: Add Date and Time Column to SharePoint list using PowerShell. PowerShell Script to add Date time Column to SharePoint list: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Processing Variables $WebURL="http://portal.crescent.com/sites/Sales" $ListName="Vendors" $FieldName="Date of Contract" $RequiredField=$false #Get Objects $Web = Get-SPWeb $WebURL $List= $Web.Lists[$ListName] #Add Date and Time Column $List.Fields.Add($FieldName,"DateTime", $RequiredField) This Adds a new field. Set Date Time Column Settings using PowerShell:  While the above code adds new field to given list, there are additional settings on the column such as: Display Format, Default Value, etc can be set using PowerShell. PowerShell to Update Date Time Column Settings: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Processing Variables $WebURL="http://portal.crescent.com/sites/Sales&
How to Add Date Time Field to SharePoint List using PowerShell? How to Add Date Time Field to SharePoint List using PowerShell? Reviewed by Salaudeen Rajack on June 10, 2015 Rating: 5

Send HTML Format E-Mails with Send-MailMessage in PowerShell

June 10, 2015    , ,
Requirement: Send E-mail from PowerShell script with HTML formatted body. Solution: Here is an example for sending E-mail as HTML from PowerShell script with Send-MailMessge cmdlet: #Get Date $ReportDate = Get-Date -format "MM-dd-yyyy" #Configuration Variables for E-mail $SmtpServer = "smtp.crescent.com" #or IP Address such as "10.125.150.250" $EmailFrom = "Site Delete Script <SiteDeleteScript@Crescent.com>" $EmailTo = "SharePointSupport@Crescent.com.com" $EmailSubject = "Site Delete Script - Daily Report on: "+$ReportDate #HTML Template $EmailBody = @" <table style="width: 68%" style="border-collapse: collapse; border: 1px solid #008080;"> <tr> <td colspan="2" bgcolor="#008080" style="color: #FFFFFF; font-size: large; height: 35px;"> Site Delete Script - Daily Report on VarReportDate </td> </tr> <tr styl
Send HTML Format E-Mails with Send-MailMessage in PowerShell Send HTML Format E-Mails with Send-MailMessage in PowerShell Reviewed by Salaudeen Rajack on June 10, 2015 Rating: 5

Fix "The form cannot be rendered. This may be due to a Misconfiguration of the Microsoft SharePoint Server state service" Error in SharePoint 2013

June 08, 2015    , , , ,
Problem: InfoPath form based list form in a migrated SharePoint 2013 environment from SharePoint 2010 gave this error message: "The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server state service" Solution: Create a State Service Application as in: How to Create State Service Application in SharePoint 2013 It could also happen if your State service database goes corrupted. Use these cmdlets to recreate State service application database. Remove-SPStateServiceDatabase New-SPStateServiceDatabase Mount-SPStateServiceDatabase Related post: SharePoint 2010 InfoPath Form Error- The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service .
Fix "The form cannot be rendered. This may be due to a Misconfiguration of the Microsoft SharePoint Server state service" Error in SharePoint 2013 Fix "The form cannot be rendered. This may be due to a Misconfiguration of the Microsoft SharePoint Server state service" Error in SharePoint 2013 Reviewed by Salaudeen Rajack on June 08, 2015 Rating: 5

Set Default Value for Hyperlink or Picture Column in SharePoint

June 07, 2015    , ,
Problem: There is no provision for specifying default value in Hyperlink or Picture type columns in SharePoint! In some scenarios, we may want to specify SharePoint 2010/2013 hyperlink column default value. But there is no option in SharePoint web UI to enter hyperlink field default value! Solution: Set SharePoint hyperlink column default value with PowerShell! Use this PowerShell script to specify default value for hyperlink or picture type fields. Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue #Variables $WebURL="http://intranet.crescent.com" $ListName="Proposal Documents" $ColumnName="Reference URL" $DefaultValue="http://externalsites.crescent.com" #Get the Web $web = Get-SPWeb $WebURL #Get the List $list = $web.Lists.TryGetList($ListName) If($list -ne $null) { #Get the column $column = $list.Fields[$ColumnName] if($column -ne $null) { #Set Default Value $column.DefaultValue = $Defaul
Set Default Value for Hyperlink or Picture Column in SharePoint Set Default Value for Hyperlink or Picture Column in SharePoint Reviewed by Salaudeen Rajack on June 07, 2015 Rating: 5

Remove Hyperlink from Lookup Columns in SharePoint

June 06, 2015    , , ,
Problem: When we add lookup column to any SharePoint list, it appears with the link to parent item in SharePoint list views. Quite often, end-user clicks on the lookup link and edits parent lookup item by mistake - People  get confused which link to click. So we wanted to remove hyperlink from lookup columns in SharePoint 2013 list views. SharePoint 2013 remove hyperlink from lookup column - No code solution: Here is how you can remove hyperlink from lookup fields out-of-the-box without any coding and customization efforts. Go to your list settings, Pick the lookup column. In my case its "Parent Project". In "Edit Column" page, Select "Title" field under "Add a column to show each of these additional fields" Section as highlighted below. Now, Edit your list view, Unselect "Parent Project" field and select "Parent Project: Title" field. (You can rename this Title - BTW!) Click "OK" to save the view. That
Remove Hyperlink from Lookup Columns in SharePoint Remove Hyperlink from Lookup Columns in SharePoint Reviewed by Salaudeen Rajack on June 06, 2015 Rating: 5

How to Delete Site Collection using PowerShell in SharePoint?

June 05, 2015    , , , , ,
When you delete a site collection in SharePoint, all sites including the top-level site and subsite underneath, and all data present in the site collection, all user information in the site collection gets deleted. To delete any SharePoint site collection, You can use either SharePoint Central Administration site or PowerShell. How to delete site collection in SharePoint 2013? To delete a site collection in Central Administration, Navigate to: SharePoint 2013 Central Administration >> Application Management  Click on Delete a site collection link under Site Collections group Select the site collection to delete Click on Delete button to delete a site collection in SharePoint. Delete host named site collection with PowerShell Host named site collections can be managed only through PowerShell! Central Admin doesn't offer the provision to delete Host named site collections as it offers for Path-based sites. Following are some examples of deleting SharePoint 2
How to Delete Site Collection using PowerShell in SharePoint? How to Delete Site Collection using PowerShell in SharePoint? Reviewed by Salaudeen Rajack on June 05, 2015 Rating: 5

Exclude SharePoint Site or List from Search Results

June 02, 2015    , , , ,
SharePoint search results are already security trimmed. Meaning, If a user doesn't has access to a SharePoint site, He/She doesn't see any search results from the particular site collection. Same applies to SharePoint lists even. But in some cases, you may want to prevent certain artifacts from appearing on the search results. E.g. You may want to exclude "Site Assets" library to exclude all images and supported scripts appearing in search! Exclude site from search SharePoint 2013: To exclude a SharePoint site from search results, Click on "Search and offline availability" under Search group in Site settings page. Choose "No" for Allow this site to appear in search results option. Click on "OK" to save your changes. Set SharePoint Site collection to Exclude from Search Results using PowerShell: Lets do it with PowerShell, instead of setting each subsites search visibility property manually. Add-PSSnapin Microsoft.SharePoint.
Exclude SharePoint Site or List from Search Results Exclude SharePoint Site or List from Search Results Reviewed by Salaudeen Rajack on June 02, 2015 Rating: 5

"Connect to Outlook" in SharePoint 2013 Greyed out?

June 01, 2015    , , ,
Problem: SharePoint users unable to connect to any SharePoint 2013 list or calendar to Outlook 2013.  The "Connect to Outlook" Ribbon button is always greyed out! Troubleshooting Checklist: Connect to outlook feature is available only to these type of lists:  Calendar, Tasks, Project Tasks, Contacts, Document Library and Discussion Boards. Prior to Service pack 1:  If your SharePoint site has Minimal Download Strategy feature enabled, simply press "F5" to reload the current page. You'll get connect to outlook button enabled! Disabling MDS feature is not a good idea IMHO!! Make sure that "SharePoint Stssync Handler" is enabled in browser add-ons. (IE >> Tools >> Manage Add-ons) Check the client-integration option of web application settings This feature works only when you have 32 bit version of office installed in your client machine! The "WebClient" Service must be running in services console of the client machine!
"Connect to Outlook" in SharePoint 2013 Greyed out? "Connect to Outlook" in SharePoint 2013 Greyed out? Reviewed by Salaudeen Rajack on June 01, 2015 Rating: 5

Restrict Office Web Apps Edit License within a AD Group

June 01, 2015    , ,
Requirement: SharePoint 2013 Office Web Apps "Edit in Browser" feature needs to be limited to users who has Microsoft Office Volume license. Solution: License Enforcement in Office Web Apps 2013 The overall idea for the solution is: Create a new security group in AD, Add users to it - who are allowed to use edit option in Office web Apps. From SharePoint, Enable user licensing and map this AD group with the "Office Web Apps Edit" license. Step 1: Create a AD Security Group Login to your domain controller, Create new security group to hold users who are allowed to use Edit feature in office Web Apps. Add members to it. Here is mine: OWA Editors! Step 2: Configure OWA and SharePoint to Enforce Licensing: Login to your Office Web Apps Server, Create a new Office Web Apps Farm with "EditingEnabled" Switch. New-OfficeWebAppsFarm -InternalUrl "http://was.crescent.com" -ExternalUrl "https://was.crescent.com" -CertificateName &quo
Restrict Office Web Apps Edit License within a AD Group Restrict Office Web Apps Edit License within a AD Group Reviewed by Salaudeen Rajack on June 01, 2015 Rating: 5
Powered by Blogger.