But it's related to your job, and if your contract specifies that anything you write that is related to your job belongs to your employer, they own the automation script.
I was eventually fired from that job (I suspect my boss didn't like seeing me lean back and watch my scripts and macros run), and this never came up. I think the real value here is the skill and desire to automate these things, not the automation scripts themselves.