mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-15 07:05:51 -06:00
34 lines
900 B
PowerShell
34 lines
900 B
PowerShell
|
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
|
||
|
}
|
||
|
}
|