PowerShell: Enable Remote Registry on Remote Computer

Home/All Posts, PowerShell/PowerShell: Enable Remote Registry on Remote Computer

PowerShell: Enable Remote Registry on Remote Computer

This is a simple PowerShell script that will enable remote registry on a remote computer. This script will make changes to RemoteRegistry service on remote a selected remote computer. It will set the service as running with the startuptype to manual, so the RemoteRegistry service will not automatically start when computer is restarted.

This change makes it possible to navigate a remote computers registry from regedit


$ComputerName = "PCXXXXX"

Set-service -ComputerName $ComputerName -Name RemoteRegistry -Status Running -StartupType Manual -ErrorAction stop

The PowerShell script below is pretty much the same as above. But there is build some more Intelligence into it.

Below script should be called or executed from powershell.

Step in the script:

  • Type PC number on remote computer
  • Check actual service status of RemoteRegistry
  • Check if machine is only and service is there.
  • Change Remote Registry service to running if machine is online
  • Easy disabling of Remotry Registry by typing Enter at the end of the script.

 


Write-host -ForegroundColor Green "Enable Remote Registry on remote computer"
write-host ""
write-host -ForegroundColor Red "Remember to Disable Remote Registry after use!!"

$ComputerName = Read-Host "PC Name"
$Getservice = Get-Service -ComputerName $ComputerName -Name RemoteRegistry
If ($Getservice.Status -eq "Stopped") {
Set-service -ComputerName $ComputerName -Name RemoteRegistry -Status Running -StartupType Manual -ErrorAction stop
cls
write-host -ForegroundColor green "Remote Registry is now enabled on $ComputerName"
}
if ($Getservice -eq $null) {
Write-host -ForegroundColor Red "Error: Machine is not online or service status cannot be found!"
}
write-host "###"
write-host "###"
write-host -ForegroundColor Red "Remember to disable remote registry!!"
write-host "###"
write-host "###"
Read-host "Press Enter to disable Remote registry!"
do {
Get-service -ComputerName $ComputerName -Name RemoteRegistry | Stop-Service -Force
Set-Service -ComputerName $ComputerName -Name RemoteRegistry -Status Stopped -StartupType Disabled
$StopRemoteRegistry = Get-Service -ComputerName $ComputerName -Name RemoteRegistry

}while($StopRemoteRegistry.StartType -eq "Enabled")
cls
write-host -ForegroundColor Green "Remote Registry on $ComputerName is now disabled"

 

 

By | 2020-09-01T19:18:49+00:00 September 1st, 2020|Categories: All Posts, PowerShell|Tags: , , , , |0 Comments

About the Author:

Leave A Comment