From 7559e7f0092bcc7fae58ae3599bca58d03650b4d Mon Sep 17 00:00:00 2001 From: Sam Erde Date: Mon, 21 Oct 2024 16:54:43 -0400 Subject: [PATCH] Update help with external --- docs/Edit-PSReadLineHistoryFile.md | 2 +- docs/Edit-WingetSettingsFile.md | 2 +- docs/Get-EnvironmentVariable.md | 2 +- docs/Get-LoadedAssembly.md | 2 +- docs/Get-PowerShellPortable.md | 2 +- docs/Get-TypeAccelerator.md | 2 +- docs/Initialize-PSEnvironmentConfiguration.md | 2 +- docs/Install-CommandNotFoundUtility.md | 2 +- docs/Install-OhMyPosh.md | 2 +- docs/Install-PowerShellISE.md | 2 +- docs/Install-WinGet.md | 2 +- docs/New-Credential.md | 2 +- docs/New-ScriptFromTemplate.md | 2 +- docs/Out-JsonFile.md | 2 +- docs/PSPreworkout.md | 4 +- docs/Set-ConsoleFont.md | 2 +- docs/Set-EnvironmentVariable.md | 2 +- docs/Show-LoadedAssembly.md | 2 +- docs/Show-WithoutEmptyProperty.md | 2 +- docs/Test-IsElevated.md | 2 +- docs/Update-AllTheThings.md | 2 +- src/Artifacts/PSPreworkout.psd1 | 26 +- .../Help/en-US/PSPreworkout-help.xml | 2077 +++++++++++++++++ ...e-a0df-4d44-873b-4fd32c388e06_HelpInfo.xml | 10 + src/PSPreworkout/PSPreworkout.psd1 | 26 +- 25 files changed, 2135 insertions(+), 48 deletions(-) create mode 100644 src/PSPreworkout/Help/en-US/PSPreworkout-help.xml create mode 100644 src/PSPreworkout/Help/en-US/PSPreworkout_378339de-a0df-4d44-873b-4fd32c388e06_HelpInfo.xml diff --git a/docs/Edit-PSReadLineHistoryFile.md b/docs/Edit-PSReadLineHistoryFile.md index 194fd43..cabbdcf 100644 --- a/docs/Edit-PSReadLineHistoryFile.md +++ b/docs/Edit-PSReadLineHistoryFile.md @@ -45,4 +45,4 @@ Modified: 2024-10-10 Idea: History search with a TUI? This may already be done by the PowerShell Run module. -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Edit-WingetSettingsFile.md b/docs/Edit-WingetSettingsFile.md index 46fda40..ab6681d 100644 --- a/docs/Edit-WingetSettingsFile.md +++ b/docs/Edit-WingetSettingsFile.md @@ -57,4 +57,4 @@ Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Get-EnvironmentVariable.md b/docs/Get-EnvironmentVariable.md index 727ea4f..14714d3 100644 --- a/docs/Get-EnvironmentVariable.md +++ b/docs/Get-EnvironmentVariable.md @@ -109,4 +109,4 @@ The relevant sources for the User and Machine targets are in the registry at: See more at \. -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Get-LoadedAssembly.md b/docs/Get-LoadedAssembly.md index 67366ec..b488e08 100644 --- a/docs/Get-LoadedAssembly.md +++ b/docs/Get-LoadedAssembly.md @@ -46,4 +46,4 @@ Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Get-PowerShellPortable.md b/docs/Get-PowerShellPortable.md index da92ab2..ec6305f 100644 --- a/docs/Get-PowerShellPortable.md +++ b/docs/Get-PowerShellPortable.md @@ -75,4 +75,4 @@ Author: Sam Erde Version: 0.1.0 Modified: 2024/10/12 -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Get-TypeAccelerator.md b/docs/Get-TypeAccelerator.md index 9a1dc3a..fcfa244 100644 --- a/docs/Get-TypeAccelerator.md +++ b/docs/Get-TypeAccelerator.md @@ -75,4 +75,4 @@ Modified: 2024/10/12 Thanks to Jeff Hicks (@JDHITSolutions) for helpful suggestions and improvements on this output! -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Initialize-PSEnvironmentConfiguration.md b/docs/Initialize-PSEnvironmentConfiguration.md index b84f956..cc9d377 100644 --- a/docs/Initialize-PSEnvironmentConfiguration.md +++ b/docs/Initialize-PSEnvironmentConfiguration.md @@ -172,4 +172,4 @@ To Do Create interactive picker for packages and modules (separate functions) Bootstrap Out-GridView or Out-ConsoleGridView -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Install-CommandNotFoundUtility.md b/docs/Install-CommandNotFoundUtility.md index 68c9f01..10938de 100644 --- a/docs/Install-CommandNotFoundUtility.md +++ b/docs/Install-CommandNotFoundUtility.md @@ -44,4 +44,4 @@ Modified: 2024-10-14 May not work with PowerShell installed from MSIX or the Microsoft Store: \ -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Install-OhMyPosh.md b/docs/Install-OhMyPosh.md index 878ace3..8e1bc41 100644 --- a/docs/Install-OhMyPosh.md +++ b/docs/Install-OhMyPosh.md @@ -110,4 +110,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Install-PowerShellISE.md b/docs/Install-PowerShellISE.md index bf2f7d5..1ed2c6e 100644 --- a/docs/Install-PowerShellISE.md +++ b/docs/Install-PowerShellISE.md @@ -48,4 +48,4 @@ To Do: - Add parameter to make the Windows Update registry change optional - Requires admin but adding that breaks the build -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Install-WinGet.md b/docs/Install-WinGet.md index bdc72c3..3557a52 100644 --- a/docs/Install-WinGet.md +++ b/docs/Install-WinGet.md @@ -95,4 +95,4 @@ To Do: - Error handling - Create the target folder if it does not already exist -## RELATED LINKS +## RELATED LINKS diff --git a/docs/New-Credential.md b/docs/New-Credential.md index c5eaf7d..776064c 100644 --- a/docs/New-Credential.md +++ b/docs/New-Credential.md @@ -38,4 +38,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/New-ScriptFromTemplate.md b/docs/New-ScriptFromTemplate.md index 8237e39..4b2b4f1 100644 --- a/docs/New-ScriptFromTemplate.md +++ b/docs/New-ScriptFromTemplate.md @@ -193,4 +193,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Out-JsonFile.md b/docs/Out-JsonFile.md index d5281e3..5d58f7b 100644 --- a/docs/Out-JsonFile.md +++ b/docs/Out-JsonFile.md @@ -92,4 +92,4 @@ Author: Sam Erde Version: 0.2.0 Modified: 2024/10/15 -## RELATED LINKS +## RELATED LINKS diff --git a/docs/PSPreworkout.md b/docs/PSPreworkout.md index e8b32c2..7233707 100644 --- a/docs/PSPreworkout.md +++ b/docs/PSPreworkout.md @@ -2,7 +2,7 @@ Module Name: PSPreworkout Module Guid: 378339de-a0df-4d44-873b-4fd32c388e06 Download Help Link: NA -Help Version: 1.4.3 +Help Version: 1.4.4 Locale: en-US --- @@ -71,4 +71,4 @@ Check if you are running an elevated shell with administrator or root privileges ### [Update-AllTheThings](Update-AllTheThings.md) Update all the things! - + diff --git a/docs/Set-ConsoleFont.md b/docs/Set-ConsoleFont.md index a5e77fd..e1c066f 100644 --- a/docs/Set-ConsoleFont.md +++ b/docs/Set-ConsoleFont.md @@ -56,4 +56,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Set-EnvironmentVariable.md b/docs/Set-EnvironmentVariable.md index b4cc69a..c1da857 100644 --- a/docs/Set-EnvironmentVariable.md +++ b/docs/Set-EnvironmentVariable.md @@ -85,4 +85,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Show-LoadedAssembly.md b/docs/Show-LoadedAssembly.md index 5fd0cbc..03d7b68 100644 --- a/docs/Show-LoadedAssembly.md +++ b/docs/Show-LoadedAssembly.md @@ -62,4 +62,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Show-WithoutEmptyProperty.md b/docs/Show-WithoutEmptyProperty.md index b001783..da32eab 100644 --- a/docs/Show-WithoutEmptyProperty.md +++ b/docs/Show-WithoutEmptyProperty.md @@ -99,4 +99,4 @@ subscribe to his newsletter! https://www.linkedin.com/in/jefferyhicks/ https://twitter.com/JeffHicks -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Test-IsElevated.md b/docs/Test-IsElevated.md index f54ed63..6b9e5e8 100644 --- a/docs/Test-IsElevated.md +++ b/docs/Test-IsElevated.md @@ -39,4 +39,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ### Boolean ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/docs/Update-AllTheThings.md b/docs/Update-AllTheThings.md index 9c8f90b..f47f067 100644 --- a/docs/Update-AllTheThings.md +++ b/docs/Update-AllTheThings.md @@ -147,4 +147,4 @@ For more information, see about_CommonParameters (http://go.microsoft.com/fwlink ## NOTES -## RELATED LINKS +## RELATED LINKS diff --git a/src/Artifacts/PSPreworkout.psd1 b/src/Artifacts/PSPreworkout.psd1 index a8b3df6..f32324c 100644 --- a/src/Artifacts/PSPreworkout.psd1 +++ b/src/Artifacts/PSPreworkout.psd1 @@ -9,31 +9,31 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'PSPreworkout.psm1' + RootModule = 'PSPreworkout.psm1' # Version number of this module. - ModuleVersion = '1.4.3' + ModuleVersion = '1.4.4' # Supported PSEditions = @('Desktop', 'Core') CompatiblePSEditions = @('Desktop', 'Core') # ID used to uniquely identify this module - GUID = '378339de-a0df-4d44-873b-4fd32c388e06' + GUID = '378339de-a0df-4d44-873b-4fd32c388e06' # Author of this module - Author = 'Sam Erde' + Author = 'Sam Erde' # Company or vendor of this module - CompanyName = 'Sam Erde' + CompanyName = 'Sam Erde' # Copyright statement for this module - Copyright = '(c) Sam Erde. All rights reserved.' + Copyright = '(c) Sam Erde. All rights reserved.' # Description of the functionality provided by this module - Description = 'A special mix of tools to help jump start your PowerShell session!' + Description = 'A special mix of tools to help jump start your PowerShell session!' # Minimum version of the PowerShell engine required by this module - PowerShellVersion = '5.1' + PowerShellVersion = '5.1' # Name of the PowerShell host required by this module # PowerShellHostName = '' @@ -69,7 +69,7 @@ # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = @( + FunctionsToExport = @( 'Edit-PSReadLineHistoryFile', 'Edit-WinGetSettingsFile', 'Get-EnvironmentVariable', @@ -93,13 +93,13 @@ ) # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. - CmdletsToExport = @() + CmdletsToExport = @() # Variables to export from this module # VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - AliasesToExport = @( + AliasesToExport = @( 'isadmin', 'isroot', 'uatt', @@ -124,7 +124,7 @@ # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ + PrivateData = @{ PSData = @{ @@ -157,7 +157,7 @@ } # End of PrivateData hashtable # HelpInfo URI of this module - # HelpInfoURI = '' + HelpInfoURI = 'https://raw.githubusercontent.com/SamErde/PSPreworkout/main/src/Help/en-US/' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = '' diff --git a/src/PSPreworkout/Help/en-US/PSPreworkout-help.xml b/src/PSPreworkout/Help/en-US/PSPreworkout-help.xml new file mode 100644 index 0000000..1859fbc --- /dev/null +++ b/src/PSPreworkout/Help/en-US/PSPreworkout-help.xml @@ -0,0 +1,2077 @@ + + + + + Edit-PSReadLineHistoryFile + Edit + PSReadLineHistoryFile + + Edit the PSReadLine History File + + + + Use this function to edit the PSReadLine history file. This may be useful if you want to reset some of your autocomplete suggestions orremove commands that did not work. + + + + Edit-PSReadLineHistoryFile + + + + + + + + Author: Sam Erde Version: 0.0.1 Modified: 2024-10-10 + Idea: History search with a TUI? This may already be done by the PowerShell Run module. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Edit-PSReadLineHistoryFile + + + + + + + + + + Edit-WingetSettingsFile + Edit + WingetSettingsFile + + Edit the WinGet settings file. + + + + A shortcut to edit the WinGet settings file. This will create one if it does not already exist. + + + + Edit-WingetSettingsFile + + EditorPath + + Specify the path to the editor that you would like to use. + + FileInfo + + FileInfo + + + None + + + + + + EditorPath + + Specify the path to the editor that you would like to use. + + FileInfo + + FileInfo + + + None + + + + + + + Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 + + + + + -------------------------- EXAMPLE 1 -------------------------- + Edit-WinGetSettingsFile + + + + + + + + + + Get-EnvironmentVariable + Get + EnvironmentVariable + + Retrieves the value of an environment variable. + + + + The Get-EnvironmentVariable function retrieves the value of the specified environment variable or displays all environment variables. + + + + Get-EnvironmentVariable + + Name + + The name of the environment variable to retrieve. + + String + + String + + + None + + + Target + + The target of the environment variable to retrieve. Defaults to User. (Process, User, or Machine) + + + Process + User + Machine + + EnvironmentVariableTarget + + EnvironmentVariableTarget + + + User + + + All + + Switch to show environment variables in all target scopes. + + + SwitchParameter + + + False + + + + + + Name + + The name of the environment variable to retrieve. + + String + + String + + + None + + + Target + + The target of the environment variable to retrieve. Defaults to User. (Process, User, or Machine) + + EnvironmentVariableTarget + + EnvironmentVariableTarget + + + User + + + All + + Switch to show environment variables in all target scopes. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + System.String + + + + + + + + + Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 + Variable names are case-sensitive on Linux and macOS, but not on Windows. + Why is 'Target' used by .NET instead of the familiar 'Scope' parameter name? @IISResetMe (Mathias R. Jessen) explains: "Scope" would imply some sort of integrated hierarchy of env variables - that's not really the case. Target=Process translates to kernel32!GetEnvironmentVariable (which then in turn reads the PEB from the calling process), whereas Target={User,Machine} causes a registry lookup against environment data in either HKCU or HKLM. + The relevant sources for the User and Machine targets are in the registry at: - HKEY_CURRENT_USER\Environment + - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment + + See more at <https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables>. + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-EnvironmentVariable -Name "PATH" +Retrieves the value of the "PATH" environment variable. + + + + + + + + + + Get-LoadedAssembly + Get + LoadedAssembly + + Get all assemblies loaded in PowerShell. + + + + Get all assemblies loaded in PowerShell. + + + + Get-LoadedAssembly + + + + + + + + System.Array + + + + + + + + + To Do: Add -Name parameter to get a specific one. + Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-LoadedAssembly + + Returns a list of all loaded assemblies. + + + + + + + + Get-PowerShellPortable + Get + PowerShellPortable + + Download a portable version of PowerShell to run anywhere on demand. + + + + This function helps you download a zipped version of PowerShell 7.x that can be run anywhere without needing to install it. + + + + Get-PowerShellPortable + + Path + + The path (directory) to download the PowerShell zip or tar.gz file into. Do not include a filename for the download. + + String + + String + + + None + + + Extract + + Extract the downloaded file. + + + SwitchParameter + + + False + + + + + + Path + + The path (directory) to download the PowerShell zip or tar.gz file into. Do not include a filename for the download. + + String + + String + + + None + + + Extract + + Extract the downloaded file. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + Author: Sam Erde Version: 0.1.0 Modified: 2024/10/12 + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-PowerShellPortable -Path $HOME -Extract + + Download the latest ZIP/TAR of PowerShell to your $HOME folder. It will be extracted into a folder that matches the filename of the compressed archive. + + + + + + + + Get-TypeAccelerator + Get + TypeAccelerator + + Get available type accelerators. + + + + Get available type accelerators. These can be useful when trying to find or remember the different type accellerators that are available to use in PowerShell. + + + + Get-TypeAccelerator + + Name + + The name of a specific type accelerator to get. + + String + + String + + + * + + + GridView + + Show the output in a grid view. + + + SwitchParameter + + + False + + + + + + Name + + The name of a specific type accelerator to get. + + String + + String + + + * + + + GridView + + Show the output in a grid view. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + System.Array + + + + + + + + + Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 + Thanks to Jeff Hicks (@JDHITSolutions) for helpful suggestions and improvements on this output! + + + + + -------------------------- EXAMPLE 1 -------------------------- + Get-TypeAccelerator -Name ADSI + + + + + + + + + + Initialize-PSEnvironmentConfiguration + Initialize + PSEnvironmentConfiguration + + Initialize configuration your PowerShell environment and git. + + + + Install supporting packages, configure git, and set your console font with this function. + + + + Initialize-PSEnvironmentConfiguration + + Name + + Your name to be used for git commits. + + String + + String + + + None + + + Email + + Your email to be used for git commits. + + String + + String + + + None + + + CentralProfile + + The file path to your central PowerShell profile. + + String + + String + + + None + + + Font + + The font to use for your consoles (PowerShell, Windows PowerShell, git bash, etc.) + + String + + String + + + None + + + Packages + + Packages to install with winget. + + String[] + + String[] + + + @('Microsoft.WindowsTerminal', 'git.git', 'JanDeDobbeleer.OhMyPosh') + + + Modules + + PowerShell modules to install. + + String[] + + String[] + + + @('CompletionPredictor', 'Microsoft.PowerShell.ConsoleGuiTools', 'Microsoft.PowerShell.PSResourceGet', 'posh-git', 'PowerShellForGitHub', 'Terminal-Icons') + + + SkipPackages + + Option to skip installation of default packages. + + + SwitchParameter + + + False + + + SkipModules + + Option to skip installation of default modules. + + + SwitchParameter + + + False + + + + + + Name + + Your name to be used for git commits. + + String + + String + + + None + + + Email + + Your email to be used for git commits. + + String + + String + + + None + + + CentralProfile + + The file path to your central PowerShell profile. + + String + + String + + + None + + + Font + + The font to use for your consoles (PowerShell, Windows PowerShell, git bash, etc.) + + String + + String + + + None + + + Packages + + Packages to install with winget. + + String[] + + String[] + + + @('Microsoft.WindowsTerminal', 'git.git', 'JanDeDobbeleer.OhMyPosh') + + + SkipPackages + + Option to skip installation of default packages. + + SwitchParameter + + SwitchParameter + + + False + + + Modules + + PowerShell modules to install. + + String[] + + String[] + + + @('CompletionPredictor', 'Microsoft.PowerShell.ConsoleGuiTools', 'Microsoft.PowerShell.PSResourceGet', 'posh-git', 'PowerShellForGitHub', 'Terminal-Icons') + + + SkipModules + + Option to skip installation of default modules. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + Author: Sam Erde Version: 0.0.2 Modified: 2024/10/12 + To Do Add status/verbose output of changes being made Create basic starter profile if none exist Create dot-sourced profile Create interactive picker for packages and modules (separate functions) Bootstrap Out-GridView or Out-ConsoleGridView + + + + + -------------------------- EXAMPLE 1 -------------------------- + Initialize the PowerShell working environment with a custom font, and set my name and email address for Git commits. + + Initialize-PSEnvironmentConfiguration -Name 'Sam Erde' -Email 'sam@example.local' -ConsoleFont 'FiraCode Nerd Font' + + + + + + + + Install-CommandNotFoundUtility + Install + CommandNotFoundUtility + + Install and setup the WinGetCommandNotFound utility from Microsoft PowerToys. + + + + This script installs the Microsoft.WinGet.CommandNotFound module and enables the required experimental features in PowerShell 7. + + + + Install-CommandNotFoundUtility + + + + + + + + Author: Sam Erde Version: 0.0.1 Modified: 2024-10-14 + May not work with PowerShell installed from MSIX or the Microsoft Store: <https://github.com/microsoft/PowerToys/issues/30818> + + + + + -------------------------- EXAMPLE 1 -------------------------- + Install-CommandNotFoundUtility + + + + + + + + + + Install-OhMyPosh + Install + OhMyPosh + + Install Oh My Posh and add it to your profile. + + + + An over-engineered script to install Oh My Posh. + + + + Install-OhMyPosh + + WingetSource + + Specify which source to install from. + - winget - Install from winget (default). - msstore - Install from the Microsoft Store. + + String + + String + + + Winget + + + Method + + Specify which tool to install Oh My Posh with. + - chocolatey + - direct (default) + - scoop + - winget + + String + + String + + + Direct + + + InstallNerdFont + + Use this switch if you want to install a nerd font for full glyph capabilities in your prompt. + + + SwitchParameter + + + False + + + Font + + Choose a nerd font to install. + - Default - Installs "Meslo" as the default nerd font. + - Select - Lets you choose a nerd font from the list. + + String + + String + + + Default + + + + + + WingetSource + + Specify which source to install from. + - winget - Install from winget (default). - msstore - Install from the Microsoft Store. + + String + + String + + + Winget + + + Method + + Specify which tool to install Oh My Posh with. + - chocolatey + - direct (default) + - scoop + - winget + + String + + String + + + Direct + + + InstallNerdFont + + Use this switch if you want to install a nerd font for full glyph capabilities in your prompt. + + SwitchParameter + + SwitchParameter + + + False + + + Font + + Choose a nerd font to install. + - Default - Installs "Meslo" as the default nerd font. + - Select - Lets you choose a nerd font from the list. + + String + + String + + + Default + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Install-OhMyPosh + + + + + + + + + + Install-PowerShellISE + Install + PowerShellISE + + Install the Windows PowerShell ISE if you removed it after installing VS Code. + + + + This script installs the Windows PowerShell ISE if it is not already. It includes a step that resets the Windows Automatic Update server source in the registry temporary, which may resolve errors that some people experience while trying to add Windows Capabilities. This was created because Out-GridView in Windows PowerShell 5.1 does not work without the ISE installed. However, Out-GridView was rewritten and included in PowerShell 7 for Windows. + + + + Install-PowerShellISE + + + + + + + + To Do: - Check for Windows client vs Windows Server OS - Add parameter to make the Windows Update registry change optional - Requires admin but adding that breaks the build + + + + + -------------------------- EXAMPLE 1 -------------------------- + Install-PowerShellISE + + + + + + + + + + Install-WinGet + Install + WinGet + + Install Winget (beta) + + + + Install WinGet on Windows Sandbox (or on builds of Windows 10 prior to build 1709 that did not ship with it preinstalled). + + + + Install-WinGet + + DownloadPath + + Path of the directory to save the downloaded packages in (optional). + + String + + String + + + None + + + DownloadOnly + + Download the packages without installing them (optional). + + + SwitchParameter + + + False + + + KeepDownload + + Keep the downloaded packages (optional). + + + SwitchParameter + + + False + + + + + + DownloadPath + + Path of the directory to save the downloaded packages in (optional). + + String + + String + + + None + + + DownloadOnly + + Download the packages without installing them (optional). + + SwitchParameter + + SwitchParameter + + + False + + + KeepDownload + + Keep the downloaded packages (optional). + + SwitchParameter + + SwitchParameter + + + False + + + + + + + To Do: - Check for newer versions of packages on GitHub + - Error handling + - Create the target folder if it does not already exist + + + + + -------------------------- EXAMPLE 1 -------------------------- + Install-WinGet + + + + + + -------------------------- EXAMPLE 2 -------------------------- + Install-WinGet -KeepDownload + + Installs WinGet and keeps the downloaded AppX packages. + + + + + + + + New-Credential + New + Credential + + Create a new secure credential. + + + + Create a new secure credential to use in other functions. + + + + New-Credential + + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + $Credential = New-Credential + + + + + + + + + + New-ScriptFromTemplate + New + ScriptFromTemplate + + Create a new advanced function from a template. + + + + This function creates a new function from a template and saves it to a file with the name of the function. It takes values for the function's synopsis, description, and alias as parameters and populates comment- based help for the new function automatically. + + + + New-ScriptFromTemplate + + Name + + The name of the new function to create. It is recommended to use ApprovedVerb-Noun for names. + + String + + String + + + None + + + Synopsis + + A synopsis of the new function. + + String + + String + + + None + + + Description + + A description of the new function. + + String + + String + + + None + + + Alias + + Optionally define an alias for the new function. + + String + + String + + + None + + + Author + + Name of the author of the script. Attempts to default to the 'FullName' property of the currently logged in user. + + String + + String + + + (Get-CimInstance -ClassName Win32_UserAccount -Filter "Name = `'$([System.Security.Principal.WindowsIdentity]::GetCurrent().Name.Split('\')[1])`'").FullName + + + Path + + The path of the directory to save the new script in. + + String + + String + + + None + + + SkipValidation + + Optionally skip validation of the script name. This will not check for use of approved verbs or restricted characters. + + + SwitchParameter + + + False + + + + New-ScriptFromTemplate + + Verb + + The verb to use for the function name. + + String + + String + + + None + + + Noun + + The noun to use for the function name. + + String + + String + + + None + + + Synopsis + + A synopsis of the new function. + + String + + String + + + None + + + Description + + A description of the new function. + + String + + String + + + None + + + Alias + + Optionally define an alias for the new function. + + String + + String + + + None + + + Author + + Name of the author of the script. Attempts to default to the 'FullName' property of the currently logged in user. + + String + + String + + + (Get-CimInstance -ClassName Win32_UserAccount -Filter "Name = `'$([System.Security.Principal.WindowsIdentity]::GetCurrent().Name.Split('\')[1])`'").FullName + + + Path + + The path of the directory to save the new script in. + + String + + String + + + None + + + SkipValidation + + Optionally skip validation of the script name. This will not check for use of approved verbs or restricted characters. + + + SwitchParameter + + + False + + + + + + Name + + The name of the new function to create. It is recommended to use ApprovedVerb-Noun for names. + + String + + String + + + None + + + Verb + + The verb to use for the function name. + + String + + String + + + None + + + Noun + + The noun to use for the function name. + + String + + String + + + None + + + Synopsis + + A synopsis of the new function. + + String + + String + + + None + + + Description + + A description of the new function. + + String + + String + + + None + + + Alias + + Optionally define an alias for the new function. + + String + + String + + + None + + + Author + + Name of the author of the script. Attempts to default to the 'FullName' property of the currently logged in user. + + String + + String + + + (Get-CimInstance -ClassName Win32_UserAccount -Filter "Name = `'$([System.Security.Principal.WindowsIdentity]::GetCurrent().Name.Split('\')[1])`'").FullName + + + Path + + The path of the directory to save the new script in. + + String + + String + + + None + + + SkipValidation + + Optionally skip validation of the script name. This will not check for use of approved verbs or restricted characters. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + New-ScriptFromTemplate -Name 'Get-Demo' -Synopsis 'Get a demo.' -Description 'This function gets a demo.' -Alias 'Get-Sample' -Parameter 'SerialNumber' + + + + + + -------------------------- EXAMPLE 2 -------------------------- + New-ScriptFromTemplate -Verb Get -Noun Something -Author 'Sam Erde' -Parameter @('Name','Age') + + + + + + + + + + Out-JsonFile + Out + JsonFile + + Convert an object to JSON and write to a file. + + + + This function converts an object to JSON and writes the output to the specified file. By default, it saves the file with the name of the object that you provided to the function. + + + + Out-JsonFile + + Object + + Object to convert to JSON and save it to a file. Check for empty objects here or in the function body? [ValidateScript({ if (-not [string]::IsNullOrWhiteSpace($ ) -and -not [string]::IsNullOrEmpty($ )) { $true } })] + + Object + + Object + + + None + + + FilePath + + Full path and filename to save the JSON to. + + String + + String + + + None + + + + + + Object + + Object to convert to JSON and save it to a file. Check for empty objects here or in the function body? [ValidateScript({ if (-not [string]::IsNullOrWhiteSpace($ ) -and -not [string]::IsNullOrEmpty($ )) { $true } })] + + Object + + Object + + + None + + + FilePath + + Full path and filename to save the JSON to. + + String + + String + + + None + + + + + + + Author: Sam Erde Version: 0.2.0 Modified: 2024/10/15 + + + + + -------------------------- EXAMPLE 1 -------------------------- + Out-JsonFile -Object $TestObject -FilePath $HOME + + Writes $TestObject as JSON to "$HOME/TestObject.json". + + + + -------------------------- EXAMPLE 2 -------------------------- + Out-JsonFile -Object $TestObject -FilePath C:\Temp\report.json + + Writes $TestObject as JSON to C:\Temp\report.json. + + + + -------------------------- EXAMPLE 3 -------------------------- + Out-JsonFile -Object $TestObject + + Writes $TestObject as JSON to TestObject.json in the current working directory of the file system. + + + + + + + + Set-ConsoleFont + Set + ConsoleFont + + Set the font for your consoles. + + + + Set-ConsoleFont allows you to set the font for all of your registered consoles (PowerShell, Windows PowerShell, Windows Terminal, or Command Prompt). It provides tab-autocomplete for the font parameter, listing all of the Nerd Fonts and monospace fonts installed on your system. + + + + Set-ConsoleFont + + Font + + The name of the font to set for your consoles. + + String + + String + + + None + + + + + + Font + + The name of the font to set for your consoles. + + String + + String + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Set-ConsoleFont -Font 'FiraCode Nerd Font' + + + + + + + + + + Set-EnvironmentVariable + Set + EnvironmentVariable + + Set environment variables. + + + + Set environment variables in any OS using .NET types. + + + + Set-EnvironmentVariable + + Name + + Parameter description + + String + + String + + + None + + + Value + + Parameter description + + String + + String + + + None + + + Target + + Parameter description + + + Process + User + Machine + + EnvironmentVariableTarget + + EnvironmentVariableTarget + + + None + + + + + + Name + + Parameter description + + String + + String + + + None + + + Value + + Parameter description + + String + + String + + + None + + + Target + + Parameter description + + EnvironmentVariableTarget + + EnvironmentVariableTarget + + + None + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Set-EnvironmentVariable -Name 'FavoriteDrink' -Value 'Coffee' -Target 'User' + + + + + + + + + + Show-LoadedAssembly + Show + LoadedAssembly + + Show all assemblies loaded in PowerShell. + + + + Show all assemblies loaded in PowerShell. + + + + Show-LoadedAssembly + + GridView + + Show the results in a grid view. + + + SwitchParameter + + + False + + + + + + GridView + + Show the results in a grid view. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Show-LoadedAssembly + + Shows a simple list of all loaded assemblies. + + + + -------------------------- EXAMPLE 2 -------------------------- + Show-LoadedAssembly -GridView + + Shows a list of all loaded assemblies in a grid view. + + + + + + + + Show-WithoutEmptyProperty + Show + WithoutEmptyProperty + + Show an object without its empty properties. + + + + This function shows the properties of an object with all of its empty properties filtered out. + + + + Show-WithoutEmptyProperty + + Object + + The object to show. + + Object + + Object + + + None + + + + + + Object + + The object to show. + + Object + + Object + + + None + + + + + + + PSCustomObject + + + + + + + + + I am grateful to Jeffrey Hicks for guiding me towards an understanding of how to complete this function and for providing even nicer code than I started with. I encourage you to reach out to him for PowerShell training and subscribe to his newsletter! 🙏 + https://jdhitsolutions.github.io/ https://www.linkedin.com/in/jefferyhicks/ https://twitter.com/JeffHicks + + + + + -------------------------- EXAMPLE 1 -------------------------- + Show-WithoutEmptyProperty -Object $Object + + + + + + -------------------------- EXAMPLE 2 -------------------------- + $Desk = [PSCustomObject]@{ + Model = 'PSDesk' + Height = $null + Width = $null + Colors = @('Black', 'Gray') + Adjustable = $true +} +$Object = New-Object -TypeName PSObject -Property $Desk +Show-WithoutEmptyProperty -Object $Object + + This example creates an object from a hash table and then shows that object's properties that have values. + + + + -------------------------- EXAMPLE 3 -------------------------- + Show-WithoutEmptyProperty -Object (Get-Item $HOME) + + This example gets the home folder object while invoking the function. + + + + -------------------------- EXAMPLE 4 -------------------------- + $Object | Show-WithoutEmptyProperty + + This example shows how an object can be piped to the function. + + + + -------------------------- EXAMPLE 5 -------------------------- + Get-ChildItem $HOME | Select-Object -First 1 | Show-WithoutEmptyProperty + + This example gets the home folder object and pipes it to the Show-WithoutEmptyProperty function. + + + + + + + + Test-IsElevated + Test + IsElevated + + Check if you are running an elevated shell with administrator or root privileges. + + + + Check if you are running an elevated shell with administrator or root privileges. + + + + Test-IsElevated + + + + + + + + Boolean + + + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Test-IsElevated + + + + + + + + + + Update-AllTheThings + Update + AllTheThings + + Update all the things! + + + + A script to automatically update all PowerShell modules, PowerShell Help, and packages (apt, brew, chocolately, winget). + + + + Update-AllTheThings + + SkipModules + + Skip the step that updates PowerShell modules. + + + SwitchParameter + + + False + + + SkipScripts + + Skip the step that updates PowerShell scripts. + + + SwitchParameter + + + False + + + SkipHelp + + Skip the step that updates PowerShell help. + + + SwitchParameter + + + False + + + SkipWinGet + + Skip the step the updates WinGet packages. + + + SwitchParameter + + + False + + + IncludeChocolatey + + Include Chocolatey package updates. + + + SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + + SwitchParameter + + + False + + + + + + SkipModules + + Skip the step that updates PowerShell modules. + + SwitchParameter + + SwitchParameter + + + False + + + SkipScripts + + Skip the step that updates PowerShell scripts. + + SwitchParameter + + SwitchParameter + + + False + + + SkipHelp + + Skip the step that updates PowerShell help. + + SwitchParameter + + SwitchParameter + + + False + + + SkipWinGet + + Skip the step the updates WinGet packages. + + SwitchParameter + + SwitchParameter + + + False + + + IncludeChocolatey + + Include Chocolatey package updates. + + SwitchParameter + + SwitchParameter + + + False + + + WhatIf + + Shows what would happen if the cmdlet runs. The cmdlet is not run. + + SwitchParameter + + SwitchParameter + + + False + + + Confirm + + Prompts you for confirmation before running the cmdlet. + + SwitchParameter + + SwitchParameter + + + False + + + + + + + + + + + + -------------------------- EXAMPLE 1 -------------------------- + Update-AllTheThings + + Updates all of the things it can! + + + + + + \ No newline at end of file diff --git a/src/PSPreworkout/Help/en-US/PSPreworkout_378339de-a0df-4d44-873b-4fd32c388e06_HelpInfo.xml b/src/PSPreworkout/Help/en-US/PSPreworkout_378339de-a0df-4d44-873b-4fd32c388e06_HelpInfo.xml new file mode 100644 index 0000000..80cd859 --- /dev/null +++ b/src/PSPreworkout/Help/en-US/PSPreworkout_378339de-a0df-4d44-873b-4fd32c388e06_HelpInfo.xml @@ -0,0 +1,10 @@ + + + NA + + + en-US + 1.4.3 + + + \ No newline at end of file diff --git a/src/PSPreworkout/PSPreworkout.psd1 b/src/PSPreworkout/PSPreworkout.psd1 index a8b3df6..ba2612c 100644 --- a/src/PSPreworkout/PSPreworkout.psd1 +++ b/src/PSPreworkout/PSPreworkout.psd1 @@ -9,31 +9,31 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'PSPreworkout.psm1' + RootModule = 'PSPreworkout.psm1' # Version number of this module. - ModuleVersion = '1.4.3' + ModuleVersion = '1.4.4' # Supported PSEditions = @('Desktop', 'Core') CompatiblePSEditions = @('Desktop', 'Core') # ID used to uniquely identify this module - GUID = '378339de-a0df-4d44-873b-4fd32c388e06' + GUID = '378339de-a0df-4d44-873b-4fd32c388e06' # Author of this module - Author = 'Sam Erde' + Author = 'Sam Erde' # Company or vendor of this module - CompanyName = 'Sam Erde' + CompanyName = 'Sam Erde' # Copyright statement for this module - Copyright = '(c) Sam Erde. All rights reserved.' + Copyright = '(c) Sam Erde. All rights reserved.' # Description of the functionality provided by this module - Description = 'A special mix of tools to help jump start your PowerShell session!' + Description = 'A special mix of tools to help jump start your PowerShell session!' # Minimum version of the PowerShell engine required by this module - PowerShellVersion = '5.1' + PowerShellVersion = '5.1' # Name of the PowerShell host required by this module # PowerShellHostName = '' @@ -69,7 +69,7 @@ # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. - FunctionsToExport = @( + FunctionsToExport = @( 'Edit-PSReadLineHistoryFile', 'Edit-WinGetSettingsFile', 'Get-EnvironmentVariable', @@ -93,13 +93,13 @@ ) # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. - CmdletsToExport = @() + CmdletsToExport = @() # Variables to export from this module # VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - AliasesToExport = @( + AliasesToExport = @( 'isadmin', 'isroot', 'uatt', @@ -124,7 +124,7 @@ # FileList = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ + PrivateData = @{ PSData = @{ @@ -157,7 +157,7 @@ } # End of PrivateData hashtable # HelpInfo URI of this module - # HelpInfoURI = '' + HelpInfoURI = 'https://raw.githubusercontent.com/SamErde/PSPreworkout/main/src/Help/' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = ''