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.
- Computer Description in Control Panel
- Task 1: To Change a Computer Description
- Task 2: To View Computer Descriptions on the Network
- PowerShell MaintainServerList
- Net View
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
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:
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’,
$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.
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.
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.
Solution: Net View Displays Computer Descriptions
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:
The result is that we should see the computer description that we changed in the registry. See screenshot above right.
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
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.