none
PS - Questions Regarding Complex Script RRS feed

All replies

  • 1 - extract container from User DistinguishedName
    2 - This line does nothing.
    3 - No - it just adds the value if it is not null

    Also "Format-Table" only works in a pipeline or if it is given on object.  As written it does nothing.

    I recommend that you start by actually learning PowerShell.  You will never be able to guess your way to proficiency.


    \_(ツ)_/

    Tuesday, May 9, 2017 5:09 PM
  • Thanks for your reply. Learning powershell is exactly what I'm doing and it's people like you that help me understand it a little more so thanks again. 
    Tuesday, May 9, 2017 5:14 PM
  • You need to start with a training course or a book.  Most of your mistakes are because you don't know the basics.  You won't learn the basics by copying or asking questions.  You have to become a student.

    \_(ツ)_/

    Tuesday, May 9, 2017 5:25 PM
  • ...

    Thursday, May 11, 2017 3:44 PM
  • Please start by reading the following post:

    This forum is for scripting questions rather than script requests

    Asking for incremental changes to a script in a forum is not an effective way to learn a programming language. The process will be too slow and frustrating for both parties.


    -- Bill Stewart [Bill_Stewart]

    Thursday, May 11, 2017 3:56 PM
  • First you have $surename, then later you use $surname.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, May 11, 2017 3:59 PM
  • THis is how to create a user:

    $params = @{
    Instance = $template SamAccountName = $samaccountname UserPrincipalName = $samaccountname + 'domian.com' Name = "$givenname $surename" Displayname = "$givenname $surename" Givenname = $givenname Surname = $surname EmailAddress = $samaccountname + 'domian.com' AccountPassword = ConvertTo-SecureString $password -AsPlainText -force Enabled = $enabled
    Path = if($ou){$ou}else{'ou=default ...'} }

    Please take the time to learn PowerShell and AD.  We cannot keep answering incremental questions.

    There isi no point inn making this a function.  New-AdUser is already a function.  You have to start by learning how to design a program and answer the question of where you are going to get your data.   Blindly copying things you have found will only lead you down a rabbit hole.


    \_(ツ)_/





    • Edited by jrv Thursday, May 11, 2017 4:10 PM
    Thursday, May 11, 2017 4:04 PM