In a large sauce pan combine the pistachios, milk and salt and bring just to a boil. Let sit for about 15 minutes. Strain the mixture through a fine mesh strainer and discard the solids. Measure the liquid, you need 2 cups. If you don’t have 2 cups add more milk. Rinse and wipe out the saucepan.
In the bowl of an electric mixer, preferably fitted with a paddle attachment, beat the egg yolks and sugar until the mixture is thick and light yellow, about 3 minutes. Turn the mixer to low and slowly add the cornstarch. Slowly pour in the pistachio milk and mix until well combined. Pour the mixture into the saucepan.
Cook the mixture over medium heat, stirring constantly with a whisk or wooden spoon until the mixture starts to boil gently. Continue cooking, stirring constantly for 1 or 2 minutes until the mixture is thick. Remove from the heat and stir in the cold butter and vanilla. If the mixture starts to look curdled, just whisk the daylights out of it, it will come together again. Strain the mixture through a fine strainer into a clean bowl. Cover with a piece of plastic wrap, pressed directly onto the surface of the pastry cream to prevent a skin from forming. Refrigerate until cold, about 2 hours.
Pastry cream can be made 2 to 3 days ahead. Whisk the pastry cream by hand or with a handheld mixture until smooth before using.