Rework AddRegKey() to add key with empty value

This commit is contained in:
Yorick Barbanneau 2018-03-25 16:14:50 +02:00
parent eba57e6c8a
commit c2733d133c

View file

@ -87,6 +87,21 @@ function FwBlockOutputIP {
}
}
function FwBlockProgram {
param (
[cmdletbinding(
DefaultParameterSetName='params'
)]
[Parameter(
ValueFromPipeline=$False,
ParameterSetName="params",
Position = 0
)]
[object]$params
)
Write-Host " Test"
}
function RemoveScheduledTask () {
param (
[cmdletbinding(
@ -134,8 +149,12 @@ function AddRegKey {
[Parameter(Mandatory=$true)]
[object]$params
)
if ( -not $params.ContainsKey('path') -or -not $params.ContainsKey('key') -or -not $params.ContainsKey('value') ) {
Write-Host -ForegroundColor Red -NoNewline "Error in AddRegKey : no path, key or value"
if ( -not $params.ContainsKey('path') -or -not $params.ContainsKey('key') ) {
Write-Host -ForegroundColor Red -NoNewline "Error in AddRegKey : no path, key or value`n"
return
}
if ( -not $params.ContainsKey('value') ) {
$params.value = ""
}
if ( -not $params.ContainsKey('type') -or $params.type -eq "" ){ $params.type="DWord" }
Write-Host -NoNewline "`t$($params.key) reg key to $($params.value) : "