Setting Proxy settings in Powershell and .Net Windows Applications

There is a problem I have come across a number of times in my career that frustrates me. But I’m no closer to getting a full time barrista on tap to serve me coffee any time I need it. FML as the kids say..

There is also another problem, thats maybe more in line with my blogs so I suppose I should write about that instead!

A forward web proxy server, is a common piece of technology in most organizations where I’ve worked. It’s how we control the minions to ensure they only access the content on the internet we deem acceptable, monitor where they are going and how long they can browse a website etc.. Dance my puppets, muhahaha. I’m not going to argue the pros and cons of proxy servers, but needless to say they are prett standard.

What does bug me, is when business applications come along that say sorry our software doesn’t work through a proxy server… Oh nice one, you never though an application used by businesses may have a proxy server in the mix. Winner… Anyway, I’ve come across sites where there are holes open in the firewall for all manor of websites/ip address ranges etc. because its too hard and the easy out is to just poke a hole in the firewall and say “have at it!” Sure it’s a quick win, and gets you back on to more important things, like what the minions are browsing today. But it doesn’t cut the mustard for me (thats an odd saying, where on earth does that come from…quick google… nothing concrete.. oh well back to blog). Unbeknownst to a number of people, and even the “developers” that write these random third party desktop applications. There is a way to work with the proxy server in some scenarios using application settings.

This process has worked for me approximately 75% of the time, essentially it tells the application to use the proxy settings specified by the user. i.e. what has been configured in IE. I’ve tested it with IP, basic, and NTLM authentaction succesfully.

How to make windows desktop applications work with a proxy server

  • If it’s a modernish windows application. We can assume it has been built on the .NET Framework.
  • If you can search the internet using Internet Explorer via the proxy (that is, it has proxy settings specified somehwere), then thats another tick
  • Navigate to the program files directory. e.g. c:\program files (x86)\CrapVendor\CrapApp
  • Look for the executable (e.g. crapapp.exe)
  • An application settings file will typically have the same name as the executable but end in .config (e.g. crappapp.exe.config)
  • If one exists, great edit it
  • If one does not exist, then create a new file with that name (crapapp.exe.config)
  • Add the below settings

  • If the file already exists, then you may only need to add the defaultproxy line, just ensure its in the system.net tags
  • Save the file, and fingers crossed it now works
  • Job Done! Grab a coffee.

Cannot Cancel Meetings as the Organizer in Outlook

MFCMAPI - simple, self explanatory interface yeah?
MFCMAPI – simple, self explanatory interface yeah?

A strange issue was bought to my attention the other day where a user could not cancel a meeting they had created.

Looking in Outlook, they were listed as the organizer, yet when right clicking in Outlook the “Cancel Meeting” option was not present, only Delete. After ruling out PIBCAK, I dug a little deeper.

A search of google aluded to ActiveSync being the most likely cause of this issue. As we are running an IOS fleet using the native mail app which is ‘unsupported’ in Microsoft’s eyes. Then this may be where the problem lies. The user recently got married and changed her name, how inconsiderate of her not to think about the impact it caused me! It’s all about me you know 🙂 Anyway, to hedge my bets, the mail profile was recreated on their iDevices, an now to deal with the problematic calendar appointments.

No clear solution was online, but things were aluding to using MFCMAPI to get surgical under the hood on the users mail profile, so I rolled up my sleeves and got stuck in.

An hour later, after getting side tracked several times by stuff much more interesting than using the MFCMAPI tool (basically anything, yes even the Kardashiyans.) I found the field in particular causing an issue, made a change, and BOOM, the user can cancel all those problematic meetings to her hearts content. A win!

So.. Enough of the background.. Here is how it was done. Usual disclaimers apply #YMMV

First up grab the MFCMAPI tool from codeplex http://mfcmapi.codeplex.com/. This is a really useful tool for drilling into the details of a users mailbox, great way to mess things up too! If you’ve not used the tool before you are in for a treat, saying the layout is not userfriendly is an understatement..

So you’ve downloaded, run the exe and vomited at the shear complexity of it, give yourself a high five and perform the rest:

Oh.. Run the tool from the users computer as it needs to access their outlook profile…

  1. Close Outlook if it’s open (precaution)
  2. Click Session–>Logon
  3. Select the specific mail profile and click OK
  4. Double Click on the users Mailbox
  5. Expand Root –> Top of Information Store
  6. Double Click Calendar
  7. If you’ve got hear you’ve done well.
  8. In the top window find the dodgy meeting in question. I find sorting by the subject column useful
  9. Once found single clicl on it to highlight it
  10. In the windows below, sort by column “Named prop name”
  11. Look for id: 0x8217… (obvious yeah??)
  12. Double click this field
    If this unsigned decimal value is 3 it indicates the user is a recipient of the meeting. If it’s a 1 it indicates they are the meeting Organizer. Chances are if you have this problem its a 3, hence the wierd and wonderful bug
  13. Set this to 1 and click OK
  14. Close MFCMAPI
  15. Open Outlook and check out the problematic meeting
  16. The Cancel Meeting button should return!
  17. Job done, you are a hero

Hopefully this post is of some help to any poor soul whose stumbled across this part of the internet.