I’m looking for a way to use Tivoli to disable inactive users in AD/LDAP. I wrote a quick query to find them. It works just fine, the problem is that I need a way to disable the user accounts. Windows provides a CLI option to do this, via “net user %user% /active:no” The problem I’m running into is I’m just sure how to pipe these usernames into that command.
q: names of users whose (now - (last logon of it) > 30 * day)
Any ideas on how to do what I asked, or even a better way to handle this problem?
I’ve made some progress on this but I’m still not there. The following query works just like I want. It produces a list of each user that is old and outputs it in a format that is ready to execute…
q: (“net user " & name of it & " /active:no”) of users whose ((now - (last logon of it) > 30 * day) and name of it does not contain “$”)
A: net user user1 /active:no
A: net user user2 /active:no
So I then wanted to execute that… No luck…
wait cmd.exe {("net user " & name of it & " ") of users whose ((now - (last logon of it) > 30 * day) and name of it does not contain “$”)}
All that does it pipe everything into 1 line. I’ve tried appendfile as well, but it is putting everything together… Help, please
I’m still very stuck on this problem. As you can see from the QnA results, the query is fine. The problem I’m running into is that QnA produces different results than the actual clients. The clients process it all as 1 item and not as individual answers. So If I do anything with that query using actionscript it is processed as 1 command not N commands.
With that in mind, I got to thinking that I should process it via item numbers so that I can handle them 1 at a time. I failed with that and even if I could pick out just 1 user, I’d have no way of iterating through the results.
Then I started thinking, “Can’t I just output the relevance directly to a file?” So far, I haven’t figure that out. If this were a dos command then I could simple pipe hte output via the >> command. I’m so very lost on this, please help…
OK, so I solved my problem. It required two features, Carriage return/line feed and appendfile. Because of the way the relevance runs it spits everything out as one line. Trying to pipe the results directly into DOS was not working, the carriage returns were not being honored. Once I echoed the string out through appendfile, the carriage returns were being honored. It then resulted in the multiple lines that I required.
appendfile {(“net user " & name of it & " /active:no%0d%0a”) of users whose ((now - (last logon of it) > 30 * day) and name of it does not contain “$” and not account disabled flag of it)}