Welcome to Sign in | Join | Help
in
Home Blog Forums

The Lazy Admin

MSH Profiles

Sponsor


MSH is highly customizable through the use of profiles. MSH profiles are not created by default, however, you can create them easily enough and customize your MSH enviroment.

To create a MSH profile, simply open up a text editor, enter in the variables you wish to include in your customization and save the file as My Documents\MSH\profile.msh. The profile can contain any combination of MSH cmdlets and is useful for setting aliases, buffersize and providing general information when you start MSH.

 

The next time you start MSH, the profile will be loaded and your customizations will be available.

If you are like me, you will probably end up with a massive, complex profile. To manage this better, you can seperate the sections into seperate files, like aliases.msh, functions.msh, personal.msh etc... These multiple aliases can then be loaded into the master profile (profile.msh) with the following commands.

  • . $MyDocuments\msh\aliases_profile.msh
  • . $MyDocuments\msh\functions_profile.msh
  • . $MyDocuments\msh\personal_profile.msh

You can also add customizations with the following.

$command = cmdlet variable $processor = get-wmiobject win32_processor

Lastly, you maybe prompted with an error when the profile loads. By default, MSH is locked down with a Restricted policy which does not allow scripts to be run. In order for scripts to run, you need to enable one of three policies. - AllSigned requires digital signatures on all scripts and configuration files - RemoteSigned requires digital signatures on all scripts and configuration files from remote sources (i.e. WWW, E-Mail etc) - Unrestricted allows all scripts ad configuration files to be run Personally, I change my scripts and config files way to often to sign them so I run with the RemoteSigned policy. Depending on your security requirements you may wish to run a different policy. Once you decide on a policy it can be enabled with a registry change. Open up the registry for editing and drill down to:

SOFTWARE\Microsoft\Msh\1\ShellIds\Microsoft.Management.Automation.msh

Change the value of the ExecutionPolicy to the name of the policy you wish to use. The names are listed above. You can also enable the policy from MSH with the following command.

set-property `HKLM:\SOFTWARE\Microsoft\Msh\1\ShellIds\Microsoft.Management.Automation.msh -property ExecutionPolicy -value [POLICYNAME]

For more information see:

MSDN - Introduction to Code Signing





Published Friday, August 25, 2006 6:36 AM by rodney.buike
Filed under:

Comments

No Comments
Anonymous comments are disabled


All postings are provided "AS IS" with no warranties, and confer no rights.
Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.