Share via

Cannot bind argument to parameter 'UserPrincipalName' because it is null

Anonymous
2018-08-03T21:38:45+00:00

What am I doing wrong here?  I have a txt file that looks similar to this:

UserPrincipalName

******@companyname.com

Microsoft 365 and Office | Subscription, account, billing | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2018-08-15T09:51:57+00:00

Hi Brian,

Thanks for your information in Private Message.

The files you provided have correct formats.

According to my test, I am able to remove licenses from a csv file using following scripts:

1.

connect-msolservice

(Sign in with your administrator account)

2.

Import-Csv "<your csv file path>" | ForEach-Object {

    $User = Get-MsolUser -UserPrincipalName $_.UserPrincipalName

    Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -RemoveLicenses <your domain>:VISIOCLIENT

}

(Change the CSV file path and the domain name and copy the scripts to powershell then press enter)

3.

To check the result, please sign in Office 365 portal and check one user if his visio license is removed in "Active users".

In addition, if there are any error messages when you run the scripts, please capture the screenshots to share with me and I will provide further help for you.

Best Regards,

Gloria

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2018-08-17T14:06:10+00:00

Hi Brian,

Please let me know if the scripts work for you.

Best Regards,

Gloria

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

13 additional answers

Sort by: Most helpful
  1. Anonymous
    2018-08-05T17:36:18+00:00

    What I'm trying to do is simply remove an O365 (Visio) license from all users that are assigned one.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-08-04T06:33:20+00:00

    Hi Brian,

    Here are some articles for your reference: 

    Set-MsolUserPrincipalName

    Add User Principal Names in Active Directory via PowerShell.

    I would like to confirm some information with you for further troubleshooting:

    1. Do you want to rename a user account or update user details with a text file?

    If not, could you please list your steps which caused the issue to share with us?

    1. In addition, can you be more descriptive of what it is that you want?

    Best Regards,

    Gloria

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more