title: Customizing PS Prompt in Windows 10 shows unexpected Result
body: <p>I am trying to customize my PS Prompt in Windows 10 by adding the Azure Account ID. However, it is not working as expected.</p>
  <p><strong>Output of Azure Account ID, results in the following:</strong></p>
  <pre><code>[0.04 sec] &gt; (Get-AzContext).Account.Id
  david.maryo@jd.com
  </code></pre>
  <p>I want the my result 'Account.Id' from the above command should be displayed in my PS Prompt. But it is not displaying the necessary results. Please refer the below screenshot for information.</p>
  <p><strong>Screenshot of the Current PS Prompt:</strong>
  <a href="https://i.stack.imgur.com/hzpzy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hzpzy.png" alt="enter image description here" /></a></p>
  <p><strong>Microsoft.PowerShell_profile.ps1</strong></p>
  <pre><code>function prompt {  
      #Assign Windows Title Text
      $host.ui.RawUI.WindowTitle = &quot;Current Folder: $pwd&quot;
  
      #Configure current user, current folder and date outputs
      $CmdPromptCurrentFolder = Split-Path -Path $pwd -Leaf
      $CmdPromptUser = [Security.Principal.WindowsIdentity]::GetCurrent();
      $Date = Get-Date -Format 'dddd hh:mm:ss tt'
  
      # Test for Admin / Elevated
      $IsAdmin = (New-Object Security.Principal.WindowsPrincipal ([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
  
      #Calculate execution time of last cmd and convert to milliseconds, seconds or minutes
      $LastCommand = Get-History -Count 1
      if ($lastCommand) { $RunTime = ($lastCommand.EndExecutionTime - $lastCommand.StartExecutionTime).TotalSeconds }
  
      if ($RunTime -ge 60) {
          $ts = [timespan]::fromseconds($RunTime)
          $min, $sec = ($ts.ToString(&quot;mm\:ss&quot;)).Split(&quot;:&quot;)
          $ElapsedTime = -join ($min, &quot; min &quot;, $sec, &quot; sec&quot;)
      }
      else {
          $ElapsedTime = [math]::Round(($RunTime), 2)
          $ElapsedTime = -join (($ElapsedTime.ToString()), &quot; sec&quot;)
      }
  
      #Decorate the CMD Prompt
      Write-Host &quot;&quot;
      Write-Host &quot;Azure: (Get-AzContext).Account.Id&quot;
      Write-host ($(if ($IsAdmin) { 'Elevated ' } else { '' })) -BackgroundColor DarkRed -ForegroundColor White -NoNewline
      Write-Host &quot; USER:$($CmdPromptUser.Name.split(&quot;\&quot;)[1]) &quot; -BackgroundColor DarkBlue -ForegroundColor White -NoNewline
      If ($CmdPromptCurrentFolder -like &quot;*:*&quot;)
          {Write-Host &quot; $CmdPromptCurrentFolder &quot;  -ForegroundColor White -BackgroundColor DarkGray -NoNewline}
          else {Write-Host &quot;.\$CmdPromptCurrentFolder\ &quot;  -ForegroundColor White -BackgroundColor DarkGray -NoNewline}
  
      Write-Host &quot; $date &quot; -ForegroundColor White
      Write-Host &quot;[$elapsedTime] &quot; -NoNewline -ForegroundColor Green
      return &quot;&gt; &quot;
  } #end prompt function
  </code></pre>