Re-create expired Client Secret for a SharePoint Addin

There are moments when PHA’s client secrets expire.

If you generated the ClientId and ClientSecret using the /appregnew.aspx, then the secret will expire in 1 year.

The script below removes the current secrets and creates new ones valid for max. 3 years.


Remove Yammer, Power Apps and Flow licenses from all users in Office365

There are organizations that don’t need or are not allowed to use certain services provided by Office365, such as:

  • FLOW_O365_P3
  • TEAMS1
  • ADALLOM_S_O365
  • SWAY
  • INTUNE_O365

Bellow you may find a script that removes Yammer, Sway, Power Apps and Flow plans from all the licenses assigned to all the users in Office365.

Just fill in the $UndesiredPlans variable with plan names excerpts.


Effects of users` license removal after a cutover migration

We recently performed a migration from an Exchange 2013 farm to Exchange Online, hosted in Office365. The migration method used was cutover migration.

There were roughly 190 users and cca. 400 mailboxes to be cloud synced.

Everything went ok until the moment when we needed to assign licenses to users (of course after Azure AD connect tool finished its duty).

When a cutover migration happens, it copies fully and then incrementally all the mailboxes from on-premises to Office365 and also it creates the users in Azure AD. Well, when the users are created, they are also mapped either as User Principal Names on one or more mailboxes or they are delegated to open certain mailboxes, exactly as they are set in on-premises.

Also, an Office365 user license is assigned to the respective users.

Should you decide that the assigned license is not the right one for the users, don’t remove the license and assign a new license, but rather replace the users` licenses with another one.

As soon as an user doesn’t have anymore a license that grants access to Exchange Online, all the mailboxes he used to have access to, will be tombstone-deleted.

Assigning back an Exchange online compatible license to an user is restoring only it’s main mailbox, in a best effort from Microsoft. Not all the mailboxes the user has had access to.

So don’t forget: always replace a license, don’t retract one to set another one.

See you later,

Bogdan Grozoiu

How to run a graceful shutdown of a Distributed Cache Service instance before restarting the server


Install and configure RBS with SharePoint 2013 and SQL Server 2012

This post is applicable only to SQL Server 2012, SQL Server 2012 SP1 with SharePoint 2013 SP1.

Before you implement RBS, I highly recommend that you evaluate its potential costs and benefits. For more information and recommendations about how to use RBS in a SharePoint 2013 installation, see Plan for RBS in SharePoint 2013.

1. Prerequisites

1.1 Environment

  • A ready to use SharePoint 2013 SP1 farm.
  • A ready to use SQL Server 2012 machine.

1.2 Roles

  • The Farm account with local administrator rights on all the SharePoint 2013 Web Front Ends.
  • The Farm account must also be assigned with dbcreator and securityadmin server roles on the SQL Server 2012 instance.

1.3 Binaries


2. Provision a SharePoint 2013 site collection

2.1 Create a new Web Application if there is none created (w/o Central Admin Web Application)

  • Open the Central Administration with a Farm admin account
  • Click on : Application Management –> Manage web applications  –> New
    • Name : SharePoint – 8888
    • Port : 8888 (or any of your convenience)
    • URL : http://V15SP1:8888 (this is the public url if host header is not specified)
    • Application pool name : SharePoint – 8888
    • Database server : SQL2012SERVER
    • Database name :  WSS_Content_RBS
    • Authentication : Windows

2.2. Create a site collection in the newly created WebApp

  • Login on any SharePoint machine as a farm admin
  • Launch PowerShell ISE as Administrator

  • Create a new site collection using PowerShell cmdlets :

Add-PSSnapin *

New-SPSite -Url http://v15sp1:8888/ -OwnerAlias “GBG\SP_Farm” -ContentDatabase “WSS_Content_RBS” -Template STS#0

  •  Make sure that the site collection has been successfully created.

3. Configure SQL Server 2012 SP2 for RBS

3.1. Enable FILESTREAM on the SQL Server Instance

  • Login on the SQL Server 2012 machine and open SQL Server Configuration Manager.
  • Click on SQL Server Services
  • In the list of services, locate the instance of SQL Server on which you want to enable FILESTREAM, right-click on it and click Properties.
  • In the SQL Server Properties box, click the FILESTREAM tab and select :
    • Enable FILESTREAM for Transact-SQL access check box.
    • Enable FILESTREAM for file I/O access.
    • Allow remote clients to have streaming access to FILESTREAM data.
    • Hit Apply and then OK.

  • Open SQL Server Management Studio
  • Click New Query
  • In the Query Editor, enter the following SQL code:
    EXEC sp_configure filestream_access_level, 2


  • Select and execute them one by one. You should notice the following Messages:

“Configuration option ‘filestream access level’ changed from 0 to 2. Run the RECONFIGURE statement to install.”

“Command(s) completed successfully.”

3.2. Provision a BLOB Store for the content database

  • Open the SQL Server Management Studio
  • Connect to the SQL Server Instance that hosts the content database
  • Find the content database for which you want to create a BLOB store, right click in it and then click New Query.
  • Run the following SQL queries in the following order, replacing the highlighted text accordingly :

Note that the Blob store process creates a folder in the location that you specify and this can be done only one time. If you will try to provision the same Blob store one again, you will receive an error.

use [WSS_Content_RBS]

if not exists (select * from sys.symmetric_keys where name = N’##MS_DatabaseMasterKey##’)create master key encryptionby password = N’Admin Key Password !2#4′

use [WSS_Content_RBS]

if not exists (select groupname from sysfilegroups where groupname=N’RBSFilestreamProvider’)alter database[WSS_Content_RBS] add filegroup RBSFilestreamProvider contains filestream

use [WSS_Content_RBS]

alter database [WSS_Content_RBS] add file (name = RBSFilestreamFile, filename = ‘C:\Blobstore’) to filegroupRBSFilestreamProvider

  • At the end you should receive the following message : “Command(s) completed successfully.” and should find a new folder under C:\ partition.

3.3 Install the RBS provider binaries on the SQL server and each Web Front End

Deployment order : SQL Server (1st) –> SharePoin WFEs (2nd)

3.3.1 Install RBS on the SQL server

  • Download the RBS.msi from SQL Server 2012 Feature Pack
  • Run command prompt as Administrator and switch to the directory to the folder where the RBS.msi is saved (e.g.: c:\RBS\)
  • Run the following statement into the command prompt window and note the changes you have to set-up:
  • In the same folder you should find a file: “rbs_install_log.txt” with the RBS installation log.
    • The log file size should be higher than 1 MB (mine was 1,246 KB)
    • The operation is not instantaneous and requires you to wait for it to end successfully.
    • If the log is smaller and you find more error messages, you may have miss-typed the cmd prompt install string.

  • Verify if everything went fine:
    • Check in the “Programs and Features”.
      • You should find installed: “Microsoft SQL Server 2012 Remote BLOB Store”

    • Check the log bottom-up:
      • At the end of it you should find a string : “Product: Microsoft SQL Server 2012 Remote BLOB Store  — Installation completed successfully.”
      • Search up for : “error” and you should find : “Installation success or error status: 0.” No other relevant information should be found.
    • Check the database “WSS_Content_RBS”
      • Open Microsoft SQL Server Management Studio
      • Connect to the SQL Service instance (if already connected, refresh the connection)
      • Expand the “WSS_Content_RBS” database -> Tables -> scroll down
        • Find about (less than) 20 tables starting with “mssqlrbs*” name

3.3.2 Install RBS on the SharePoint Web Front Ends


  • Download the same RBS.msi from SQL Server 2012 Feature Pack
  • Run command prompt as Administrator and switch to the directory to the folder where the RBS.msi is saved (e.g.: c:\RBS\)
  • Run the following statement into the command prompt window and note the changes you have to set-up:
msiexec /qn /lvx* rbs_install_log.txt /i RBS.msi DBNAME=”WSS_Content_RBS” DBINSTANCE=”SQL2012SERVER” ADDLOCAL=”Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer”
  • In the same folder you should find a file: “rbs_install_log.txt” with the RBS installation log.
    • The log file size should be smaller than 1 MB, but bigger than 500KB.
    • The operation is not instantaneous and requires you to wait for it to end successfully.
    • Find any error messages if any. They may appear if you have miss-typed the cmd prompt install string.

  • Repeat the operation for each Web Front End using the same install statement as above and verify the install log and in “Programs and Features” as well.

Here ends the installation part.

4. Configure SharePoint 2013 to use RBS

4.1 Configure SharePoint WebApp to use RBS

  • Open as administrator: SharePoint 2013 Management Shell
  • Run the following cmdlets and change the name of the Web Application Accordingly:
$cdb = Get-SPContentDatabase –WebApplication  http://V15SP1:8888
$rbss = $cdb.RemoteBlobStorageSettings

4.2 Test for proper installation on all Web Front Ends

  • Below is an example of bad installation. The RBS install log is ~50 KB


  • Executing $rbss.Installed() should return true, if false this may be due to the reason that RBS is not installed properly or RBS is not installed on other Web servers. Verify the RBS installation log on all the servers. If you think something is wrong uninstall RBS from “Programs and Features”, restart the machine and then re-install using step 3.3.2.