function Get-WinUtilRegistry { <# .DESCRIPTION This function will make all modifications to the registry .EXAMPLE Set-WinUtilRegistry -Name "PublishUserActivities" -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Type "DWord" -Value "0" #> param ( $Name, $Path, $Type, $Value ) Try{ $syscheckvalue = Get-ItemPropertyValue -Path $Path -Value $Value # Return Value } Catch [System.Security.SecurityException] { Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception" } Catch [System.Management.Automation.ItemNotFoundException] { Write-Warning $psitem.Exception.ErrorRecord } Catch{ Write-Warning "Unable to set $Name due to unhandled exception" Write-Warning $psitem.Exception.StackTrace } }