Which finds a user based on input, and logs them off the target RDS server. The issue im having is, whenever i run the script and enter a user, it just logs out whoever is running the script at that time! I think it isn't passing the $user variable and is just running the logoff command locally, which is far from ideal. But it seemed to break itself (it's code, so surely it can't) but that's what it seems like! Is there an error here that i'm blatantly missing? This script has ran successfully before, many times by the way!
Even if i can see what gets passed to $user, so i can confirm this, debugging is a skill i'm trying to get better at!
I figured that out in the end, shamefully took me longer than it should. It seemed to pass the captured variable, which is odd, because it should only send the logoff command to a user that matches $user, but in this case it seems to be ignoring it and just logging off the person running the script! 🙁