Change Computer Description in Registry

Change a Computer’s Description in the Registry Using PowerShellChange Computer Description Registry

I want to explain how to use PowerShell’s registry cmdlets to change a computer’s description field. 

I will also show you how to view a list of computer descriptions on the network.

 ♦

Problem(s) with Changing the Computer Description

Our main task is to set the ‘Computer description’.  However, we are not going to use the Control Panel, but instead, employ PowerShell to programmatically change the value data for ‘srvcomment’ in the registry.

Our secondary task is to view these freshly added ‘Computer descriptions’ on the network. 

Computer Description in Control Panel –> System

Computer Description Registry 

PowerShell Task 1: To Change a Computer Description

Preliminary Task: Install the PSRemoteRegistry Module
The first problem is that PowerShell 3.0 does not have the Set-RegString cmdlet, which was designed by Shay Levy.

Our preliminary task is downloading a special PowerShell module called PSRemoteRegistry

Note 1: I found the .msi version worked, whereas the extracting the .zip caused an error.

Following the download, you can now install Shay Levy’s registry cmdlets using these native PowerShell commands:

Get-Module -Name PSRemoteRegistry -ListAvailable

# Followed by:

Import-Module PSRemoteRegistry

How to Change a Computer Description in the Registry
The key cmdlet in the PSRemoteRegistry module is Set-RegString; we will use it to script a change in the REG_SZ value for "srvcomment".

# Registry variables for ‘Computer description’,
$Hive ="LocalMachine"
$Reg = "SYSTEM\ControlSet001\services\LanmanServer\Parameters\"
$Value = "srvcomment"
$Desc ="Guy’s Computer"
# Action part of script
Set-RegString -Hive $Hive -Key $Reg -Value $Value -Data $Desc

Note 2: You can suppress the ‘Confirm’ message by appending -Force

Note 3: No need to restart the computer, just close then open the Control Panel.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds’ Network Performance Monitor

PowerShell Task 2: To View Computer Descriptions on the Network

Problem: Starting with Vista, a computer’s description no longer shows in the Explorer or Network view. I cannot see why Microsoft just don’t add a column called ‘Description’, but they don’t, so this is my work-around.

Computer Description Net View

Solution: Net View Displays Computer DescriptionsComputer Description Net View
While you could run this old DOS command via cmd.exe, why not get into the habit of always going to PowerShell for any configuration task?

To see a list of network computer descriptions, just type:

Net View.

The result is that we should see the computer description that we changed in the registry. See screenshot above right.

PowerShell 3 script to Rename-Computer ยป

Summary Change Computer Description in Registry

There are two main tasks to this project, using PowerShell to set the Computer description in the registry, and also employing PowerShell to view the result on the network with: Net View.

If you like this page then please share it with your friends

 


See More Windows PowerShell Examples of Real-life Tasks

PowerShell Tutorials  • PowerShell Examples  • IpConfig  • Get-Counter  • PowerShell NetSh

Monitor Performance – PowerShell  • PowerShell temp   • PowerShell Delete Temporary files

PowerShell WOL (Wake-on-Lan)  • Services   • Change Computer Description Registry

Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.