Utilizing the Windows Powershell Script Folder

Hi,

I am writing a script that I would like to call from a central location. I saw that Powershell has a Script folder. How can I utilize this folder so that any user can use this script in the console? TIA

I’m unsure as to what you are referring but,
I’m guessing it is $PSScriptRoot. This refers to the folder from where you run the script.

You could go about it different ways but if you were to store the scripts in a Folder where you set NTFS-security on (and share it). It should be available to everyone (within your security parameters).

You could also include it in the powershell profile. But that gets dirty quite quickly in my opinion.

PowerShell doesn’t have a central folder where it looks for scripts.

You can do something like dot sourcing your scripts folder in your powershell profile. If your scripts are not local you will need to digitally sign them or decrease the executionpolicy from remotesigned to unrestricted(BAD)!!

http://woshub.com/how-to-sign-powershell-script-with-a-code-signing-certificate/

http://www.gsx.com/blog/bid/81096/enhance-your-powershell-experience-by-automatically-loading-scripts