First, If it's an option, I'd strongly suggest you to move to Powershell. It's a bit hard to learn an migrate, but it pays off.
As to the matter at hand, what are you trying to achieve? it sounds like you're trying to create mandatory profiles by hand...
Anyway, 1. you can either "ping" the user's session, or 2. attach the cleaning task to the user's logoff.
If you want to check repeatedly if a user is logged on, you can use the script you already have inside a loop, until you get an empty result (meaning there's no user logged-on).
If you want to attach it to the logoff event, you can using the event viewer of some group policy, but I think it would be a bad idea - it'll somewhat complicate things and you'll have less control (comparing to the previous solution).