[MSH] remove-item alias:ac

Discussion in 'Scripting' started by Mark Ayers, Apr 15, 2006.

  1. Mark Ayers

    Mark Ayers Guest

    remove-item alias:ac
    remove-item : Alias was not removed because alias ac is constant and cannot
    be removed.

    Why shouldn't I be able to remove an alias? It isn't an alias if I can't
    remove it or redefine it. At least that is my view.

    Am I missing something? Is there a way to remove these aliases?
    Mark Ayers, Apr 15, 2006
    1. Advertisements

  2. remove-item alias:ac -force

    gr /\/\o\/\/
    /\\/\\o\\/\\/, Apr 15, 2006
    1. Advertisements

  3. Mark Ayers

    dreeschkind Guest

    The reason is that sharing msh scripts is easier if the aliases of the core
    cmdlets are the same on every profile.

    To see which aliases are readonly type:

    get-alias | select name, definition, options | ft -a
    dreeschkind, Apr 15, 2006
  4. Mark Ayers

    Mark Ayers Guest

    Shouldn't best practice for scripts be full command name?

    Mark Ayers, Apr 15, 2006
  5. Mark Ayers

    Mark Ayers Guest

    Mark Ayers, Apr 15, 2006
  6. Yes. The thinking behind this I believe goes beyond the script-sharing.
    Here's my explanation for the read-only ones - and it goes BEYOND the
    concept of script-sharing; it's really about providing a terse common
    interactive "pidgin MSH" that everyone can use.

    The read-only aliases are "special" in that they are what I refer to as
    "canonical" aliases. They are built not from historic analogs in other
    command shells, but from the standard abbreviations for verbs and nouns that
    the MSH team has been using. The reason why the are treated as special is
    that they give us a brief set of building blocks that allow advanced MSH
    users to automatically understand terse aliases _without ever having
    encountered a command before_.
    For example, stop- is sp, start- is sa, get- is g, -process is ps, -service
    is sv. With the 3 verb and 2 noun abbreviations "known", people should be
    able to automatically understand that
    spsv is stop-service
    sasv is start-service
    gsv is get-service
    spps is stop-process
    saps is start-process
    gps is get-process
    You can see the impact if you think about there being about 20 common verbs
    and maybe 20 common nouns. Eventually, you just "get" the pattern, and you
    can sight-read or even write 400 theoretically possible cmdlet aliases.

    For example, suppose someone eventually builds an email provider of some
    kind that lets you retrieve a current email account, create new messages,
    etcetera. Suppose the noun used for this is EmailMessage, and that the
    abbreviation for the noun is eml. Then you can automatically understand the
    following cmdlet aliases:
    Alex K. Angelopoulos [MVP], Apr 15, 2006
  7. Jeffrey Snover [MSFT], Apr 15, 2006

  8. One of the points that doesn't get addressed in that blog entry - due to the
    title <g> - is that those aliases can be critically useful in "improv" MSH.

    Being a terse interactive shell, a lot of MSH use is more brief than even
    script: current-scope, interactive 1-line use. The common aliases let people
    talk about MSH quickly, almost conversationally, to communicate concepts
    even where actual _use_ may be more verbose.
    Alex K. Angelopoulos [MVP], Apr 16, 2006
  9. Absolutely.
    Jeffrey Snover [MSFT], Apr 16, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.