I have to update AD with home users number, etc. I've written the script and imported the usernames and phone numbers into Excel
Script:
dsquery user -samid "username" "OU=Sys,OU=Prod Services,DC=win,DC=ite,DC=com" | dsmod user -mobile "999" -hometel -u XXXXXX -p XXXXXXXXX
In Excel: A1 = Username B1 = Num
How do I get the above script working so it takes the usernames and numbers from Excel and puts them into a batch file?
Okay, this is definitely in the quick and dirty school of IT Engineering but we've all done it and, actually, Excel is mega handy for this. I do agree with @Pauska that Powershell and CSV's are the way forwards, though.
Anyway, the quickest and easiest way to do this (For a one off job, anyway) is to organise your excel sheet as follows:
And so on. Then, in column D, on Row 2 create a formula that uses concatenation to build your individual command line, ending with something along these lines:
You can then select that whole column, copy and paste it notepad and voila - a batch file which will do what you need.