Scripting Question

Update computer description to service tag

05/05/2015 2725 views
Hey guys

I need your help.
I want to create a vbscript or similar to be able to update computer descriptions for selected computers with the service tag. 
I have been searching around for a solution, and the only one I have found is a logon script through the AD: https://4sysops.com/archives/automatically-fill-the-computer-description-field-in-active-directory/#comment-291126

As I really want to be able to do it through KACE, for different reasons, I really hope some of you can help me :-)

0 Comments   [ + ] Show comments


Community Chosen Answer

You can set computer description with this command run as an administrator in a Kscript:

net config server /srvcomment:"your_computer_description"

You can return the service tag using: wmic bios get serialnumber

If you wanted to script it further outside of the K1000 to pull the service tag, I'd start here: http://blogs.technet.com/b/heyscriptingguy/archive/2005/12/07/how-can-i-change-the-description-for-a-computer.aspx

Here's an older ITNinja article that might be helpful also: http://www.itninja.com/question/how-to-change-computer-name-computer-description-using-k1000

Answered 05/08/2015 by: jknox
Red Belt

All Answers

I know this is an old post but I use this one to set the local computer description to the Service tag and model # of the PC. Remove name in the wmic command if you just want the service tag

@echo off
SetLocal EnableDelayedExpansion
set count=0
for /F "delims=," %%a in ('"wmic csproduct get identifyingnumber,Name"')do (
  set compdesc=%%a
  set /a count=!count! + 1
  if !count! GTR 1 goto rename
net config server /srvcomment:"Service Tag: %compdesc%"
Answered 02/12/2016 by: johnbodden
Senior White Belt

  • Hey John. I fixed it myself with a batch file:

    REM set variables
    set serialnumber=

    REM Get Computer Serial Number
    FOR /F "tokens=2 delims='='" %%A in ('wmic Bios Get SerialNumber /value') do SET serialnumber=%%A

    @reg add HKLM\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters /v srvcomment /t reg_sz /d #"%serialnumber%" /f

    goto END

    echo Error...Invalid Operating System...
    echo Error...No actions were made...
    goto END

You can do it with a batch file, however, just like the manual method of changing the name of a computer; a reboot will be required afterwards.

set PC=ch-newcomputername
wmic path win32_computersystem where "Name='%computername%'" CALL rename name='%PC%'
Answered 05/06/2015 by: FSU Facilities
Yellow Belt

  • Thanks! What about computer description?
What about the computer description?
Answered 05/06/2015 by: HQgeN
Senior White Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ