Happy World Backup Day 🎉 from all of us at Kaseya! Join the Spanning team today at 2pm ET for tales of incredible IT heroics, explore new trends in the #BCDR landscape and play a round of backup trivia for some awesome prizes.

RSVP here: https://bit.ly/3YUS2JY

Rename Win PC

Kaseya Automation Team
Kaseya Automation Team Member, Kaseya Certified CHOCOLATE MILK
edited January 2022 in Solutions

Product Name: Rename Win PC

Description : This agent procedure will rename the agent’s hostname via a Powershell script.

It will prompt for the new hostname, username/password of a local admin, and whether you want to reboot or not. Once scheduled, it will create a Powershell script on the endpoint and rename it. The changes will not take effect until the endpoint is restarted.

Instructions : Please see attached PDF for Installation Instructions


  • Michael Persch
    edited November 2018

    Does anyone know if this may cause an issue for domain accounts? Typically if the PC name is changed on a Domain PC and you do not restart immediately, when the computer locks it cannot be unlocked by a domain account until after the computer has been restarted. Before a restart, any domain account will fail to sign in citing an issue with the domain trust relationship. I would like to deploy this script remotely whenever suites me best, but I don't want to run through a number of PCs and start receiving calls and tickets for people thinking they're locked out.

  • Jeremy  Graham
    Jeremy Graham Member
    edited September 2020

    @Michael... Did you test this? If so, was the rename successful? Any issues with domain computers? The same questions you asked, i too would like to know before i attempt to run this. 

  • Michael Kaplan
    edited March 2021

    I am trying to test this script now and it doesn't appear to be working.  The script is running, the PC reboots, but the name doesn't change.  The agent procedure logs say the script went fine.  I can't find anything in the Event Viewer that says if there was even an attempt to change the hostname.  Any ideas on how to troubleshoot this?

  • Dor Einy
    Dor Einy Member
    edited April 2021

    Michael Kaplan

    Same here

  • David
    David Member
    edited April 2021

    Quick fix, Line 11 is  running as user. Change it to run as system and it will work.

    When i was running the parts manually I noticed that as user it does not have elevation, and it needs it

  • Dor Einy
    Dor Einy Member
    edited May 2021
    Thank you very much, David.
  • Frank Walek
    Frank Walek Member
    edited May 2021

    This script is not working for me. I've been testing on a domain joined computer. The script runs, reboots, no name change.

    I applied the fix suggested by David, updated Line 11 to run as system. No name change. Does it not work with a domain joined computer?

  • Ben Gilbertson
    Ben Gilbertson Member CHOCOLATE MILK

    No, it does not work with Domain Joined machines. I am still trying to figure it out, has anyone else run across a working script

  • Carol Bailey
    Carol Bailey Member CHOCOLATE MILK

    Does Not Work : /

  • Emir Jadadic
    Emir Jadadic Member CHOCOLATE MILK

    Does not work. Can not import the file

  • Markus Malina
    Markus Malina Member CHOCOLATE MILK

    ScriptExport is now ScExport

    if you change in line 2 and last you can import

    As your own risk the modified script

  • Bruce Bilodeau
    Bruce Bilodeau Member, Managed Service Provider CHOCOLATE MILK

    It's a manual process but I have been using Live Connect - PowerShell and simply running this command:

    Rename-Computer - NewName "NEW NAME OF COMPUTER" - Restart

    if you don't want the computer to restart - eliminate -Restart