Change computer name using wmic

I don’t know if you know, but there is a command line interface (CLI) for WMI and it’s called WMIC! It’s pretty powerful stuff. You don’t need to write VB scripts for theese tasks, just do it in the command line. As usual when such stuff is available from the command line readability suffers (at least I think so).

Wmic installes it self the first time you try to run it. You can either write ”wmic” in the prompt and get warped into it’s own prompt.

C:\> wmic
wmic:root\cli>

Or you can run it from the dos-prompt just writing ”wmic” first in every command (nice for batch files and such). So, a simple example:

wmic:root\cli> COMPUTERSYSTEM Get Name
Name
COMPNAME

That is not very advanced is it, so let’s try renaming our computer.

wmic:root\cli> COMPUTERSYSTEM CALL Rename NEWNAME, Password, User

Should be that simple, but that returns a parameter error. After a quite a lot of trial and error I figured it out.

wmic:root\cli> COMPUTERSYSTEM where ”Name=’COMPNAME'” CALL Rename NEWNAME, Password, User

And a reboot to finish it of!

7 thoughts on “Change computer name using wmic

  1. exactly!!

    when You want to change computer name with using wmic You must specify ‘where’ condition!

    You can use simple command line to(without entering to the wmic console), like:
    ——
    wmic path win32_computersystem where ”Name=’%computername%'” CALL rename name=’NewCompName’
    ——

    where %computername% is Your current computer name, and You don’t must to change it.

    And something more… with wmic You can change You workgroup to! Try it:
    ——
    wmic path win32_computersystem where ”Name=’%computername%'” CALL joindomainorworkgroup name=’NewNameOfWorkgroup’
    ——

    Enjoy, and have fun! 😉
    BR
    KOtzU!

  2. wmic path win32_computersystem where ”Name=’%computername%'” CALL JoinDomainOrWorkgroup name=”NewNameOfWorkgroup”

    That WORKS 😀

  3. ”thanx, this command i serch 2 year”
    Then you must be a really dumb searcher!

  4. that last comment cracked me up lol 🙂 quite easy to find if you google ‘change machine name command line workgroup’.

    good post though – works a treat, cheers.

Comments are closed.