DOS old timers may remember AutoExec.bat and Config.sys. More modern Microsoft operating systems need boot.ini; all these files control the startup environment. Well the purpose of this page
is to configure the equivalent PowerShell file: profile.ps1.
Profile.ps1 location The key to getting started is to make sure that profile.ps1 is in the correct path.
C:\Documents and Settings\All
Users\Documents\PSConfiguration\profiles.ps1 alternatively C:\Documents and Settings\%username%\Documents\PSConfiguration\profiles.ps1
Registry Setting for Scripts e.g. Profile.ps1 HKLM\Software\Microsoft\PSConfiguration\1\ShellIds \Microsoft.Management.Automation.ps1
The principle behind profile.ps1 and other cmdlets with a msh extension is to save keystrokes into a file for reuse later. Once you have absorbed the concept then you can truly customize your
profile.ps1, merely look at examples for ideas and then adapt the most promising to set your PowerShell environment.
Working Directory. My first task was to change the working directory from My
Documents..\..\. to D:\ scripts. I typed set-location d:\ scripts in the Microsoft Shell
- it worked. Then I put the very same commands in profile.ps1. At first PowerShell did not executed
this instruction when it launched, this was because profile.ps1 was in the wrong folder.
Aliases If you want to create Aliases that last for more than one session, then add them to your
profile.ps1. Experiment at the PowerShell command prompt with set-alias aliasname verb-noun pair. When your alias works perfectly save the command into profile.ps1.
set-alias xcopy
Guy Recommends: SolarWinds LANSurveyor
LANSurveyor will produce a neat diagram of your network topology. But that's
just the start;
LANSurveyor can
create an inventory of the hardware and software
of your machines and network devices. Other neat features include dynamic
update for when you add new devices to your network. I also love the ability to export
the diagrams
to Microsoft Visio.
Finally, Guy bets that if you take a free trial of LANSurveyor then you will
find a device on your network that you had forgotten about, or someone else
installed without you realizing!
In PowerShell RC1, profiles.ps1 does not appear in the correct folder. After you hack the registry key called ExecutionPolicy, then you can create the msh folder in the All Users\documents. Finally, you can
add instructions to the profiles.ps1 file.
If you see an error of any kind, do let me know. Please report any factual mistakes, grammatical errors or broken links, I will be happy to not only to correct the fault, but also to give you credit.
*
Guy
Recommends: Orion's NPM - Network Performance Monitor
Orion's performance monitor is designed for detecting network outages.
A network-centric
view make it easy to see what's working, and what needs your attention.
This utility guides you through troubleshooting by indicating whether the
root cause is faulty equipment or resource overload.