Rework AddRegKey() to add key with empty value
This commit is contained in:
parent
eba57e6c8a
commit
c2733d133c
1 changed files with 21 additions and 2 deletions
23
cleanW10.ps1
23
cleanW10.ps1
|
@ -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 () {
|
function RemoveScheduledTask () {
|
||||||
param (
|
param (
|
||||||
[cmdletbinding(
|
[cmdletbinding(
|
||||||
|
@ -134,8 +149,12 @@ function AddRegKey {
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[object]$params
|
[object]$params
|
||||||
)
|
)
|
||||||
if ( -not $params.ContainsKey('path') -or -not $params.ContainsKey('key') -or -not $params.ContainsKey('value') ) {
|
if ( -not $params.ContainsKey('path') -or -not $params.ContainsKey('key') ) {
|
||||||
Write-Host -ForegroundColor Red -NoNewline "Error in AddRegKey : no path, key or value"
|
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" }
|
if ( -not $params.ContainsKey('type') -or $params.type -eq "" ){ $params.type="DWord" }
|
||||||
Write-Host -NoNewline "`t$($params.key) reg key to $($params.value) : "
|
Write-Host -NoNewline "`t$($params.key) reg key to $($params.value) : "
|
||||||
|
|
Reference in a new issue