Functions/New-Regkey.ps1
function New-RegKey { [CmdletBinding()] param ( [Parameter(Mandatory)] [string] $Path, [Parameter(Mandatory)] [string] $Name, [Parameter(Mandatory)] [ValidateSet("SEG_SZ", "SEG_EXPAND_SZ", "REG_BINARY", "REG_DWORD", "SEG_MULTI_SZ", "REG_QWORD")] [string] $PropertyType, [Parameter(Mandatory)] [string] $Value ) $PropertyTypes = @{ SEG_SZ = "String" SEG_EXPAND_SZ = "ExpandString" REG_BINARY = "Binary" REG_DWORD = "DWord" SEG_MULTI_SZ = "MultiString" REG_QWORD = "QWord" } $Param = @{ Path = $Path Name = $Name PropertyType = $PropertyTypes[$PropertyType] Value = $Value } $Param New-ItemProperty @Param -Force -ErrorAction 0 } |