Advanced PowerShell

Advanced PowerShell

  • Comments 6

At ITForum, I had a blast giving the session: Advanced Windows PowerShell Scripting.  In previous conferences, I tried to have talks that everyone could come to and get something out of.  That worked well a the beginning but I began to get feedback that beginners didn't like it when we went deep and advanced users didn't like it if we didn't.  In this conference, I decided to have a session dedicated to people that know PowerShell well and want to go deep. 

I was so concerned about beginners in the session getting frustrated that I warned people about a dozen times (way overboard!).

This session drills into:

    • Forms and styles of scripting
    • Scriptblocks
    • Switch
    • V2 Script Cmdlets
    • V2 PSJobs

That session is now available online at the link above.  Attached is a ZIP file containing all the files I used in the Demos.

Enjoy!

Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Attachment: ITForum-DemoFilesForAllTalks.zip
Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post
  • I really don't like the $_ notation for getting the pipeline object. It's too difficult to type $_.name $_.this() $_.that(). Better for it to have been $$ as it is easier to type. Finding the dolar sign then the shift+dash then dot is not the faster use of my fingers. It may sound funny but seriously why not $$. It is more natural. Where did you get this underdash thing? The problem is that $_ is used everywhere, especially in where clauses. If it was not for that then it wouldn't have matter. Tell me, do you find it natural to have to type where {$_.name -eq "this"}? It would have prefered where name = this. Without the {} and the -eq and especially without the $_. part.

    Why didn't you use the ordinary =<> etc operators and you used these unatural -eq -lt -etc? I know that some users may have prefered <> to be used for inderection but that is because people need to adapt to a different style with Powershell. For them now everyone has to suffer with the unatural -eq -lt -etc. Moreover, why didn't you suse $$ for the pipeline object? Seems so natural to me. And finally, why don't you infer the {} in a where command if they are ommited. For example allow someone to write "where $_.name -eq "this"" and have the default scriptblock parameter be infered as if there were {} surrounding it. Where doesn't have any other positional parameters I think and thus it should be easy to infer that everything should be the default parameter of a scriptblock. I know the -eq might confuse the parser but its your problem in a sense; youallowed these strange operator syntax. And why do I need "" aroung the string. It's it obvious that after the $_.name -eq a string should follow?

  • I'm sorry that you don't like it, at the end of the day, you can't please everyone with a syntax.  A number of the choices that we made that you dislike came from our decision to mirror much of the existing bodies of work.

    $$ is a very standard Unix Shell construct.

    $_ is used extensively in PERL.

    We tried to invent as few new constructs as possible to facilitate adoption of the technologhy.  

    The choice of -lt vs < and -gt vs > comes from the fact that < and > are standard shell redirection operators.  In the early days we tried to provide alternatives for these so that we could use < to mean -lt but the feedback from the community was INCREDIBLY STRONG on this point.  

    I think you'll have the same reaction to PS syntax as I did to VMS DCL syntax when I learned it.  I spent the first few days pissed off that it wasn't what I was used to.  After I let go of my anger and took it for what it was, I found that I could easily adapt and actually liked it.  If that isn't your case - I hope the tools you are using solve the problems you have.

    Cheers!

    Jeffrey Snover [MSFT]

    Windows Management Partner Architect

    Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell

    Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

  • Jeffrey,

    Clicking on Download / Video lead to:

    http://www.microsoft.com/emea/spotlight/download.aspx?videoid=725

    On clicking the video icon again at:

    http://microsofttech.fr.edgesuite.net/msexp/download/spotlight/725/725_high.zip

    It failed with the error below even though I have already logged in with my MS Live account.

    Please help as there is limited broadband access especially these few days in the gulf region (after a series of underwater fibre cable damages).

    Thanks!

    --- cut here ---

     The website declined to show this webpage

    HTTP 403  

      Most likely causes:

    This website requires you to log in.

      What you can try:

        Go back to the previous page.

        More information

    This error (HTTP 403 Forbidden) means that Internet Explorer was able to connect to the website, but it does not have permission to view the webpage.

    For more information about HTTP errors, see Help.

  • I went to this session - it was one of the best session of the week!!

  • Please suggest some online materials for Powershell...

    Thanks

  • The link no longer works. Is the video available elsewhere?

Page 1 of 1 (6 items)