Creates a Config file with Variables, PSDrives, Credentials, Shortcuts(Functions), PSDefaultParameters and a Starting location. You can then execute this config when your profile is loaded, or you can run it manually at any time. And all of the variables, psdrives credentials ext. are then available in your session. This way you can quickly and easily switch between "environment setups"
- Install from PowerShell Gallery PS Gallery
Install-Module -Name PSConfigFile -Verbose
- or run this script to install from GitHub GitHub Repo
$CurrentLocation = Get-Item .
$ModuleDestination = (Join-Path (Get-Item (Join-Path (Get-Item $profile).Directory 'Modules')).FullName -ChildPath PSConfigFile)
git clone --depth 1 https://github.com/smitpi/PSConfigFile $ModuleDestination 2>&1 | Write-Host -ForegroundColor Yellow
Set-Location $ModuleDestination
git filter-branch --prune-empty --subdirectory-filter Output HEAD 2>&1 | Write-Host -ForegroundColor Yellow
Set-Location $CurrentLocation
- Then import the module into your session
Import-Module PSConfigFile -Verbose -Force
- or run these commands for more help and details.
Get-Command -Module PSConfigFile
Get-Help about_PSConfigFile
Documentation can be found at: Github_Pages
Add-CommandToPSConfigFile
-- Adds a command or script block to the config file, to be executed every time the invoke function is called.Add-CredentialToPSConfigFile
-- Creates a self signed cert, then uses it to securely save a credential to the config file.Add-FunctionToPSConfigFile
-- Creates Shortcuts (Functions) to commands or script blocksAdd-LocationToPSConfigFile
-- Adds default location to the config file.Add-PSDefaultParameterToPSConfigFile
-- Add PSDefaultParameterValues to the config fileAdd-PSDriveToPSConfigFile
-- Add PSDrive to the config file.Add-VariableToPSConfigFile
-- Adds variable to the config file.Export-PSConfigFilePFX
-- Export the PFX file for credentials.Import-PSConfigFilePFX
-- Import the PFX file for credentialsInvoke-PSConfigFile
-- Executes the config from the json file.New-PSConfigFile
-- Creates a new config fileRemove-ConfigFromPSConfigFile
-- Removes a item from the config file.Set-PSConfigFileExecution
-- Adds functionality to add the execution to your profile.Show-PSConfigFile
-- Display what's configured in the config file.Update-CredentialsInPSConfigFile
-- Allows you to renew the certificate or saved passwords.