title: How do I apply uppercase in a piped select statement in PowerShell?
body: <p>I'm writing a simple PowerShell script that fetches certain fields from Active Directory using the "Get-ADUser" cmdlet and outputs them to a CSV file, which works just fine:</p>
  
  <pre><code>Get-ADUser -filter * -properties Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,SamAccountName -server myADserver.domain.com:3268 | select Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,SamAccountName | Export-Csv -notype C:\Security-ActiveDirectory.csv
  </code></pre>
  
  <p>I'm looking to convert the "SamAccouontName" field to all uppercase when it is output to the CSV file. I tried applying the ToUpper() and Upper(string) methods, but they give me syntax errors:</p>
  
  <pre><code>Get-ADUser -filter * -properties Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,SamAccountName -server myADserver.domain.com:3268 | select Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,ToUpper().SamAccountName | Export-Csv -notype C:\Security-ActiveDirectory.csv
  
  Get-ADUser -filter * -properties Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,SamAccountName -server myADserver.domain.com:3268 | select Division,Department,EmployeeID,GivenName,Sn,C,Title,Mail,ExtensionAttribute3,ExtensionAttribute4,Upper(SamAccountName) | Export-Csv -notype C:\Security-ActiveDirectory.csv
  </code></pre>
  
  <p>Can anyone help me on how I can make that field uppercase and still export to the CSV file?</p>
  
  <p>Thanks!
  Brian</p>