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

PowerShell

Measure Performance – SharePoint Online (o365-speed)

PowerShell offers an excellent way to measure command line execution times with “Measure-Command” and Script Block.   With the example below, we run 10 repetitions to connect to SharePoint online and measure the response time in milliseconds.   Cheers!  

shades_smile

Video

Measure Performance – SharePoint Online (o365-speed) from Jeff Jones on Vimeo.

Source Code

Screenshots

image

References

PWA Refresh – Clone Project Server to Lower Env (DEV)

Cloning a project server environment is not a simple procedure.   Wanted to share notes to help others.   Duplicating the SQL databases is a good start.   However, there are internal issues with duplicate GUID (same number already in use) that can create issues.

To resolve that hurdle I coded PowerShell which generates a new GUID and updates Site Collection (SPSite) via TSQL directly.   https://github.com/spjeff/spadmin/tree/master/SPContentDatabase-Replace-Site-GUIDs

With a fresh new GUID in place we can follow steps in SharePoint Central Admin, PowerShell, and PWA Settings to bring the new PWA database pairs (SharePoint Content + Project Plans) online for customers.   Word DOC included below with step-by-step detail.   Cheers! 

shades_smile

Download Checklist

PWA Refresh Procedure.DOC

Diagram

image

Context Diagram

References

FIXED – Cannot convert the JSON string … contains the duplicated keys ‘Id’ and ‘ID’

Recently I came across the error message below when download a SharePoint 2013 List item REST api call to PowerShell.  The cmdlet ConvertFrom-JSON does an excellent job.  However, it is case sensitive with property names.

The resolution I found was to first string replace (case sensitive) to rename one of the source property names.  Cheers! 

shades_smile

Screenshot – Before

ConvertFrom-Json : Cannot convert the JSON string because a dictionary that was converted from the string contains the duplicated keys ‘Id’ and ‘ID’.

image

Screenshot – After

image

Code

cls

# Config
$web = "http://portal/sites/team"
$list = "Test"

# Digest
$urlView = "$web/_api/contextinfo"
$urlView
$req = Invoke-WebRequest $urlView -UseDefaultCredentials -UseBasicParsing -Method Post
[xml]$ctx = $req.Content
$digest = $ctx.GetContextWebInformation.FormDigestValue
$digest

# List Items
$urlItems = "$web/_api/web/lists/GetByTitle('$list')/getitems"
$json = "application/json; odata=verbose"
$headers = @{"Accept" = $json; "Content-Type" = $json; "X-RequestDigest" = $digest}
$body = '{"query":{}}'
$req = Invoke-WebRequest $urlItems -UseDefaultCredentials -UseBasicParsing -Method Post -Body $body -Headers $headers
$resp = $req.Content

### FIX - Case Sensitive Property Name Replacement ###
$resp = $resp.Replace("Id","Idd")

$json = $resp  | ConvertFrom-Json
$json

References

FIXED – stsadm upgrade command has been replaced by psconfig.exe

Recently I came across the error below when upgrading a SharePoint 2016 farm.   Expected product behavior and simply a case of training SharePoint Administrators to use PSCONFIG.EXE command line instead.  Cheers! 

shades_smile

Error Screenshot

image

New Command

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲