Use powershell to remove all O365 licenses from list of accounts

Hi,

I’d like to know if there’s any way I can use powershell to revoke all licenses applied to multiple office 365 users?

 

The user list is stored in a plain txt file containing just the Active Directory username on each line for each user which needs the licenses revoking. Any assistance anyone can provide will be massively appreciated

Did you attempt to search for this?

https://docs.microsoft.com/en-us/microsoft-365/enterprise/remove-licenses-from-user-accounts-with-microsoft-365-powershell?view=o365-worldwide