title: Powershell: bulk parametr set
body: <p>am trying to bulk edit &quot;UsageLocation&quot; for a list of users. Running against one UPN is working fine, but bulk not :-/</p>
  <p><strong>CSV example</strong></p>
  <pre><code>UPN
  user1@company.smt
  user2@compamy.smt
  user3@company.smt
  </code></pre>
  <p><strong>Import users from CSV</strong></p>
  <pre><code>$userlist = Import-Csv .\users.csv
  </code></pre>
  <p><strong>Set usagelocation before adding a license</strong></p>
  <pre><code>Set-MsolUser -UserPrincipalName &quot;user@company.com&quot; -UsageLocation &quot;XY&quot;
  </code></pre>
  <p><strong>Set UsageLocation for users from CSV</strong></p>
  <pre><code>$userlist.foreach(
      {
          Set-MsolUser -UserPrincipalName $_.UPN -UsageLocation &quot;XY&quot;
      }
  )
  </code></pre>
  <p><strong>Error returned</strong></p>
  <pre><code>Set-MsolUser : User Not Found.  User: .
  At line:3 char:9
  +         Set-MsolUser -UserPrincipalName $_.UPN -UsageLocation &quot;XY&quot;
  +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : OperationStopped: (:) [Set-MsolUser], MicrosoftOnlineException
      + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.UserNotFoundException,Microsoft.Online.Administration.Automation.SetUser
  
  Set-MsolUser : Invalid value for parameter.  Parameter Name: UsageLocation.
  At line:3 char:9
  +         Set-MsolUser -UserPrincipalName $_.UPN -UsageLocation &quot;XY&quot;
  +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : OperationStopped: (:) [Set-MsolUser], MicrosoftOnlineException
      + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.PropertyValidationException,Microsoft.Online.Administration.Automation.SetUser
  </code></pre>
  <p>Any ideas, please? :-(
  Thanks a lot.</p>