Script to assign licenses to bulk AD synced user's office 365

i have dirsync so all my local ad users are synced with office 365 tenant
Now I am migrating mailboxes and I need to assign licenses to a bulk migrated users using csv
This process requires 2 steps ‘cmdlts’
$usagelocation = “SA”
Set-MsolUser –UserPrincipalName user@domain -UsageLocation $UsageLocation
After defining the location above time to assign the licenses
 Set-MsolUserLicense –UserPrincipalName user@domain  -AddLicenses company:ENTERPRISEPACK
So how can I script this and use a CSV file?
Also strange thing, I have ran the above to about 13 users manually, I placed the command on a notepad
Copied all lines and past on the PS, after that other users who already had licenses had their licenses removed! So what did I do wrong? I am asking this to make sure the script you will provide will not remove the currently assigned licenses

this script will work for you given the below conditions
1- you have csv file with only one
Column named "UserPrincipalName" and has all users need to be licensed
2- all users in the above file in the format of [email protected]
3- All users are having the same license
$path= Import-Csv -Path "usersFiles.csv"
foreach ($item in $path){
$MSOLUserName= $item.UserPrincipalName
$password = ConvertTo-SecureString "password here" -AsPlainText –Force
$credential = New-Object System.Management.Automation.PsCredential("your username here",$password)
$cred = Get-Credential -cred $credential
Import-Module MSOnline
Connect-Msolservice -cred $cred
$AccountSkuId = "tenantdomain:ENTERPRISEPACK"
$UsageLocation = "SA"
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $AccountSkuId
Set-MsolUser -UserPrincipalName $MSOLUserName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $MSOLUserName -AddLicenses $AccountSkuId -LicenseOptions $LicenseOptions

Similar Messages

  • Windows 8.1 Mail app does not sync with the Office 365 account

    My company has recently switched to Office 365. Windows 8.1 Metro Mail app does not work with Office365 account. When I switch to IMAP it works but that is soon going to be disabled and is not compliant with the company policy.
    I can add the account and it also pushes the security policies but it does not sync email at all. Says account is not available. The tablet shows up on the mobile devices on the office 365 and I could also remote wipe it.
    It seems everything works except basing email sync. What could be the issue?

    there's a bunch of reading here:
    http://blogs.technet.com/b/exchange/archive/2013/10/18/supporting-windows-mail-8-1-in-your-organization.aspx
    There might also be some useful discussions in the dedicated O365 forum:
    http://community.office365.com/en-us/forums/default.aspx
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • New calender sync after adding Office 365 account

    Hi,
    I always had one Outlook calendar that I have syncced with my iPhone 3GS.
    Now I have added a MS Office 365 account with another calender.
    After adding this new account iTunes won't syncc any of two anymore.
    No errors occur during sync. In iTunes I can only see one calender. On the iPhone I see both.
    Are there any known problems with Office 365 / Exchange?
    Thanks for a hint.

    I've never done it this way before but it might work.
    You can try logging in to the Office 365 portal using your Azure AD admin account. When you get there, click on the purchase services link and add an Office 365 plan. That should integrate O365 with your current directory.
    login.microsoftonline.com

  • Why users with E1 license can use Azure Right Management on Office 365?

    Hello All,
    We have bought 30 E3 Licenses on my office 365 tenant?. However, E1 users can send mail with Azure Right Management policies on Outook?
    Why does it happens?
    Regards
    Jose Osorio

    Hi Jose,
    As far as I know, for Enterprise E1 plan, subscribers can only add Office 365 Message Encryption on a per-user basis by purchasing Windows Azure Rights Management. You might want to have a check and see if you've added this for E1 users.
    By the way, this is the forum to discuss questions and feedback for Microsoft Office client. There is not so much about
    Office 365 license/service aspects here. For your question, I would suggest you to post in the dedicated forum of
    Office 365 Community, where you can get more experienced responses:
    http://community.office365.com/en-us/f/default.aspx
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Ethan Hua
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click
    here

  • I am trying to sync ical with office 365.

    When using office 365 to enter calendar entries, they appear in my iCal.  However, if the entry is input in iCal, it does not syn with Office 365 calendar.  Anyone else have this issue?  Know a fix?

    Read
    Harden your Mac against malware attacks

  • Bulk enable Lync Online for users already synced to Office 365 E1

    We already have 8000 users on Office 365 using E1 Exchange Online. We also have a handful who are using E3 with all services. How do I create a powershell script that will enable all users for Lync Online in addition to what ever licenses and services
    they are currently using?

    Hi Chudly,
    For the office365 issue, I also recommend you can post in dedicated forum for more efficient support:
    http://community.office365.com/en-us/f/166.aspx
    If you want to modify the powershell script, please post the current script and the issue, we will notice and continue to follow up.
    If there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Bulk-enabling users for the Office 365 Messaging Service

    Is it possible to bulk-assign the Office 365 Messaging Service for Unity users after they are migrated to Office 365 from our on-premises Exchange environment instead of manually going into the Cisco Unity Connection Administration tool and performing these steps?
    4.1) Edit the user account in the Cisco Unity Connection Administration
    4.2) From the Edit drop-down menu, select Unified Messaging Accounts
    4.3) Click Add New
    4.4) Select the Office 365 messaging service you created
    4.5) Have it use the corporate email address unless it doesn't actually match the email address for the user on Office 365.
    4.6) Save
    I am hoping something can be done with the Bulk Administration Tool.... :).

    Yep its possible with BAT, i would export the users out. Modify the CSV to only reflect the users that you need, and make sure you have the 'serviceDisplayName' column populated and use the CSV to update it. The BAT column names can be found here: http://www.cisco.com/c/en/us/td/docs/voice_ip_comm/connection/10x/administration/guide/10xcucsagx/10xcucsagappb.html

  • Office 365 Licensing and Powershell

    I would like to write a script to create new users in Office 365 and I have almost all of it figured out but I cannot find a way to increase or decrease the license count. Is it possible to purchase more licenses using powershell or do I need to use the
    online interface?

    I found the below article which might help point you in the right direction....
    http://technet.microsoft.com/en-us/library/dn530773.aspx
    Be kind and Mark as Answer if I helped.

  • Tech Tip of the Week: Syncing Distribution Groups in Office 365

    Having trouble getting your distribution groups to sync when migrating to Office 365?
    We recently worked with a customer who had over 300 distribution groups that were not syncing to Office 365. Upon review, we noticed that the distribution groups did not have a Display Name.
    Here are the steps we took in order to resolve the problem:
    1. Open ADUC “Active Directory Users and Computers “On the top menu click on view and select Advanced Features.
    2. Find the Distribution List that is not syncing to your Office 365 tenant > right click the Distribution List > select Properties > click on the attribute editor tab.
    3. There are a couple attributes that must be filled out in order  for it to Synchronize to Office 365.
    Attributes: mail,
    displayName – if they do not have any data, fill it in. Once completed click ok.
    4. Open the MIISClient. This is located on your DIRSYNC Server. The default path is: “C:\Program Files\Microsoft Online Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe”
    5. Click on Metaverse Search > input the following:
    Attribute: Mail
    Operator: Contains
    Value: 
    “Email Address of the DG”
    6. Once filled in click on search > double click the search results > click on the connectors tab. Note: If
    you only see SourceAD Management Agent, perform the following:
    7. Click on Management Agents > Right click SourceAD > click on Run > click on Full Import Stage Only > click on ok.
    8. Right click SourceAD > click on run > click on Full Sync > click on ok.
    9. Right click TargetWebService > click on Run > click on Full Confirming Import Stage > click on ok.
    10. Right click TargetWebService > click on Run > click on Full Confirming Sync > click on ok.
    11. Right click TargetWebService > click on Run > click on Export > click on ok.
    We hope you found this week’s Tech Tip useful! Do you have a problem you want us to solve in our Tech Tip of the week series? Let us know!

    Check to see that your remote session is still active, using Get-PSSession.

  • How do I import my Outlook 2013 PST file into Office 365 and then have them permanently synced?

    I have Office 365. I have Outlook 2013 downloaded on my computer with all my emails and contacts, etc.
    I want to import the entire PST file with my emails, contacts etc. into Office 365 / Exchange Online (cloud?). Once that is done, I want to set it up so that my Desktop Outlook will always update and sync with my Office 365 when I am out of the office and
    use the Outlook mail App.
    PLEASE HELP!

    Hi,
    You can also use Outlook or Outlook Web App to import your existing PST file into your Office 365 account.
    First configure your Office 365 account into Outlook, then use Import/Export
    feature in Outlook client to import your PST file:
    http://office.microsoft.com/en-us/office365-suite-help/migrate-email-and-contacts-into-a-new-office-365-for-business-account-HA103169067.aspx 
    http://office.microsoft.com/en-us/office-online-help/use-outlook-to-move-information-between-email-accounts-HA104218074.aspx?CTT=5&origin=HA103169067
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Office 365 RDS licensing question

    Dustin, take a look at this when you get a chance: http://blogs.technet.com/b/uspartner_ts2team/archive/2014/09/03/office-365-shared-computer-activatio...
    It explains how the Pro Plus version can be installed in RDS/TS environment, and I get the feeling that it is the only version that can be installed that way.
    It also notes that installing Office 365 Pro Plus on an RDS/TS machine does not take away from the 5 device cap.

    Office 365 has nothing to do with RDS.
    If a user has an Office 365 license then they can use that license wherever they log on from. So if the are using a RDS session on a server then they can use there Office 365 license there. Please note that an Office 365 license allows you to install the full suite on 5 devices and the RDS server would be one of these devices.
    Connecting to the RDS server is entirely different. In order to connect they user or device must have a RDS license. 
    The 2 are unrelated.
    I assume from the context of your question that you already have the RDS environment set up and working so it is as simple as installing the office 365 suite onto the RDS server and allowing the 3 users to use it.

  • Assigning bulk license to Office 365 AD synced users

    Hi,
    We need to assign bulk office 365 license to more than 5K users. Users are already synched by Dirsync server and we only need to apply license. Our users use Exchange onprem and we need to exclude exchange online license from the E2 plan. So we want only,
    Lync ,Off web app and  share point. I have prepared the below script it doesn't make any changes even though it doesnt show any error. I appreciate your help 
      $Step1 = New-MsolLicenseOptions -AccountSkuId mycompany:STANDARDWOFFPACK_FACULTY -DisabledPlans EXCHANGE_S_STANDARD
    Import-Csv .\UPN.CSV | foreach {set-MsolUser -UserPrincipalName $_.UPN -UsageLocation SA}
    Import-Csv .\UPN.CSV | foreach {Set-MsolUserLicense -UserPrincipalName $_.UPN -AddLicenses mycompany:STANDARDWOFFPACK_FACULTY -verbose -LicenseOptions $Step1}
    I followed the below link
    http://community.office365.com/en-us/f/148/t/263052.aspx?ss=6818e221-4ad2-45e4-bf3e-ec8451732a99

    I tested the below code and it worked
    $disabledplans = 'EXCHANGE_S_STANDARD'
    $step1 = New-MsolLicenseOptions -AccountSkuId mycompany:STANDARDWOFFPACK_FACULTY `
    -DisabledPlans $disabledplans
    Import-Csv .\UPN.CSV |
    foreach {set-MsolUser -UserPrincipalName $_.UPN -UsageLocation SA}
    Import-Csv .\UPN.CSV |
    foreach {Set-MsolUserLicense -UserPrincipalName $_.UPN -AddLicenses mycompany:STANDARDWOFFPACK_FACULTY -verbose -LicenseOptions $Step1}
    Regards Chen V [MCTS SharePoint 2010]

  • Use Powershell to bulk activate office 365 Education E1 Students license for 900 synced users

    Hi,
    We have synced 900 users and we need to active "Office 365 Education E1 for Students" (STANDARDWOFFPACK_STUDENT)  license for them using the powershell.
    With the following command I am able to activate one user at a time; Is there anyway to do it to bulk users ?
    Set-MsolUserLicense -UserPrincipalName [email protected] -AddLicenses "teamxxx:STANDARDWOFFPACK_STUDENT"
    And also with the "Office 365 Education E1 for Students" activation I only want "Office Online for Education" to be activated but not "Lync Online", "Sharepoint" and "Exchange Online".
    Any help would be much appreciated, thank you.

    You have to get instructions from them on which keys are to be activated.  YOuo need to activate each product.  YOu are only activating the base product.  Lync and Visio are optional licenses.  It is not a PowerShell issue;
    Notice this parmeters is plural for a reason:
    -AddLicenses
    "teamxxx:STANDARDWOFFPACK_STUDENT"
    You can put an array of licenses.  STANDARD is just the base office product.  Ask themfor the license strings for the other or look at them online.
    See this:
    http://blogs.technet.com/b/educloud/archive/2014/02/05/what-are-my-sku-names-for-office-365-education-and-how-can-i-automate-the-licensing.aspx
    Exchange is part of Office365.  I don't see how you can not have it.  Youc can control which products are downloadable.
    ¯\_(ツ)_/¯

  • Office 365 License powershell Script

    Hello,
    I would like to know two types of PowerShell scripts ( Office 365 ) :
    1. If I would like to assign my users license and diable some features ( Eg: Lync online, ProPlus ) how can I achieve that through powershell for a single user and bulk.
    2. If I have a domain PersianPalace.org and I would like to assign all the unlicensed user having upn wih that domain to be assigned licensed only how can I do that in powershell.
    Thank You,
    Ahmed Bayagon

    Hi,
    You may contact Microsoft Advisory support:
    https://support.microsoft.com/advisory/2847140?wa=wsignin1.0
    Thanks,
    Simon Wu
    TechNet Community Support

  • Script without assigning to the output type

    hi
    i have some doubts in scripts ple tell me
    how can we execute the script without assigning the form & print program to output type in nace?

    Please read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting further.

Maybe you are looking for

  • 'Reminders' app no longer works.

    I am new to iPhone but have used this built-in app before with no problems. Now the + button has disappeared from top RH corner and I therefore cannot create any reminders. Can choose any day from the 7 day calendar showing at bottom of screen but st

  • Access Standard property(eg Fixed Height) of an iview in code

    Hi , I have downloaded the standard URL iview's par(com.sap.portal.httpconnectivity.urliviews.par). I want to access the  property 'Fixed Height' in the code. The component profile of the par doesnt contain the above attribute(and many other standard

  • Elite 3D frame buffer boot error.

    Hi there, I have a SUN Ultra 10 with a Elite 3D AFB Graphics card, that I recently tried to install. Without the Elite 3D card (using the inbuilt PGX24 PCI card) the system boots fine and loads X Windows ok. after I install the Elite 3D card I notice

  • My iMac won't automatically connect to wifi after waking from sleep mode

    After dowloading the newest software update and performing a firmware update for my Airport router, my Imac won't connect to Wifi automatically after waking from sleep mode

  • Replace a vi by a vi in a lvlib

    Hi I would like to use the fonctions replace with , with a vi in a lvlib In case of Conflict it will be more handy to replace a wrong dependencies for all Vi caller with this fonction How we can do that