scine / office365 Goto Github PK
View Code? Open in Web Editor NEWOffice 365 Powershell scripts
Office 365 Powershell scripts
Hi Scine,
Need your help, hope you don't mind me raising an issue.
I am working on a script which removes the licenses of an office365 user.
In the script I need to remove multiple irrelevant licenses of an user. Now all these irrelevant licenses would be received dynamically and will be stored in a variable.
I know if we had known the name of the licenses to be removed beforehand. This will be the command :
Set-MsolUserLicense -UserPrincipalName "[email protected]" -RemoveLicenses "liconline:DESKLESSPACK","liconline:OFFICESUBSCRIPTION";
Assuming F1 and proplus are the licenses not required by the user TestB. I ran this and it produced the expected results.
However that is not going to work in our case as we will need to do that dynamically(we might not know what are those and how many of those licenses)
So I tried it running this way :
$license = "`"liconline:DESKLESSPACK`",`"liconline:OFFICESUBSCRIPTION`""
Set-MsolUserLicense -UserPrincipalName "[email protected]" -RemoveLicenses $license;
But it gave following error :
Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
I don't know what is wrong here since both of the licenses needs to be under double quotes I have provided the same in the string and escaped it using a back tick
Would you be by any chance spare some time and help me out with this. I couldn't think of any other way to fix this and I don't want to split the string and iterate it maybe through a for loop.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.