locked
Need help with PowerShell script for automation! RRS feed

  • Question

  • Hi Guys! 

    I am pretty new to PowerShell, but I really want to start using it to help me automate some of my tasks.

    Basically, I want to be able to automate the creation of a new user in Active directory and Office365. So, could someone please point me in the right direction and tell me what all I need to do for this to work? 

    So far, I have created a form in PowerShell with different text Boxes to enter the users info in and the when you hit the button it closes the form and saves it as a variable... I think. So would I need to make it paste the variable into AD and then into Office365? 

    I might be going at this completely wrong or have absolutely no idea what I'm talking about! So any input or help on how to do this would be extremely appreciated!

    Thursday, December 3, 2015 9:27 PM

Answers

  • Hi,

    Thanks for the post. If you'd like to create users in AD with powershell you could use the New-ADuser Cmdlet and you can also check the Gallery for some prewritten scripts for some reference:

    https://technet.microsoft.com/en-us/library/ee617253.aspx?f=255&MSPPError=-2147217396

    https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Create-Active-7e6a3978

    And if you'd like to pass data from a text box to powershell you could check the below article for some reference:

    http://blogs.technet.com/b/heyscriptingguy/archive/2011/07/24/create-a-simple-graphical-interface-for-a-powershell-script.aspx

    Hope it helps.

    Best Regards,

    Elaine


    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 Subscriber Support, contact tnmff@microsoft.com.

    • Proposed as answer by Elaine Jing Wednesday, December 30, 2015 9:37 AM
    • Marked as answer by Elaine Jing Friday, January 1, 2016 5:38 AM
    Monday, December 7, 2015 10:03 AM
  • Hi Harris,

    if you want to work with forms, I strongly recommend using PowerShell Studio from Sapien. There is no better tool to make GUI creation more intuitive, and it allows you to focus on learning how to manipulate AD, rather than learning both sides in parallel.

    Then here is a guide I wrote on how to write your very first script, which might just help a bit.

    Finally, I have found this blog to be quite helpful when trying to figure out how to do specific tasks in AD, back in the days when I learned the dratted thing. Unfortunately, it's pretty dead by now, but the old content is still there and it really focuses on how to do a single step. That said, it's in German, so you may need to stomach machine-translation if that language is not on your list of skills (I've heard it's supposed to be a terrible torture to learn it, as a native speaker I can't really comment much on that though).

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Proposed as answer by Elaine Jing Wednesday, December 30, 2015 9:37 AM
    • Marked as answer by Elaine Jing Friday, January 1, 2016 5:38 AM
    Monday, December 7, 2015 10:44 AM
  • here's one that someone already created

    https://gallery.technet.microsoft.com/scriptcenter/New-User-Creation-tool-14fa73cd

    • Proposed as answer by Elaine Jing Wednesday, December 30, 2015 9:37 AM
    • Marked as answer by Elaine Jing Friday, January 1, 2016 5:38 AM
    Sunday, December 13, 2015 9:25 PM

All replies