I'm trying to run this simple statement to rename a machine though KACE:

wmic.exe  computersystem where caption='loanerssd7x64' rename ssdloaner7x64

The command works fine when I manually do it, but I can not get it to run through KACE properly.  Any ideas on what I can do here?


Answer Summary:
0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer



You are doing one or two things wrong.

first the syntax is " qoutes around the parameters and ' quotes around the items.

this is becuase you can use multiple operators and then wmi knows the rules.

as an example: where "name like 'Java 6%%' or name like 'Java 7%%' and name != 'Java 7 Update 51'"

so you want to use this in your script:

/c wmic.exe  computersystem where "caption='loanerssd7x64'" rename ssdloaner7x64

and the second mistake you may be making is if the machine is in a domain you must use credentials that have domain rights to rename a machine object.


Answered 04/11/2014 by: SMal.tmcc
Red Belt

  • I gave that a go to, but still not getting the object change.

    Output Log
    Running as: andrew.shirkey
    Launched Process: CMD.EXE
    Activity Log
    Launching program: 'C:\Windows\System32\CMD.EXE' '/c wmic.exe computersystem where "caption='loanerssd7x64" rename ssdloaner7x64' wait='false'
    • I ran the above script on my machine, it failed the first time since it ran as system and the machine is in the domain. As soon as I used domain credentials in the run as it worked.
      • also you do not have the closing single quote after loanerssd7x64. I only see the double, you need both '"
      • oh I see what you did, you put the single quote close after the rename, it needs to be after the where statement.
        /c wmic.exe computersystem where "caption='loanerssd7x64'" rename ssdloaner7x64
  • Thanks! I have successfully been able to do it through KACE.
Please log in to comment
Answer this question or Comment on this question for clarity



Since WMIC is a command line utility, you may need to execute it using CMD /C, rather than trying to execute WMIC.EXE directly. Something like this:


Answered 04/10/2014 by: BHC-Austin
Fourth Degree Black Belt

  • I tried exactly like you mentioned. With quotes around the statement and without, but the machine name still stays the same after reboot.

    Activity Log
    Launching program: 'C:\Windows\System32\CMD.EXE' '/c wmic.exe computersystem where caption='loanerssd7x64' rename ssdloaner7x64' wait='false'
    • that's very odd... I wonder if WMIC doesn't like running from the SYSTEM account. Have you tried setting to run as a specific user?
      • Just tried it in this configuration using the local administrator account. Still not taking the name change:

        Launching program: 'C:\Windows\System32\CMD.EXE' '/c wmic.exe computersystem where caption='loanerssd7x64' rename ssdloaner7x64' wait='false'
      • The only other suggestion I can think of would be to put the WMIC command in a batch file
      • Bah, appears running as a batch file doesn't work either. Was able to redirect some logs and appears the issue is that it isn't being ran in an elevated prompt. :(

        Do you know anyway around that?
      • Shouldn't be an issue if it's running from either the SYSTEM account or local admin. It could be a UAC issue. We had to set UAC policies:
        - User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode = Elevate w/o Prompting
        - User Account Control: Run all administrators in Admin Approval Mode = Enabled
      • I'll change the UAC settings on this one machine and try again. Thanks for all the insight.
      • Just to give you an update. Manipulating the UAC settings to your suggestions didn't give a positive result with the script
Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja