Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .EXAMPLE
- Write-RegistryValue -Path "HKCU:\Software\Sysinternals\Strings" -Name "EulaAccepted
- #>
- function Write-RegistryValue{
- param (
- [parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path,
- [parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Name,
- [parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Value
- )
- Try{
- If (!(Test-Path $Path)){
- New-Item -Path (Split-Path $Path) -Name (Split-Path $Path -Leaf) -Force | Out-Null
- }
- Set-ItemProperty $Path -Name $Name -Value $Value
- Return $True
- }Catch{
- Return $False
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement