PS | Working with Registry

< All Topics

List properties for particular Registry Key

$RegisteryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters"
Get-Item -Path $RegisteryPath 

Create a New Register Key

New-Item –Path $RegisteryPath –Name TEMP

Create a New Property under the new Register Key

New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\TEMP -Name "UAT" -Value "10" -PropertyType Dword

Reference for PropertyType

  • String – REG_SZ
  • ExpandString – REG_EXPAND_SZ
  • Binary – REG_BINARY
  • Dword – REG_DWORD
  • MultiString – REG_MULTI_SZ
  • Qword – REG_QWORD

Update Properties

Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\TEMP -Name "UAT" -Value "20"

Remove Properties & Registry Key

Remove-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\TEMP -Name "UAT"
Remove-Item -Path HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\TEMP
Previous PS | Provision AD Users for Testing
Table of Contents