Powershell Script to create new user, enable for Exchange, UM and Lync Server

I created this powershell for our internal onboarding process, figured I would share it with the masses.

I think there are a couple good takeways from this script, it remotes into Exchange 2010 and Lync Server 2010 Powershell sessions, so nothing except Powershell 2.0 is required on the client side, which is standard with Windows 7. It also shows how you can simultaneously use Exchange and Lync powershell commands in the same script to get things done.

A couple of disclaimers:

I am in no way advanced at powershell scripting, so nothing fancy here.

This was developed specifically for my internal needs, you will probably have to add/remove variables and requirements.

http://cid-389bd51b03b1f8f9.office.live.com/embedicon.aspx/Public/UserSetupScriptGeneric.ps1

 

Script is above, any freedback is appreciated, if you improve on this at all, I would love to see it as well.

(626)

If you like it, share it!

    Posted on by Randy Wintle in Enterprise Voice, Exchange 2007, Exchange 2010, Exchange UM, Lync, Lync RC, Microsoft, OCS, OCS 2007 R2, Unified Communications 12 Comments

    12 Responses to Powershell Script to create new user, enable for Exchange, UM and Lync Server

    1. Pingback: Tweets that mention Powershell Script to create new user, enable for Exchange, UM and Lync Server « Microsoft UC Made Easy -- Topsy.com

    2. Thomas Kisner

      You have got to just love Lync PS…my 2007 R2 script that did the same thing is like 10x longer than this…

      One thing, if you specify the target domain controller (-domaincontroller) for all of the cmdlets, I think you can dispense with the pauses in your script.

       
      • Randy Wintle

        Thanks man, I tried that for some, but still had delays.

        The biggest delay is post mailbox creation, and then post lync enable. Time for lync database to update was always random.

        Worth a shot either way, keeps things consistent.

         
        • Thomas Kisner

          I believe that with the new Lync data store. When I get back to my environment I’ll see if I can fiddle with it. The ones I had done before had assumed mailbox creation ahead of time (customers already had a way in place to provision users and mailboxes), just UM/OCS enabling them, so I can also see mailbox creation taking too long for PS the execute the next command clean. I’ve done a lot of stuff with PowershellASP, which just can’t tolerate pauses – so I always try to avoid them if possible.

           
          • Lucas

            alternatively you can use SefaUtil from the Lync resource kit. This will allow you to chagne call forwarding from an admin point of view.SEFAUtil (secondary extension feature activation) is a command-line tool that enables Microsoft Lync Server 2010 communications software administrators and helpdesk agents to configure delegate-ringing and call-forwarding settings on behalf of a Lync Server 2010 user. The tool also allows administrators to query the call-routing settings that are published for a particular user.

             
    3. Pingback: Powershell Script to create new user, enable for Exchange, UM and Lync Server « Microsoft UC Made Easy « JC’s Blog-O-Gibberish

    4. Pingback: Script Powershell para criação de novo usuário com Exchange/UM/Lync « Rodrigo Rodrigues .:. www.andersonpatricio.org

    5. Wes

      Awesome Randy!

      Is there a way for us to create a CSV file and pump that into this script instead of having to type in the info manually?

       
      • Randy Wintle

        Yes, if you look in the powershell script where the prompts are occuring.

        You will see it is storing variables.

        You could easily comment out the prompts and instead do an import-CSV.

        The CSV File would need to have columns with each of those variables, and the variables would have to change slightly in each cmdlet.

        I will put a task on my calendar to work on a version of this document that imports a csv file and post it here.

         
        • Wes

          Great! I actually got a Powershell MVP buddy of mine to help me get it close… The only thing I don’t have is a way to set msrtc-groupingid via powershell. Never have been able to find a way to do that. Do you know how that’s done?

           
    6. Anthony Hart

      Is there a version of this for Lync 2013 and Exchange 2013?

       
      • Randy Wintle

        I have been playing with Zohno Z-Hire. This tool seems to work pretty well. http://www.zohno.com/productsandservices.html

        I may do an updated script, but Zohno already has most functionality covered, definitely check it out.

         

    Add a Comment