Hi All,
I'm currently struggling to change multiple users' passwords in Office 365 and I can't quite figure out what's wrong with my code. I have the following:
Text
Connect-MsolService$tenID=(Get-MsolPartnerContract -Domain MyCustomer.onmicrosoft.com)Get-MsolUser -TenantId $tenID.TenantID.Guid | Select UserPrincipalName | Export-Csv C:\location.csv$Pass =Read-Host "Enter Password"Import-Csv C:\location.csv | % { Set-MsolUserPassword -UserPrincipalName "$_.UserPrincipalName" -NewPassword "$Pass" -ForceChangePassword $True -TenantId $tenID.TenantID.Guid }
It's the last line of code that is the issue. I'm trying to import the CSV after modifying it to suit the users I want to change. Every time I run this, however, I get:
Set-MsolUserPassword : User Not Found. User: @{UserPrincipalName=Name@MyCustomer.co.uk}.UserPrincipalName.
At line:1...