none
Very confused by all of this RRS feed

  • General discussion

  • I am new at Powershell scripting. I have successfully ran some things but am always confused by what is inside of the scripts we download from here. What and where are exactly what you need to run? It seems like there are tons of documentation in the zip file, and it clutters everythign up for new users. IF I am looking to get a list of all AD users with all properties, what exactly do I enter? When I open the script it is huge so it is overwhelming and confusing. It wodl be much easier if it said enter 

    "GETAD bla blah blah" then show where I would need to make edits. How can this be taught to those who are brand new? I am trying hard, man but it seems like people on here go way out of their way to make this seem more complicated than it is, like when an IT guy tries to explain to a Maintenance tech how to clear his cache, but by using big words that only IT pros really "get". I want to learn but how!

    I was under the impression that when I download a script, what was inside was what I needed to put in Powershell and simply change the output path, doesn't look that way when there are 15 paragraphs worth of stuff!

    Tuesday, February 21, 2017 8:08 PM

All replies

  • Don't forget to ask your question. The more specific the question, the better we can help.


    -- Bill Stewart [Bill_Stewart]


    Tuesday, February 21, 2017 8:39 PM
    Moderator
  • How do you eat an elephant? err, one mouthful at a time!

    Get-Module -ListAvailable

    Lists modules available, to see the commands in those modules, pick one you like the look of;

    Get-Command -Module Defender

    The Get-Help is good, first perhaps;

    Update-Help -Verbose

    Then;

    Get-Help Get-MpComputerStatus -Online

    Also search for basics not the complete scripts, start with you own basic scripts and search any individual issues to learn.

    Tuesday, February 21, 2017 8:49 PM
  • You start by getting a book or by doing a tutorial.

    See: https://technet.microsoft.com/en-us/dd742419

    One day with the tutorials and examples and you will become un-confused.

    I, also, recommend learning how to use help as a first step.


    \_(ツ)_/


    • Edited by jrv Tuesday, February 21, 2017 9:57 PM
    Tuesday, February 21, 2017 9:57 PM
  • I understand some of the confusion with downloaded scripts, however most the time the extra content is to make the script more versatile along with appropriate error checking. I think the difference is between using Powershell as a command line utility and using a Powershell script.

    First learn how to learn with Powershell , use get-help command for things you semi-know and use get-command for things you don't know at all. 

    ex.

    get-help get-AdComputer (This will get you a help file)

    Get-Command -Verb get -noun *ad* (This will give you a list of commands that "get" information, with any command with AD in the noun portion. )

    Second learn how to script. 

    I suggest getting a book by Don Jones , who happens to be one of the best. (Powershell in a month of Lunches is what my company gives to new techs.)


    Tuesday, February 21, 2017 10:17 PM
  • It's going to be a real crap-shoot when you download a script from the Gallery since those are all written by different people with different coding styles.  Some scripts, just download and double click them.  Other scripts, you'll have to change some variables in the code before running.    

    When I was first starting off, I found the -examples flag to be the best thing ever added to a HELP command.  Often enough, the simple thing you want to do is one of the examples MS provides right in the help file.   Just as a quick example, if you run get-help get-aduser -examples, you'll see an example of how to get all users under an OU, how to get all users with a certain naming scheme, and how to get all properties for a specific user.   

    Once you learn the basic noun/verb way that Powershell works, you can pick apart those examples, swap bits around, and you'll have your own scripts started.  Powershell is extremely user friendly for how powerful it is. Once you're over that initial hump, you'll be fine.   If you're looking for learning material, I've never used it myself, but I've heard a ton of good stuff about Powershell in a Month of Lunches.  

    Monday, February 27, 2017 4:19 PM