ldapsearch to get all SMTP email addresses

Cooked this up in a few minutes.  Should return all proxyAddress that are SMTP and all SMTP default addresses for all users not disabled in a specified Organizational Unit.

ldapsearch -x -h ldapserver.example.com -b ou=Users,ou=example,dc=example,dc=com -D exampleldapadmin -w s3cr3t '(& (objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))' | grep -i ^mail|^proxyAddresses: SMTP: | grep -v mailNickname | sed 's/mail: //' | sed -e 's/proxyAddresses: SMTP://gI' | sed 's!$! OK!' | uniq >> $VALID

Lenovo Yoga 2 Pro Screen Flickering

I own a nice sleek Lenovo Yoga 2 Pro tablet/laptop device. One annoyance is the screen flickers when on Battery.

I read on a few forums to go in and disable Auto Adjustment in the advanced power settings for the power plan that is active but that didn’t fully resolve it, I could still notice the backlight flicker.

The solution is to do the above mentioned PLUS go into the Intel Graphics options and disable their option for power saving technology on the graphics card.

Untitled2

Untitled3

Office.com Online using WinForms

This isn’t true API access, just a WebBrowser control. I’m looking into the API though which would require me to register my Application even though it’s not a Windows App.

It has a launcher (I haven’t decided exactly how I’ll integrate this) that will launch the Microsoft Office Online services at the click of a button.

As you can see, you can still access the Navigation provided by Microsoft. I fixed the Winform so it doesn’t launch a new window and keeps everything inside the Winform on the WebBrowser control.

I guess I see this side project being useful for someone who wants to use the free Office.com Online services with their Microsoft account and don’t want the full browser experience.

2014-08-08_141453

2014-08-08_141506

2014-08-08_141519

2014-08-08_141525

Some notes to get this to render properly in the WebBrowser control.

I had to force a User Agent to indicate I was using IE11. I think what I was seeing was that the WebBrowser control was defaulting to MSIE7. Made things look like crap.

VB.NET Code for this:

Private Property uag As String = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"
     _
    Private Shared Function UrlMkSetSessionOption(ByVal dwOption As Integer, ByVal pBuffer As String, ByVal dwBufferLength As Integer, ByVal dwReserved As Integer) As Integer
    End Function
    Const URLMON_OPTION_USERAGENT As Integer = &H10000001
    Public Function ChangeUserAgent(ByVal Agent As String)
        UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, Agent, Agent.Length, 0)
    End Function

I implemented forcing new windows to the WebBrowser control in the Winform. If you use the top navigation at all, it opened the service in a new Internet Explorer Window.

VB.NET Code for this:

    Private Sub Webbrowser1_NewWindow(sender As Object, e As CancelEventArgs) Handles WebBrowser1.NewWindow
        WebBrowser1.Navigate(WebBrowser1.StatusText)
        e.Cancel = True
    End Sub

Originally, I wanted to just wrap this in a HTA or something simple… but I got errors indicated that I couldn’t pull this in an iFrame. So I tried some Ajax/jQuery stuff in HTA and that was a complete fail (I’m not familiar with ajax/jquery things).

Change User-Agent in WebBrowser Control

This snippet of code worked when tested in VB.NET application I’m working on. It will set the User Agent string for the duration of the control.

Private Property uag As String = Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
     _
    Private Shared Function UrlMkSetSessionOption(ByVal dwOption As Integer, ByVal pBuffer As String, ByVal dwBufferLength As Integer, ByVal dwReserved As Integer) As Integer
    End Function
    Const URLMON_OPTION_USERAGENT As Integer = &H10000001
    Public Function ChangeUserAgent(ByVal Agent As String)
        UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, Agent, Agent.Length, 0)
    End Function