Private/New-RegistryValue.ps1
function New-RegistryValue { <# .SYNOPSIS Creates a registry key. .PARAMETER Path The path to the registry key to be created. Must include the registry hive. .PARAMETER Name The name of the value to add .PARAMETER Value The data of the value to add. .PARAMETER Type The type of the value to add. #> [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [String] $Path, [Parameter(Mandatory = $true)] [ValidateNotNull()] [AllowEmptyString()] [String] $Name, [String] $Value, [ValidateNotNullOrEmpty()] [String] $Type ) if (-not (Test-Path -Path "Registry::$Path")) { New-RegistryKey -Path "Registry::$Path" } $null = New-ItemProperty -Path "Registry::$Path" -Name $Name -Value $Value -PropertyType $Type } |