I've written a script to disable office 365 plans and to export any failures.
Attached is the readout 'test' with a weird message.
Attached is the script and sample csv file.
script to output results
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- lonwitness
- Posts: 1
- Last visit: Wed Aug 09, 2017 6:17 am
script to output results
- Attachments
-
- users.csv
- (317 Bytes) Downloaded 133 times
-
- Test.txt
- (136 Bytes) Downloaded 115 times
-
- newscript2.txt
- (1.73 KiB) Downloaded 126 times
Re: script to output results
This line here:
Just based on formatting that's probably where you are getting your error. You should do something like
Use of the ` acts like a word wrap so you can continue the code onto the second line.
Code: Select all
$users| foreach-object {Set-MsolUser -UserPrincipalName $_.O365_UPN -UsageLocation $UsageLocation;Set-MsolUserLicense -
UserPrincipalName $_.O365_UPN -AddLicenses $AccountSkuId -LicenseOptions $licenseoptions} -ErrorAction Stop
Code: Select all
Set-MsolUser -UserPrincipalName $_.O365_UPN -UsageLocation $UsageLocation; Set-MsolUserLicense `
-UserPrincipalName $_.O365_UPN -AddLicenses $AccountSkuId -LicenseOptions $licenseoptions