PowerShell: edit and debug ps1 files in Visual Studio

In Visual Studio it's possible to edit and debug PowerShell scripts, using the PowerShell Tools for Visual Studio 2015 extension.

But even after installing the extension, debugging doesn't immediately work, as trying to do this, the output window simply shows an unauthorized access error message.

I've found the blog post PowerShell Tools for Visual Studio 2013 – unable to run and/or debug PowerShell script – execution policies problem that has helped me in finding the solution:

  • from a PowerShell window with elevated privileges,
  • run the command "Set-ExecutionPolicy" RemoteSigned

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”