Guild of Microsoft a basic Question regarding Powershell

ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
Howdy Guys.

I am looking at some Powershell stuff, I have been watching CBT nuggets videos by Don Jones. Figured I would attempt to build a solid foundation before I tackle some scripting. I primarily run Linux so making the transition has been a bit eventful shall we say. Dear guild of Microsoft I propose the following.

I am struggling to understand and get to grips with syntax, This has always been a weakness for me including Linux so I figured you guys could break things down and cement concepts so that I can take notes and keep a reference.

So here we go:

If I run the following: get-help get-eventlog | more

I am struggling to understand syntax and order of operation what the brackets mean etc. like what does [] <> [[] mean? I kinda understand some parts. However I could really do with some guidance in cementing these concepts.

Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType
<String[]> {Error | Information | FailureAudit | SuccessAudit | Warning}] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-User
<String[]>] [<CommonParameters>]


Go easy on me guys I need to be spoon fed break it down in a really noob friendly way :)


As always I appreciate all the guidance from this wonderful forum.
Microsoft's strategy to conquer the I.T industry

" Embrace, evolve, extinguish "

Comments

  • 636-555-3226636-555-3226 Member Posts: 975 ■■■■■□□□□□
  • blargoeblargoe Member Posts: 4,174 ■■■■■■■■■□
    ally_uk wrote: »
    Howdy Guys.

    I am looking at some Powershell stuff, I have been watching CBT nuggets videos by Don Jones. Figured I would attempt to build a solid foundation before I tackle some scripting. I primarily run Linux so making the transition has been a bit eventful shall we say. Dear guild of Microsoft I propose the following.

    I am struggling to understand and get to grips with syntax, This has always been a weakness for me including Linux so I figured you guys could break things down and cement concepts so that I can take notes and keep a reference.

    So here we go:

    If I run the following: get-help get-eventlog | more

    I am struggling to understand syntax and order of operation what the brackets mean etc. like what does [] <> [[] mean? I kinda understand some parts. However I could really do with some guidance in cementing these concepts.

    Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType
    <String[]> {Error | Information | FailureAudit | SuccessAudit | Warning}] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-User
    <String[]>] [<CommonParameters>]


    Go easy on me guys I need to be spoon fed break it down in a really noob friendly way :)


    As always I appreciate all the guidance from this wonderful forum.

    From your above example:

    [[-InstanceId] <Int64[]>] indicates that the -InstanceId parameter is optional. The parameter is type Int64, the [] means that it accepts multiple Int64 values.

    For Instance, get-eventlog application -InstanceId 1,2
    IT guy since 12/00

    Recent: 11/2019 - RHCSA (RHEL 7); 2/2019 - Updated VCP to 6.5 (just a few days before VMware discontinued the re-cert policy...)
    Working on: RHCE/Ansible
    Future: Probably continued Red Hat Immersion, Possibly VCAP Design, or maybe a completely different path. Depends on job demands...
Sign In or Register to comment.