Azekeil (azekeil) wrote,

  • Mood:

[Geek] F%^&ing Windows!

Contrast and compare:

Programmatically adding an email alias on Linux:
echo newalias: mylinuxaccount>> /etc/aliases

Programmatically adding an email alias to Exchange on Windows:
  1. Realise there's no simple file to edit. Figure out how to do it using Windows Powershell.
  2. 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.
  3. 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!
  4. 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.
  5. 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.
So, in pseudocode:
  1. Log in remotely and write commands to batch file.
  2. 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.
  3. 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.
  4. 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.

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.