Kaseya Community

Rename Script for computers on a domain

  •  I have seen  several scripts on the forums about how to rename a computer, but I'm not having much luck with them.  Has anyone came across a effective way to rename computers that are joined to a domain and have different OS's?  


    I have been using  this to rename computers that are not on a domain and it works okay.

    <?xml version="1.0" encoding="utf-8"?>
    <ScriptExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2008/12/Scripting">
      <Procedure name="Renaming Computer Script" treePres="3" id="1248088213">
        <Body description="Renames computer name">
          <Statement description="Create a named procedure variable and assign a value retrieved from the managed machine by the agent." name="GetVariable" continueOnFail="false" osType="Windows">
            <Parameter xsi:type="EnumParameter" name="VariableType" value="Prompt" />
            <Parameter xsi:type="StringParameter" name="SourceContent" value="Enter Desired Computer Name" />
            <Parameter xsi:type="StringParameter" name="VariableName" value="nc" />
          <Statement description="Execute the given command as if it were typed in at a command prompt." name="ExecuteShellCommand" continueOnFail="false" osType="Windows">
            <Parameter xsi:type="StringParameter" name="Command" value="wmic.exe ComputerSystem Where Name=&quot;%COMPUTERNAME%&quot; Rename Name=&quot;#nc#&quot;" />
            <Parameter xsi:type="EnumParameter" name="ExecuteAccount" value="System" />
            <Parameter xsi:type="BooleanParameter" name="Is64Bit" value="True" />


    However, its wont work for computers on a domain and  I have tried using netdom but haven't had any luck with it.

    Any help would be greatly appreciated.


  • have tried this script also or variants of it and have always had issues.