fbpx Work with the Registry of a Remote Computer | Windows PowerShell, Windows Server | HostingUltraso.com
24/7/365 Support

Work with the Registry of a Remote Computer

Problem

You want to work with the registry keys and values of a remote computer.

Solution

To work with the registry of a remote computer, use the scripts provided in this chapter: GetRemoteRegistryChildItem, GetRemoteRegistryProperty, and SetRemoteRegistryProperty. These scripts require that the remote computer has the remote registry service enabled and running. Example 185 updates the PowerShell execution policy of a remote machine.

Example 185. Setting the PowerShell execution policy of a remote machine

PS >$registryPath = "HKLM:\Software\Microsoft\PowerShell\1" PS >GetRemoteRegistryChildItem LEEDESK $registryPath

SKC VC Name Property

0 1 1033 {Install} 0 5 PowerShellEngine {ApplicationBase, ConsoleHostAss... 2 0 PowerShellSnapIns {} 1 0 ShellIds {}

PS >GetRemoteRegistryChildItem LEEDESK $registryPath\ShellIds

SKC VC Name Property

0 2 Microsoft.PowerShell {Path, ExecutionPolicy}

PS > PS >$registryPath = "HKLM:\Software\Microsoft\PowerShell\1\" + >> "ShellIds\Microsoft.PowerShell" >>

Example 185. Setting the PowerShell execution policy of a remote machine (continued)

PS >GetRemoteRegistryKeyProperty LEEDESK $registryPath ExecutionPolicy

ExecutionPolicy

Unrestricted

PS >SetRemoteRegistryKeyProperty LEEDESK $registryPath ` >> "ExecutionPolicy" "RemoteSigned" >> PS >GetRemoteRegistryKeyProperty LEEDESK $registryPath ExecutionPolicy

ExecutionPolicy

RemoteSigned

Discussion

Although this specific task is perhaps better solved through PowerShell’s Group Policy support, it demonstrates a useful scenario that includes both remote registry exploration and modification.

For more information about the GetRemoteRegistryChildItem, GetRemoteRegistryProperty, and SetRemoteRegistryProperty scripts.

Help Category:

Get Windows Dedicated Server

Only reading will not help you, you have to practice it! So get it now.

Processor RAM Storage Server Detail
Processor Intel Atom C2350 1.7 GHz 2c/2t RAM 4 GB DDR3 Storage 1× 1 TB (HDD SATA) Server Detail Configure Server
Processor Intel Atom C2350 1.7 GHz 2c/2t RAM 4 GB DDR3 Storage 1× 128 GB (SSD SATA) Server Detail Configure Server
Processor Intel Atom C2750 2.4 GHz 8c/8t RAM 8 GB DDR3 Storage 1× 1 TB (HDD SATA) Server Detail Configure Server
Processor Intel Xeon E3-1230 v2 3.3 GHz 4c/8t RAM 16 GB DDR3 Storage 1× 256 GB (SSD SATA) Server Detail Configure Server
Processor Intel Atom C2350 1.7 GHz 2c/2t RAM 4 GB DDR3 Storage 1× 250 GB (SSD SATA) Server Detail Configure Server

What Our Clients Say