[Geek] F%^&ing Windows!
Feb. 7th, 2010 11:49 amContrast and compare:
Programmatically adding an email alias on Linux:
echo newalias: mylinuxaccount>> /etc/aliases
Programmatically adding an email alias to Exchange on Windows:
Now all I've got to do is wrap that all in a web interface to allow easy changing of email aliases...
Windows - despite improvements to allow scripting and the like, you still truly suck in terms of being easy and logical to understand and automate.
Programmatically adding an email alias on Linux:
echo newalias: mylinuxaccount>> /etc/aliases
Programmatically adding an email alias to Exchange on Windows:
- Realise there's no simple file to edit. Figure out how to do it using Windows Powershell.
- Put the commands in a file. For some reason it's refusing to run. Oh, scripts have to be signed now. Look through that faff. Realise that you can just tell Windows that it doesn't need scripts to be signed. Do that. It now runs.
- However, when you put the commands in a file, it doesn't work. Realise that you were using the Exchange powershell, but that's not available as a command. Finally manage to google that you need to load the Exchange add-in using a command in the script; now it works!
- Proceed to research a way to get the command to be run from Linux. Try various methods, but all seem to result in various dead-ends due to Windows new 'security' contexts, which despite the fact I've logged in fine, Exchange doesn't like the credentials I was using. Foiled.
- Through googling I realise I can run the task as a scheduled task, if I request it on demand! Win! I suppose I can output the results to a file (as scheduled tasks aren't interactive) and just pick them up afterwards. Ah, foiled, I can't pass arbitrary parameters to a scheduled task. Oh, win again - I can just run a batch file which runs another batch file I've created that contains the actual commands I want running (with parameters) and then collect the output from a file afterwards.
- Log in remotely and write commands to batch file.
- Run scheduled task on demand, which manages to run in the correct security context for the commands I want to perform, by running a batch file which calls my batch file I've just written with the commands in.
- This in turn runs a powershell script, which I've disabled the check for signed scripts on, which actually performs the addition of the alias within Exchange.
- The output of this all gets dumped into a file (because I'm running a scheduled task non-interactively), which my script reads and passes back to the calling Linux program.
Now all I've got to do is wrap that all in a web interface to allow easy changing of email aliases...
Windows - despite improvements to allow scripting and the like, you still truly suck in terms of being easy and logical to understand and automate.