Convert SID to User Name using PowerShell

Create a SecurityIdentifier object and translate into a NTAccount: 1: $objSID = New-Object System.Security.Principal.SecurityIdentifier 1: (“S-1-5-21-3496554487-1900509739-3140548133-500”) 2: $objUser = $objSID.Translate( [System.Security.Principal.NTAccount]) 3: $objUser.Value

8

PowerShell Snippets Pt. 2

Some more PowerShell snippets. Is the IIS Running? function Check-IISServiceRunning{ try { $iisService = Get-Service W3SVC -ComputerName localhost } catch [ServiceCommandException] { throw “Check IIS service running FAILED. Please install IIS before continueing.” }} If you want to start it you can add: Start-Service -InputObject $iisService Install ASP.NET in the IIS? function Install-ASPNETIIS{ $aspNetRegIISDirectory =…


Fixing: Error in Release Management when using "MTM Automated Tests Manager" – build name restriction

If you want to run an automated test as part of your deployment “MTM Automated Tests Manager” tool as described here: http://nakedalm.com/execute-tests-release-management-visual-studio-2013/ Make sure that your build name does NOT contain any spaces. Due to a bug/limitation in the powershell script used by Release Management this will fail if your build name contains any spaces.

3

Fixing: Prism The property ‘RegionManager.RegionName’ does not exist in XML namespace ‘http://www.codeplex.com/prism’

When downloading the latest Prism version and trying to compile in Visual Studio you might see an error like this: “The property ‘RegionManager.RegionName’ does not exist in XML namespace ‘http://www.codeplex.com/prism'” There are number of suggestions and checks you can do here https://compositewpf.codeplex.com/workitem/10343, but in most cases this happens because files have been downloaded from internet…


PowerShell Snippets Pt. 1

Below are a number of PowerShell snippets that I have find useful. This is just part 1. I will add more along the way. Running as Admin Often you need your script to run as admin – with this function you can check before hand that this is actually the case. function Check-RunningAsAdmin { $id=[System.Security.Principal.WindowsIdentity]::GetCurrent() $principal=New-ObjectSystem.Security.Principal.WindowsPrincipal($id) $administrator=[System.Security.Principal.WindowsBuiltInRole]::Administrator…