diff --git a/COMMITTERS.md b/COMMITTERS.md
index a57979dade..ca8272fe35 100644
--- a/COMMITTERS.md
+++ b/COMMITTERS.md
@@ -152,3 +152,57 @@ References
* [http://pivotallabs.com/git-rebase-onto/ (Archive)](https://web.archive.org/web/20150709101404/http://pivotallabs.com:80/git-rebase-onto/)
* http://git-scm.com/book/ch3-6.html
+
+## Generating and Updating Cmdlet Documentation
+
+Documentation for the cmdlets in the Chocolatey.PowerShell project is maintained as `*.md` files in the [chocolatey/docs](https://github.com/chocolatey/docs) repository, under `input/en-us/create/cmdlets`.
+When making changes to a cmdlet or adding a new one, we need to ensure that those Markdown files get updated, and that those changes are propagated back to this repository in the [`Chocolatey.PowerShell.dll-help.xml`](./src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml) file in the repository.
+
+Before working with this, be sure to clone the `chocolatey/docs` repository locally.
+If your local copy of the docs repository is not located at `../docs` relative to this folder, you will need to specify the `-DocsRepositoryPath` parameter whenever calling the `update-cmdlet-documentation.ps1` script.
+
+### Generating Documentation for a new Cmdlet
+
+Run the `update-cmdlet-documentation.ps1` script with the `-NewCommand` parameter, specifying the name of the cmdlet(s) that you've added:
+
+```powershell
+./update-cmdlet-documentation.ps1 -NewCommand Test-NewChocolateyCommand
+```
+
+Once this completes, you will get a warning that the documentation template needs to be filled out and the newly-generated documentation file will open in your default editor for `*.md` files.
+
+### Updating Documentation For an Existing Cmdlet
+
+Run the `update-cmdlet-documentation.ps1` script:
+
+```powershell
+./update-cmdlet-documentation.ps1
+```
+
+### Generating the `Chocolatey.PowerShell.dll-help.xml` External Help Documentation
+
+Once new files have been generated, in the `chocolatey/docs` repository, make any additional changes needed to the files.
+Note that these files will need to be compatible both with PlatyPS and the docs repository Markdown formatting.
+As such, for new files you will need to sure the additional frontmatter is added.
+A complete frontmatter block for these files looks like this:
+
+```md
+---
+Description: Information on Cmdlet-Name cmdlet
+external help file: Chocolatey.PowerShell.dll-Help.xml
+Module Name: Chocolatey.PowerShell
+online version: https://docs.chocolatey.org/en-us/create/functions/cmdlet-name
+Order: 70
+schema: 2.0.0
+Title: Cmdlet-Name
+xref: cmdlet-name
+---
+```
+
+Some files may also have a `RedirectFrom: [ ... ]` frontmatter entry.
+This is not required for new files, but existing files (or files added for a cmdlet that is a rewrite of a pre-existing command) should retain their existing redirects.
+
+Run the `update-cmdlet-documentation.ps1` script once more, and add the changes to the `Chocolatey.PowerShell.dll-help.xml` file to a commit.
+
+Finally, add the changes to a commit on a new branch in the `docs` repository and submit a PR for any changes there as well, alongside the PR to any changes made in this repository.
+If you are rewriting a cmdlet from a pre-existing script command, ensure you remove the old documentation file from `input/en-us/create/commands` as well, so that there are no duplicate xrefs.
diff --git a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj
index 33222714dc..982d5c1a47 100644
--- a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj
+++ b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj
@@ -78,5 +78,10 @@
+
+
+ PreserveNewest
+
+
\ No newline at end of file
diff --git a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml
new file mode 100644
index 0000000000..b6f74a03dd
--- /dev/null
+++ b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml
@@ -0,0 +1,936 @@
+
+
+
+
+ Get-EnvironmentVariable
+ Get
+ EnvironmentVariable
+
+ Gets an Environment Variable.
+
+
+
+ This will will get an environment variable based on the variable name and scope while accounting whether to expand the variable or not (e.g.: `%TEMP%`-> `C:\User\Username\AppData\Local\Temp`).
+
+
+
+ Get-EnvironmentVariable
+
+ Name
+
+ The environment variable you want to get the value from.
+
+ String
+
+ String
+
+
+ None
+
+
+ Scope
+
+ The environment variable target scope. This is `Process`, `User`, or `Machine`.
+
+
+ Process
+ User
+ Machine
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ PreserveVariables
+
+ Whether you want to expand embedded environment variable names or not. When not set, variables will be expanded.
+
+
+ SwitchParameter
+
+
+ False
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ Name
+
+ The environment variable you want to get the value from.
+
+ String
+
+ String
+
+
+ None
+
+
+ PreserveVariables
+
+ Whether you want to expand embedded environment variable names or not. When not set, variables will be expanded.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ Scope
+
+ The environment variable target scope. This is `Process`, `User`, or `Machine`.
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+
+
+
+
+ System.String
+
+
+ Outputs the value of the target environment variable as a string.
+
+
+
+
+
+ This helper reduces the number of lines one would have to write to get environment variables, mainly when not expanding the variables is a must.
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Get-EnvironmentVariable -Name 'TEMP' -Scope User -PreserveVariables
+
+ Gets the `TEMP` encironment variable from the user scope, without expanding embedded environment variables.
+
+
+
+ -------------------------- Example 2 --------------------------
+ PS C:\> Get-EnvironmentVariable -Name 'PATH' -Scope Machine
+
+ Gets the `PATH` environment variable from the machine scope, expanding embedded environment variables.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/get-environmentvariable
+
+
+ Get-EnvironmentVariableNames
+ xref:get-environmentvariablenames
+
+
+ Set-EnvironmentVariable
+ xref:set-environmentvariable
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Get-EnvironmentVariableNames
+ Get
+ EnvironmentVariableNames
+
+ Gets all environment variable names.
+
+
+
+ Provides a list of environment variable names based on the scope. This can be used to loop through the list and generate names.
+
+
+
+ Get-EnvironmentVariableNames
+
+ Scope
+
+ The environment variable target scope. This is `Process`, `User`, or `Machine`.
+
+
+ Process
+ User
+ Machine
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ Scope
+
+ The environment variable target scope. This is `Process`, `User`, or `Machine`.
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+
+
+
+
+ System.String
+
+
+ Outputs the names of all the environment variables in the target scope as strings.
+
+
+
+
+
+ Process dumps the current environment variable names in memory / session. The other scopes refer to the registry values.
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Get-EnvironmentVariableNames -Scope Machine
+
+ Outputs the names of all the environment variables defined in the registry for the Machine scope.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/get-environmentvariablenames
+
+
+ Get-EnvironmentVariable
+ xref:get-environmentvariable
+
+
+ Set-EnvironmentVariable
+ xref:set-environmentvariable
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Install-ChocolateyPath
+ Install
+ ChocolateyPath
+
+ > :choco-info: NOTE > > Administrative Access Required when `-PathType 'Machine'.`
+ This puts a directory to the PATH environment variable.
+
+
+
+ Looks at both PATH environment variables to ensure a path variable correctly shows up on the right PATH.
+
+
+
+ Install-ChocolateyPath
+
+ Path
+
+ The full path to a location to add / ensure is in the PATH.
+
+ String
+
+ String
+
+
+ None
+
+
+ PathType
+
+ Which PATH to add it to. If specifying `Machine`, this requires admin privileges to run correctly.
+
+
+ Process
+ User
+ Machine
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ Path
+
+ The full path to a location to add / ensure is in the PATH.
+
+ String
+
+ String
+
+
+ None
+
+
+ PathType
+
+ Which PATH to add it to. If specifying `Machine`, this requires admin privileges to run correctly.
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+
+
+
+
+ This command will assert UAC/Admin privileges on the machine if `-PathType 'Machine'`.
+ This is used when the application/tool is not being linked by Chocolatey (not in the lib folder).
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Install-ChocolateyPath -PathToInstall "$($env:SystemDrive)\tools\gittfs"
+
+ Adds the target path to the current user's PATH.
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Install-ChocolateyPath "$($env:SystemDrive)\Program Files\MySQL\MySQL Server 5.5\bin" -PathType 'Machine'
+
+ Adds the target path to the system-wide PATH.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/install-chocolateypath
+
+
+ Uninstall-ChocolateyPath
+ xref:uninstall-chocolateypath
+
+
+ Install-ChocolateyEnvironmentVariable
+ xref:install-chocolateyenvironmentvariable
+
+
+ Get-EnvironmentVariable
+ xref:get-environmentvariable
+
+
+ Set-EnvironmentVariable
+ xref:set-environmentvariable
+
+
+ Get-ToolsLocation
+ xref:get-toolslocation
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Set-EnvironmentVariable
+ Set
+ EnvironmentVariable
+
+ > :choco-info: NOTE > > Administrative Access Required when `-Scope 'Machine'.`
+ DO NOT USE. Not part of the public API. Use `Install-ChocolateyEnvironmentVariable` instead.
+
+
+
+ Saves an environment variable.
+
+
+
+ Set-EnvironmentVariable
+
+ Name
+
+ The name of the environment variable to set.
+
+ String
+
+ String
+
+
+ None
+
+
+ Value
+
+ The value to set the named environment variable to.
+
+ String
+
+ String
+
+
+ None
+
+
+ Scope
+
+ The scope to set the environment variable at.
+
+
+ Process
+ User
+ Machine
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ Name
+
+ The name of the environment variable to set.
+
+ String
+
+ String
+
+
+ None
+
+
+ Scope
+
+ The scope to set the environment variable at.
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ Value
+
+ The value to set the named environment variable to.
+
+ String
+
+ String
+
+
+ None
+
+
+
+
+
+
+ This command will assert UAC/Admin privileges on the machine if `-Scope 'Machine'`.
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Set-EnvironmentVariable -Name MyApplicationPath -Value C:\test -Scope Machine
+
+ Sets the `MyApplicationPath` environment variable to `C:\test` at the system level.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/set-environmentvariable
+
+
+ Install-ChocolateyEnvironmentVariable
+ xref:install-chocolateyenvironmentvariable
+
+
+ Uninstall-ChocolateyEnvironmentVariable
+ xref:uninstall-chocolateyenvironmentvariable
+
+
+ Install-ChocolateyPath
+ xref:install-chocolateypath
+
+
+ Get-EnvironmentVariable
+ xref:get-environmentvariable
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Test-ProcessAdminRights
+ Test
+ ProcessAdminRights
+
+ Tests whether the current process is running with administrative rights.
+
+
+
+ This function checks whether the current process has administrative rights by checking if the current user identity is a member of the Administrators group. It returns `$true` if the current process is running with administrative rights, `$false` otherwise.
+ On Windows Vista and later, with UAC enabled, the returned value represents the actual rights available to the process, for example if it returns `$true`, the process is running elevated.
+
+
+
+ Test-ProcessAdminRights
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+
+ System.Boolean
+
+
+ Outputs `$true` if the current process has admin rights, otherwise `$false`.
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Test-ProcessAdminRights
+
+ Outputs `$true` if the current process is elevated, otherwise `$false`.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/test-processadminrights
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Uninstall-ChocolateyPath
+ Uninstall
+ ChocolateyPath
+
+ > :choco_info: NOTE > > Administrative Access Required when `-PathType 'Machine'.`
+ This puts a directory to the PATH environment variable.
+
+
+
+ Ensures that the given path is not present in the given type of PATH environment variable as well as in the current session.
+
+
+
+ Uninstall-ChocolateyPath
+
+ Path
+
+ The exact path to remove from the environment PATH.
+
+ String
+
+ String
+
+
+ None
+
+
+ PathType
+
+ Which PATH to add it to. If specifying `Machine`, this requires admin privileges to run correctly.
+
+
+ Process
+ User
+ Machine
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+ Path
+
+ The exact path to remove from the environment PATH.
+
+ String
+
+ String
+
+
+ None
+
+
+ PathType
+
+ Which PATH to add it to. If specifying `Machine`, this requires admin privileges to run correctly.
+
+ EnvironmentVariableTarget
+
+ EnvironmentVariableTarget
+
+
+ None
+
+
+
+
+
+
+ This command will assert UAC/Admin privileges on the machine if `-PathType 'Machine'`. This is used when the application/tool is not being linked by Chocolatey (not in the lib folder).
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Uninstall-ChocolateyPath -PathToUninstall "$($env:SystemDrive)\tools\gittfs"
+
+ Removes the target path from the current user's PATH environment variable.
+
+
+
+ -------------------------- Example 2 --------------------------
+ PS C:\> Uninstall-ChocolateyPath "$($env:SystemDrive)\Program Files\MySQL\MySQL Server 5.5\bin" -PathType 'Machine'
+
+ Removes the target path from the system-wide PATH environment variable.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/uninstall-chocolateypath
+
+
+ Install-ChocolateyPath
+ xref:install-chocolateypath
+
+
+ Install-ChocolateyEnvironmentVariable
+ xref:install-chocolateyenvironmentvariable
+
+
+ Get-EnvironmentVariable
+ xref:get-environmentvariable
+
+
+ Set-EnvironmentVariable
+ xref:set-environmentvariable
+
+
+ Get-ToolsLocation
+ xref:get-toolslocation
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
+
+ Update-SessionEnvironment
+ Update
+ SessionEnvironment
+
+ Updates the environment variables of the current powershell session with any environment variable changes that may have occurred during a Chocolatey package install.
+
+
+
+ When Chocolatey installs a package, the package author may add or change certain environment variables that will affect how the application runs or how it is accessed. Often, these changes are not visible to the current PowerShell session. This means the user needs to open a new PowerShell session before these settings take effect which can render the installed application nonfunctional until that time.
+ Use the Update-SessionEnvironment command to refresh the current PowerShell session with all environment settings possibly performed by Chocolatey package installs.
+
+
+
+ Update-SessionEnvironment
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+ IgnoredArguments
+
+ Allows splatting with arguments that do not apply. Do not use directly.
+
+ Object[]
+
+ Object[]
+
+
+ None
+
+
+
+
+
+
+ This method is also added to the user's PowerShell profile as `refreshenv`. When called as `refreshenv`, the method will provide additional output.
+ Preserves `PSModulePath` as set by the process.
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Update-SessionEnvironment
+
+ Updates the current session environment variables.
+
+
+
+
+
+ Online Version:
+ https://docs.chocolatey.org/en-us/create/functions/update-sessionenvironment
+
+
+ Cmdlet Reference
+ xref:powershell-cmdlet-reference
+
+
+ Function Reference
+ xref:powershell-reference
+
+
+
+
\ No newline at end of file
diff --git a/update-cmdlet-documentation.ps1 b/update-cmdlet-documentation.ps1
new file mode 100644
index 0000000000..c9eb6dff69
--- /dev/null
+++ b/update-cmdlet-documentation.ps1
@@ -0,0 +1,77 @@
+<#
+.SYNOPSIS
+Generates Markdown documentation for the Chocolatey.PowerShell portion of Chocolatey's installer module commands.
+
+.DESCRIPTION
+Use this script when modifying or adding commands into the Chocolatey.PowerShell project.
+You will need the chocolatey/docs repository cloned locally in order to use this script.
+When all documentation files this script is monitoring have been filled out (contain no remaining {{ template tokens }}), this script will generate/update the external help xml files for PowerShell.
+#>
+[CmdletBinding()]
+param(
+ # Specify the path to the chocolatey/docs repository root locally. Defaults to ../docs
+ [Parameter()]
+ [string]
+ $DocsRepositoryPath = "$PSScriptRoot/../docs",
+
+ # Specify the new commands' names to generate new documentation pages for them.
+ [Parameter()]
+ [Alias('NewCommands')]
+ [string[]]
+ $NewCommand,
+
+ # Opens any new or incomplete files in the default editor for Markdown (.md) files for editing.
+ [Parameter()]
+ [switch]
+ $OpenUnfinished
+)
+
+if (-not (Get-Module -ListAvailable PlatyPS)) {
+ Write-Warning "PlatyPS module not found, attempting to install from PSGallery"
+ Install-Module PlatyPS -Scope CurrentUser
+}
+
+$documentationPath = Join-Path $DocsRepositoryPath -ChildPath "input/en-us/create/cmdlets"
+if (-not (Test-Path $DocsRepositoryPath)) {
+ throw "PowerShell commands docs folder was not found at '$documentationPath'. Please clone the chocolatey/docs repository locally first, and/or provide the path to the repo root as -DocsRepositoryPath to this script."
+}
+
+$dllPath = "$PSScriptRoot/code_drop/temp/_PublishedLibs/Chocolatey.PowerShell_signed/Chocolatey.PowerShell.dll"
+
+if (-not (Test-Path $dllPath)) {
+ throw "Please run this repository's build.ps1 file before trying to build markdown help for this module."
+}
+
+# Import the module .dll to generate / update help from.
+Import-Module $dllPath
+
+if (-not (Get-Module Chocolatey.PowerShell)) {
+ throw "The Chocolatey.PowerShell module was not able to be loaded, exiting documentation generation."
+}
+
+$newOrUpdatedFiles = [System.Collections.Generic.HashSet[System.IO.FileSystemInfo]] @(
+ if ($NewCommand) {
+ New-MarkdownHelp -Command $NewCommand -OutputFolder "$PSScriptRoot\docs" -ExcludeDontShow
+ }
+
+ Update-MarkdownHelp -Path $documentationPath -ExcludeDontShow
+)
+
+$incompleteFiles = $newOrUpdatedFiles | Select-String '\{\{[^}]+}}' | Select-Object -ExpandProperty Path
+
+if ($incompleteFiles) {
+ Write-Warning "The following files contain {{ template tokens }} from PlatyPS that must be replaced with help content before they are committed to the repository:"
+ $incompleteFiles | Write-Warning
+
+ if ($OpenUnfinished) {
+ $incompleteFiles | Invoke-Item
+ }
+
+ Write-Warning "Run this script again once these files have been updated in order to generate the XML help documentation for the module."
+}
+else {
+ New-ExternalHelp -Path $documentationPath -OutputPath "$PSScriptRoot/src/Chocolatey.PowerShell"
+}
+
+# Output the new/updated files so calling user knows what files the script has touched.
+$newOrUpdatedFiles
\ No newline at end of file