Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

August 2014

Estimated Arrival Time (ETA) for PowerShell

Ever had a script that takes a long time to run?    Would it be nice to see an estimated time for completion?   Well, the code below is for you.  

shades_smile

 

Percentage complete is an easy calculation for any loop operation.  Deriving time from that requires us to hold ($start) with the time our loop began.  From there we can multiply out and calculate total seconds.   When total seconds remaining is added to the current time .. then … you have ETA.  Example below.

 

image

 

# Data Source
$sites = Get-SPSite -Limit All
# Initialize Tracking
$start = Get-Date
$i = 0
$total = $sites.Count
# Loop
foreach ($site in $sites) {
	# Progress Tracking
	$i++
	$prct = [Math]::Round((($i / $total) * 100.0), 2)
	$elapsed = (Get-Date) - $start
	$totalTime = ($elapsed.TotalSeconds) / ($prct / 100.0)
	$remain = $totalTime - $elapsed.TotalSeconds
	$eta = (Get-Date).AddSeconds($remain)
	
	# Display
	$file = $site.Url.Split('/')[4]
	Write-Progress -Activity "Backup $file ETA $eta" -Status "$prct" -PercentComplete $prct
	
	# Operation
	Backup-SPSite $site.Url -Path "D:\TEMP\$file.site" -WhatIf
}

VSIX for SharePoint 2013

Recently while configuring a new developer lab VM I searched http://visualstudiogallery.msdn.microsoft.com/ for plug-ins to help speed up coding.   I found a few good ones and wanted to share links here in case you might find these helpful too.   Cheers!  

shades_smile

 


 

  1. CKS – Dev for Visual Studio 2013  is a collection of Visual Studio templates, Server Explorer extensions and tools providing accelerated SharePoint 2010/2013 development based on Microsoft’s SharePoint 2010/2013 development tools.
    image

     

  2. SPCop CE (Community Edition) Essential tool to ensure SharePoint code quality. SPCop analyses SharePoint code from .wsp and .app files and checks all contained code incl. XML, ASPX, JS, CSS for correctness, best practices, memory disposal etc. SPCop is the free component of SPCAF.
    image

     

  3. SharePoint 2013 Ribbon API provides you to use Ribbon UI elements such as Button, DropDown, SplitButton, Gallery, Tab, Group and others for building your own Ribbon and/or modification standart one.
    Screenshot
  4. Mavention SharePoint Assets Minifier for Visual Studio 2013  automates the process of minifying CSS and JavaScript files. Upon installation it introduces three custom tools that you can use for minifying CSS and JavaScript files.
    Mavention

  5. Office 365 API Tools – Preview  your app can access email, calendar, contacts, files, and profile information on behalf of the user. This extension will help register your app to consume Office 365 APIs, and will add the necessary NuGet libraries and sample code to get you up and running.
    Screenshot
  6. SPRemoteAPIExplorer provides the ability to explore, discover and generate SharePoint 2013 remote API code in REST and CSOM(Javascript, .Net and Silverlight). Useful when developing SharePoint REST applications
      Screenshot

       

    1. Ribbon Designer for SharePoint and Office 365 – true RAD tool for customizing the Server Ribbon UI of your SharePoint and Office 365 solutions. Specialized components allow you to quickly build custom ribbons and add a new ribbon to your existing projects without learning the Ribbon XML schema.
        Use the in-place visual designer to customize your SharePoint Ribbon components

      SQL 2014 and SSRS Integrated “Hello States.rdl”

      Recently I create a new lab virtual machine with SharePoint 2013 and SQL 2014 to test SSRS Integrated mode.  

       

      I found the screenshot based instructions at http://rajeshagadi.blogspot.com/2013/07/installing-reporting-services-in.html even more helpful than TechNet official documentation http://msdn.microsoft.com/en-us/library/jj219068.aspx.     Both are good and make configuration easier.   Also I needed to follow the C2WTS configuration steps http://msdn.microsoft.com/en-us/library/hh231678.aspx and Kerberos steps http://technet.microsoft.com/en-us/library/gg502594.aspx to enable single sign on for Claims authentication and SSRS Integrated mode.   To enable SMTP and IMAP email routing I followed https://www.spjeff.com/2011/02/05/how-to-free-internal-sharepoint-email-imappopsmtp-inbound-and-outbound/ to configure both IIS 6.0 inbound to SharePoint and HMailServer SMTP/IMAP for end user mailboxes.

       

      With SSRS online the next task was to build a sample report.  Below are the steps I followed.  

      In the end we have a nice graphical USA map with data points coming from SPList.  Enjoy the screenshots!   

      shades_smile

       

      1. Open SP2013 Team Site
      2. Create new list named “States” with columns “Title” and “Number”
      3. QuickEdit to add a few sample rows
      4. Activate “PowerView” site collection feature
      5. Add SSRS Content Types to a library
      6. Launch Report Builder 3.0
      7. Create a map with wizard
      8. View in IE to test
      9. Schedule daily job to run report and email PDF
      10. View PDF

       

      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image
      image

      FIXED BDC – Database is in compatibility range and upgrade is recommended

      I noticed the message “BdcServiceDatabase – Database is in compatibility range and upgrade is recommended” in Central Admin.   This often seems to come up after applying a CU patch.

      The fix was just to run a quick PowerShell line to upgrade the database.  Here it is for reference.  Cheers! 

      shades_smile

       

      (Get-SPDatabase | ?{$_.type -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceDatabase"}).Provision()

       

      image

       

      image

      © Copyright 2016
      @ SPJeff

      Return to Top ▲Return to Top ▲