Skip to content

Commit

Permalink
Added Set-RegistryValue() and Get-RegistryValue()
Browse files Browse the repository at this point in the history
  • Loading branch information
texhex committed Nov 27, 2016
1 parent 80ad4df commit e9dbfa4
Show file tree
Hide file tree
Showing 3 changed files with 432 additions and 188 deletions.
33 changes: 33 additions & 0 deletions MPSXM-Debug_Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,39 @@ Import-Module "$PSScriptRoot\MPSXM.psm1" -Force

Clear-Host

$reg="HKCU\Software\MPSXM"

#Set-RegistryValue -Path $regPath -Value "Value of default key"
#Set-RegistryValue -Path $regPath -Name "RegTest 1" -Value 0


#Set-RegistryValue -Path $regPath -Name $null -Value 0

#Write to (Default) value
Set-RegistryValue -Path $reg -Value "Value for (default)"

#Write as REG_DWORD because the value is an int
Set-RegistryValue -Path $regPath -Name "My DWORD Value" -Value 1

#Write as REG_QWORD because the value is a long
Set-RegistryValue -Path $regPath -Name "My QWORD Value" -Value ([long]123)

#Write an int as REQ_QWORD by using the prameter QWordb
Set-RegistryValue -Path $regPath -Name "My QWORD Value 2" -Value 2 -Type QWord


$testRead=Get-RegistryValue -Path $regPath -Name "My DWORD Value"
write-host "Read My DWORD Value: [$testRead]"

$testRead=Get-RegistryValue -Path $regPath -Name "My DWORD Value DOES NOT EXIST" -DefaultValue 999
write-host "Read My DWORD Value: [$testRead]"

$testRead=Get-RegistryValue -Path $regPath -DefaultValue "Not set"
write-host "Read (Default) value: [$testRead]"

$testRead=Get-RegistryValue -Path "$regPath\XyZ" -DefaultValue "Default Value"
write-host "Read (Default) value non existing path: [$testRead]"



write-host "*** ENDE ***"
Loading

0 comments on commit e9dbfa4

Please sign in to comment.