Starting Up PowerShell
Once you complete the steps above, PowerShell is available on your system. You can run PowerShell by clicking on Start, then clicking on Run, entering PowerShell into the Open text box, and hitting OK or return. Up should come the default PowerShell screen.
When PowerShell starts up, it attempts to load and then execute four separate script files:
%ALLUSERSPROFILEe%\Documents\PSConfiguration\Profile.ps1
%ALLUSERSPROFILEe%\Documents\PSConfiguration\Microsoft.Powershell_Profile.ps1
%USERPROFILE%\My Documents\PSConfiguration\Profile.ps1
%USERPROFILE%\My Documents\PSConfiguration\Microsoft.Powershell_Profile.ps1
Each of these files is a PowerShell script file as described shortly. Having four profile files may seem excessive, but there is a good reason behind this approach. With PowerShell, you can use the product as installed but you can also create your own shells with private additional cmdlets (explained in the next section). An example of a custom shell is the Exchange 2007 Management shell.
The two profile.ps1 files are run by every PowerShell shell that would include the Exchange Management Shell. The two Microsoft.Powershell_Profile.ps1 files, however are only executed by PowerShell.exe. Likewise, you have both personal startup scripts and global startup scripts.
This gives you considerable flexibility in how you deploy PowerShell. Your enterprise functions, filters, and aliases could live in the All Users Profile.ps1. These are then available to all shells for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access