1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

#21440. Module Win_Regedit, pipe all calls to New-ItemProperty and Get-ItemProperty (when not stored as variable) to Out-Null (#21771)

This commit is contained in:
tomkitchen 2017-02-23 01:44:50 +00:00 committed by Matt Davis
parent 7b30203016
commit 9d2d364a38

View file

@ -58,7 +58,7 @@ Function Test-ValueData {
) )
try { try {
Get-ItemProperty -Path $Path -Name $Name Get-ItemProperty -Path $Path -Name $Name | Out-Null
return $true return $true
} catch { } catch {
return $false return $false
@ -188,7 +188,7 @@ if ($state -eq "present") {
$null = $(Get-Item -Path $path -ErrorAction 'Stop').OpenSubKey('','ReadWriteSubTree').SetValue($null,$data) $null = $(Get-Item -Path $path -ErrorAction 'Stop').OpenSubKey('','ReadWriteSubTree').SetValue($null,$data)
} else { } else {
Remove-ItemProperty -Path $path -Name $name Remove-ItemProperty -Path $path -Name $name
New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force | Out-Null
} }
} catch { } catch {
Fail-Json $result $_.Exception.Message Fail-Json $result $_.Exception.Message
@ -209,7 +209,7 @@ if ($state -eq "present") {
try { try {
if ($type -eq "none") { if ($type -eq "none") {
Remove-ItemProperty -Path $path -Name $name Remove-ItemProperty -Path $path -Name $name
New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type -Force | Out-Null
} else { } else {
Set-ItemProperty -Path $path -Name $name -Value $data Set-ItemProperty -Path $path -Name $name -Value $data
} }
@ -233,7 +233,7 @@ if ($state -eq "present") {
# Add missing entry # Add missing entry
if (-not $check_mode) { if (-not $check_mode) {
try { try {
New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type New-ItemProperty -Path $path -Name $name -Value $data -PropertyType $type | Out-Null
} Catch { } Catch {
Fail-Json $result $_.Exception.Message Fail-Json $result $_.Exception.Message
} }
@ -251,7 +251,7 @@ if ($state -eq "present") {
try { try {
$new_path = New-Item $path -Type directory -Force $new_path = New-Item $path -Type directory -Force
if ($name -ne $null) { if ($name -ne $null) {
$new_path | New-ItemProperty -Name $name -Value $data -PropertyType $type -Force $new_path | New-ItemProperty -Name $name -Value $data -PropertyType $type -Force | Out-Null
} }
} catch { } catch {
Fail-Json $result $_.Exception.Message Fail-Json $result $_.Exception.Message