StringPadding not working?

by Jul 30, 2015

I doubt it isn't working. It must be me understanding it wrong [:)].
I searched on the net but I could'nt find what I'm looking for.

Let me explain what I want to achieve:
I want to have a function that creates a header for my scripts. This header is something in the style of:

********** Reset Password **********
* Author     : Mr. T                                    * 
* Date         : 12/07/2015                        *
********************************* 

It has a fixed width of 50 chars.

The first thing I'm struggling with, is the first line.. I can't seem to pad the chars to the left and the right of the title. 
It is if only 1 padding is allowed?

I'm confused! Can somebody explain?
A simplified example:

$aString = " abc "
$aLeft = $aString.PadLeft(15,'*')
$aRight = $aString.PadRight(15,'x')
$aComplete1 = $aLeft.PadRight(15,'x')
$aComplete2 = $aRight.PadLeft(15,'*')

Write-Host "String                      : $aString"
Write-Host "With padding only at left   : $aLeft"
Write-Host "With padding only at right  : $aRight"
Write-Host "With both padding (method 1): $aComplete1"
Write-Host "With both padding (method 2): $aComplete2"

Gives me as output:

String                      :  abc
With padding only at left   : ********** abc
With padding only at right  :  abc xxxxxxxxxx
With both padding (method 1): ********** abc
With both padding (method 2):  abc xxxxxxxxxx

 

I would expect to be $aComplete1 and $aComplete2 be padded at the left AND right!?