MSH: Where to put the profile.msh

Discussion in 'Scripting' started by Thorsten Tarrach, Sep 9, 2005.

  1. Hallo,

    i'd like to change the prompt permanently. Therefore I want to add
    Function Prompt { "$(get-location)> " }
    to my profile.msh.
    But the only file I can find with that name is in the C:\Dokuments und
    Settings\All Users\Dokuments folder.
    But adding the above line to this file has no effect.

    What am I doing wrong?

    Thanks, Thorsten
    Thorsten Tarrach, Sep 9, 2005
    1. Advertisements

  2. The profile.msh must be in an MSH subdirectory of your Documents folder.

    For example, mine is at "C:\Documents and Settings\jeffjon\My
    Jeff Jones [MSFT], Sep 9, 2005
    1. Advertisements

  3. Thanks, that works.

    Thorsten Tarrach, Sep 9, 2005
  4. Changing the All Users profile will work as well as long as you have write
    privlidges to the directory.

    Are you editing C:\Dokuments und Settings\All

    Leonard Chung [MSFT], Sep 9, 2005
  5. Thorsten Tarrach

    Thomas Lee Guest


    But one small point - you might want to consider breaking your scripts
    out in to separate script file - and call that script file from

    Thomas Lee, Sep 10, 2005
  6. Thorsten Tarrach

    Thomas Lee Guest

    Nope - looks like a bug.



    Thomas Lee, Sep 15, 2005
  7. Thorsten Tarrach

    Thomas Lee Guest

    Let me rephrase this - it's a feature.

    In the latest drop, this is the file name you should be using. Speaking
    to Jim today, he explained that - in the future - there could be lots of
    profiles. For example, the E12 gui effectively runs MSH under the covers
    - it will want it's own profile.msh.

    Thomas Lee, Sep 16, 2005
  8. This is actually a feature that's been available for some time -- a
    progressive loading of profiles.

    Our load sequence is (as you can verify with filemon.exe)
    - "All Users Documents"\msh\profile.msh
    - "All Users Documents"\msh\<host>_profile.msh
    - "My Documents"\msh\profile.msh
    - "My Documents"\msh\<host>_profile.msh

    profile.msh is run for all hosts, whereas <host>_profile.msh runs only
    for the host you're running.

    So technically, when you modify your profile, you're customizing the way
    in which you want our host, msh.exe, to run. The full host name of
    msh.exe is "Microsoft.Management.Automation.msh," so we're installing
    the profile to the most specific place.

    If you're not playing around multiple hosts, go ahead and rename it to

    Lee Holmes [MSFT], Oct 2, 2005
  9. Thorsten Tarrach

    Thomas Lee Guest

    Cool stuff - thanks for the explanation.

    It's more complex than I imagined, but it does provide for considerable

    NB - in your sample load order, you used the token "<host>". I know what
    you mean and I know that you know what you mean but I think the proper
    term should be "shellid". This is because the variable $shellid, created
    at load time, holds the name of this profile.

    Thomas Lee, Oct 2, 2005
  10. Thanks for pointing that out.

    Regarding the very long profile name, I should also point out that it's
    not something that we expect users to memorize. The shell has a default
    variable, $profile, that points to this file. This way, you don't need
    to remember it at all.

    Lee Holmes [MSFT], Oct 5, 2005
  11. Thorsten Tarrach

    Thomas Lee Guest

    At first sight this was weird, but after Jim explained the reasoning (at
    least I'm blaming him), it makes a lot of sense.

    Looking forward, I can see the value in creating quite specialised,
    domain specific, shells. The approach taken allows for different start
    up scripts for each shell, which makes a lot of sense.

    As Lee says "Edit $Profile" works.

    The "User Guide" and Help text need to factor this in.

    Thomas Lee, Oct 5, 2005
    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.