Changing Node Name on Pull Server via scheduled job on node

I’m onboarding my AWS instances to Azure Automation DSC. I have a userData script that runs at first launch, which updates the LCM with the relevant data for the pullserver and registers the node. This all works fine.


The same script also changes the local computername and reboots, but the node name never changes on the DSC pull server to the new name. If I rerun Set-DscLocalConfigurationManager, the new name is updated, but, it only works if I’m logged in and running it.

I’ve tried creating both a scheduled task and a scheduled job to update the LCM, and even though the task/job triggers, it doesn’t work. If I log in and trigger the job manually through the task scheduler, it works. On a schedule, nothing.

How can I accomplish this through a scheduled task? Or, is there another approach to getting the node name updated on the pull server that can run unattended, on demand?

Thanks for any help!

You kind of want to get the computer name changed before you install stuff. A lot of software cues on the computer name, and wonks out if you change it later.

Or, stop caring about the computer name. Have the computer register itself with some name abstraction (like DNS or a load balancer), so you can refer to it by whatever you want (e.g., CNAME), without knowing the underlying name. Cattle vs. pets. Pets have names. Cattle don’t. Servers should be cattle.