Freigeben über


Powershell Tip #1

In Powershell, type $profile.

PS C:\Program Files\Microsoft\AxFuzzer> $profile
C:\Users\mengli\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 

That points to where your profile is stored at.  This is a powershell script that executes upon the start up of any powershell prompt for the current user.  Go ahead and make the file.  In my case, I made a new file at the location by typing this:

new-item $profile -itemtype file -force

Now, open the file and you can put in things like this:
set-executionpolicy unrestricted
. \\meng\shared\powershell\hyperv.ps1
set-executionpolicy remotesigned

Every new powershell prompt that you excute will now have executed the hyperv.ps1 file.  I've placed mine on a network so I can always load the latest copy on all my computers.