SharePoint: how check if a user has "Replicating Directory Changes" permission

In the User Profile Synchronization job, the user running it must have in Active Directory the permission "Replicating Directory Changes".

By one client, there was a debate between the client itself and one of its supplier offering the AD services about if the user had this permission.

To check this, I have found a PowerShell script doing this test in Checking Replication Directory Changes for account by PowerShell.

For reference I have copied the script here: CheckRDC.ps1 (1.4KB), then you can run it with:

     .\CheckRDC.ps1 “DOMAIN\username”

SharePoint: wrong domain name after user profile synchronization

If there is a NetBIOS domain name, the user profile synchronization in SharePoint will give incorrect results, because the users will be prefixed with the domain name (for example: "AD" in "ad.mycompany.com") instead of the NetBIOS domain name (for example: "MYCOMPANY-AD").

This problem is described well in WRONG DOMAIN NAME IN ACCOUNTNAME AFTER USER PROFILE SYNC.

The solution is to change the property of the User Profile Application to the value 1, and then recreate the connection and do a full synchronization.

This topic is described in the Microsoft Technet article Synchronize user and group profiles in SharePoint Server 2013.

Azure: how download the whole Azure website as zip file - and other useful tools

I needed to download my local Azure website as single zip file (to improve download speed, compared with thousands of files downloads via ftp).

I've found the article Windows Azure Websites online tools you should know about that describes in detail the SCM website.

Pratically it uses the Azure REST api to give a lot of information about your website. Debugging it (with Fiddler, for example) you can analyze and study them. And also from the menu, going to Debug Console | PowerShell, you can browse your folder structure and zip what you want to download quickly.

The link to open is: https://{site name}.scm.azurewebsites.net

Azure Websites: how install a SSL certificate

In my website I wanted to install a SSL certificate for my login page.

I got a certificate from DigiCert - luckly as a Microsoft employee, we can them for free - Thank you Paul !

Then:

  1. if you still don't have it, you have to register your Azure Website with a custom domain name, as described in Configure a custom domain name in Azure App Service
  2. you need to configure your Azure Website with Scale=Standard
  3. then, rather than following the official guide Enable HTTPS for a web app in Azure App Service, I have followed the simpler DigiCert guide Windows Azure Website: Create CSR & Install SSL Certificate
  4. finally modify the web.config of your application to force the login page or all the resources in https
It's worth noting that in case you have some warnings because of mixed http and https resources, you can use the very useful tool Why No Padlock? to find hardcoded protocols in your page. For example, for external resources to your site, you want to be protocol agnostic prepending the external resources with "//".

First experiences with TypeScript in Visual Studio 2013 using jQuery and KnockoutJS libraries

For one customer, I wanted to create a POC to showcase the compile-time error checking advantages of TypeScript.

First of all: Visual Studio 2013 with Cumulative Update 4 is not enough to get the latest version of TypeScript, so you need to download it from TypeScript 1.4 for Visual Studio 2013. It is required to correctly compile some of the TypeScript definition files that will be included later.

Then it's possible to start creating a new MVC application. It includes by default NuGet packages for some common JavaScript libraries: jQuery, jQuery UI and Knockout JS, but it's possible to remove them or add new ones. These libraries are included by the MVC shared view _Layout.cshtml via bundle inclusions. The bundles are defined in App_Start/BundleConfig class.

To be able to use these libraries in our TypeScript files (getting compile-time error checking and Intellisense suggestions) it's necessary to include the .d.ts files, that are definition files with the purpose of use non-TypeScript libraries in TypeScript files. They can be found in the GitHub project DefinitelyTyped, but it's better to include them via NuGet packages (search for example for TypeScript jQuery, and so on).

Now following for example the example in TypeScript and JQuery example, I create a MyApp.ts file and paste the code here below (it's also possible to download the file MyApp.ts (392B):

/// <reference path="jquery.d.ts" />
 
class Person {
 
constructor(name:string)
{
this.name=name;
}
name: string;
}
 
function greeter (person:Person){
return "hallo "+person.name;
}
 
var person=new Person("bert");
 
 
$(document).ready(function(){
var message = greeter(person);
$("#status")[0].innerHTML=message;
});


As this file is created, a correspondent JavaScript file MyApp.js should be created.

Without including this file in the Visual Studio solution, it's possible to include this file in our shared _Layout, or better include it in one bundle.

At this point running the program, an alert, result of our MyApp code, should be displayed.


Notes so far in my research:

  • even if we have the .d.ts file, the original JavaScript files must be included. The .d.ts file is only a bridge to allow to use these libraries in the new TypeScript files, as described in Using jQuery plugin in TypeScript.
  • the .d.ts file can have a version different from the included JavaScript files, so when including these modules, it can be tricky to select the correct NuGet version. Else we can have a misalignment between the real JavaScript file and the hints suggested by the TypeScript compiler.

The better reference I have found to learn TypeScript is the TypeScript Handbook.

Visual Studio: managing NuGet packages in nested solutions

For one client I had to solve the problem of NuGet packages in nested solutions, where piratically there is one big solution file (used mainly by the build server) and many other nested solutions used by the various developer teams.

The solution in Nuget with multiple nested solutions simply works, but it uses an absolute path, so there can be issues when using the solutions from different machines (developer configurations, build server, and so on). The goal is to use relative paths.

Another long thread is Setting up a common nuget packages folder for all solutions when some projects are included in multiple solutions and it shows multiple alternative (even because meanwhile the tools has improved so many steps are no more necessary).

One example of configuration file can be downloaded here: NuGet.config (514B)

The only important things to note are:

  • the packages paths are relative to the .nuget folder


Bitlocker: how recover the recovery key

Hi,

my company requires me to use BitLocker on my computer hard-disk.

Today I have discovered that after Windows updates, it can request a recover key.

So save it for future requests, it's possible to recover it, for an already BitLocked drive, using the following command from an administrative command line (Windows key, type "Command Prompt", right click, "Run as administrator"):

   manage-bde -protectors c: -get

Where C: is the drive whose key you want to recover.