If you want to execute a lot of custom scripts/functions when PowerShell starts up, you can either put them all in your startup profile, or use the method below.
Assuming you have a startup profile named Microsoft.PowerShell_Profile.ps1 in:
%UserProfile%\\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile
Create a subdirectory called something like Includes and place all your custom script files in this directory. Finally add the following code into the startup profile:
foreach ($f in get-childitem $(join-path $(split-path $profile -Parent) "Includes"))
{
. $f.fullname
}
Now, each time PowerShell is started, it will automatically execute all your customer shell scripts/functions.
Just some random development ramblings mostly related to the Microsoft .NET platform.
Subscribe to:
Post Comments (Atom)
Can't RDP? How to enable / disable virtual machine firewall for Azure VM
Oh no! I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore. I did ...
-
Oh no! I accidentally blocked the RDP port on an Azure virtual machine which resulted in not being able to log into the VM anymore. I did ...
-
Here is a full test program that demonstrates how to use SharpZipLib to zip an XElement into a byte array. This allows you to transfer larg...
No comments:
Post a Comment