Renaming Computers with Casper

A while ago I wrote a script to go through and rename computers. You can check it out here. Since then, I’ve updated the script to do more things.

My company sets asset tags as the ultimate authority on a computer. This is used for various things, including binding to AD. We try to keep this information as correct as possible, but sometimes a computer checks into Casper with a generic name or is bound to AD with a generic name. This was either because the person doing setup was skipping a step or binding the computer to Active Directory failed.

I ended up doing a fair bit of research and realized I needed either: a. force user interaction to get the asset tag from the computer b. remote into every computer that has been affected c. work with tier 1 technicians to ensure computers are properly setup.

Item C got resolved through training and documentation. I think this was just techs forgetting a step or two. Item B isn’t practical as certain computers weren’t on network consistently. Item A was what I ended up going with.

Here is what that looked like:

  1. Create a smart group in Casper to identity which computers actually need to be renamed (I also plan to use this as part of a group to get computers rebound to active directory)

  2. Make a policy that does a few things to the computer:

    • Install CocoaDialogue on the computer.
    • Unbind the computer from AD
    • Run a script that asks the user for their asset tag. I put the script up on my Github repository here. Thanks to Jason Bush for the script idea here.
    • reset all of the computer names to what they should be
    • run recon on the computer which then updates the name in Casper.

Previously I would try to push the name change through Casper, but this wouldn’t stick 100% of the time.

  1. Create a smart group in Casper to detect unbound computers and rebind them.

Been watching the deploy of this script today… so far so good.