ADUser Properties

I’ve been adapting this script:

My script is very similar but there is one ADU property giving me problems. That is mobile phone ($

If I set $ in the script it gets no value.

If I Write-Host $ I get the correct value.

My template file contains the line <td colspan=“2class=“style2”>Mobile: PHONE2

My script has

$mobilePlaceHolder = “PHONE2”

$signature = $rawTemplate -replace $mobilePlaceHolder,$

This gives no mobile number in the html file. The page source confirms that PHONE2 has gone but nothing replaces it.

If I assign $mob=$ and then replace using $mob I get the same result.

In a Powershell session assigning $mob to $ works fine, just not in the script.

Any help much appreciated.

This seems to work:

$signature = $rawTemplate.Replace('PHONE2', $ADUser.Mobile)

Keep in mind, the .Mobile property must contain a value.