locked
Learning Posh RRS feed

  • Question

  • Learning Posh

    • Edited by Maelito Tuesday, October 9, 2018 6:30 PM Learning Posh
    • Moved by Bill_Stewart Tuesday, December 18, 2018 12:24 AM User removed question
    Tuesday, October 9, 2018 4:20 PM

All replies

  • I highly recommend learning basic PowerShell be fore continuing.  You cannot guess at how to use it.  You are adding unnecessary items without understanding what they do.  Your habit of creating arrays that are never used shows this.  You also do not understand what loops are or how they work.  You cannot just use a pipeline object ($_) anywhere without a pipeline.  I suspect much of this code is because you have just copied code you have seen with no understanding of how the code works.  This is a very bad habit and will keep you confused about PowerShell.

    Get-ADGroupMember TESTGRoup | 
        where{$_.objectClass -eq 'User'} |
        Get-AdUser |
        ForEach-Object{
            Set-MsolUser -UserPrincipalName $_.UserPrincipalName -Blockcredential $true
        }

    Study the above example until you understand how it works and WHY I have written it this way.

    1. Learn PowerShell  
    2. PowerShell Documentation
    3. PowerShell Style Guidelines


    \_(ツ)_/



    • Edited by jrv Tuesday, October 9, 2018 4:36 PM
    Tuesday, October 9, 2018 4:34 PM
  • Learning is a choice and directed activity.  WIth technical systems we need to make time and do the homework up front.

    You have been trying to learn PowerShell by guessing for over two years now. You still have not learned the most basic things about PowerShell. Take the time to seriously do the tutorial posted. It will change your whole understanding of PowerSHell and save you 100 times the time spent doing the tutorial.

    I am only posting this because it pains me to see someone take two years to go in a circle when most who take a tutorial or a book on PowerShell learn the basics in couple of weeks.

    The choice is yours.  If you like the confusion and time wasted then keep doing it your own way.


    \_(ツ)_/

    Tuesday, October 9, 2018 5:41 PM