The stuff that goes around the windows and doors that you're referring to is called j-channel.
I used pieces of J channel cut to fit neatly behind the j-channel that's around the windows and doors and then silicone the strip to the surface of that J channel with a flat 18 gauge piece of wire long enough to allow movement.
The j-channel comes with slotted holes that are supposed to be used for mounting it to the house, I use a tin snip and cut that section off so it slides tight against the j-channel on the house.
There's also holes on the ends of the J channel so I can run zip ties through there to hold the corners together.