ADUser Properties

Welcome Forums General PowerShell Q&A ADUser Properties

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

      I’ve been adapting this script: https://dev.to/jcoelho/how-to-deploy-email-signatures-through-group-policies-4aj1

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

      If I set $mob=ADUser.mobile in the script it gets no value.

      If I Write-Host $ADUser.mobile 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,$ADUser.mobile

      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=$ADUser.mobile and then replace using $mob I get the same result.

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

      Any help much appreciated.

    • #207753
      Participant
      Topics: 6
      Replies: 93
      Points: 428
      Helping Hand
      Rank: Contributor

      This seems to work:

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

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

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