ADUser Properties

Welcome Forums General PowerShell Q&A ADUser Properties

Viewing 1 reply thread
  • Author
    • #207423
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      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.

    • #207753
      Topics: 10
      Replies: 204
      Points: 1,001
      Helping Hand
      Rank: Community Hero

      This seems to work:

      <em>$signature = $rawTemplate.Replace(&#039;PHONE2&#039;, $ADUser.Mobile)</em>

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

Viewing 1 reply thread
  • The topic ‘ADUser Properties’ is closed to new replies.