Windows 10 – DotNet Development NO Visual Studio

October 16, 2018

Recently I needed to develop an VPN Builder for Windows 7 for the L2TP protocol.

To automate the VPN entries on the client and to hide the Private Shared Key for the user.

 

PowerShell can do this…  But does not support the cmdlet Add-VpnConnection onWindows 7

It is only available for Windows 10 Sad smile

 

SOLUTION :

1. Download the DotRas Library from the Nuget site

https://www.nuget.org/packages/DotRas.for.Win7/

image

Tip : Winking smile

When you have saved the .nupkg package you can just open this using 7-Zip

image

Extract the nice documentation file DotRas.chm that is included.

image

And extract the DotRas.dll (for your appropriate .Net version 2.0 or 4.0)

In my case I used the DotNet 2.0 version

 

2. VB.Net Source code

On the net you can find relevant source code to build your application for L2TP, if you want to have a head start.

https://blog.cjwdev.co.uk/2011/05/19/automate-creation-of-an-l2tp-vpn-with-pre-shared-key-and-automatically-use-windows-credentials/

And modify to your own needs ….

 

3. Compile your application

You can use the commandline compiler VBC.exe that is part of your local DotNet installation on any Windows machine.

Or you can use my Visual Studio Light wrapper  Smile

 

%systemroot%\Microsoft.NET\Framework\v2.0.50727\vbc.exe /nowarn /nologo /quiet /debug- /t:Winexe VPN_L2TP_Builder.vb /r:DotRas.dll -out:VPN_L2TP_Builder.exe -win32resource:VPN.res

 

As you can see I needed to reference the DotRas.dll Assembly and I used the custom Resources to assing a custom ICON and File Properties.

See here on how to build a custom Resource file using Resource Hacker

 

4. Result

image

 

As you can see we don’t need 10 ton of software, just to build a simple functional DotNet Application Smile

 

Some extra tips for L2TP errors here  Winking smile

 

TIP : 

To avoid an “appcrash” you need to make sure that you compile it on the same OS as where the .EXE is going to be used !

In this case it is Windows 7 !

 

Enjoy!

Advertisements

Resource Hacker – Update File Icon & Resource Data

October 15, 2018

As you might know by know I am not a big fan of installing 10 ton of software to get my simple things done.

One of them is adding file versioning or file Icons to my custom build .Net applications.

For which I use my also my custom build vbc.net or csc.net wrapper for Visual Studio

If you need to add you custom ICON and or VERSIONING

You can use some vbc.net compiler options, see here for the full list vbc compiler or  csc compiler options.

SOLUTION :

Download Resource hacker

I still use an old Version 3.4, which still runs fine.

image

1. Open your compile .exe file

image

2. Add or Replace Icons

Right click the 0 in the ICON section and Select Replace

image

3. Add or Replace File Properties

Select 0 in the Version Info section

image

Modify the File Property Values according to you needs. And click on the COMPILE button.

Next save this as a RESOURCE file.

image

For Example : My.res

Once this is done you can pick the settings up when compiling your VB or C# application, using this compiler option :

-win32resource

Example : –win32resource:My.res

See here in a real life example

 

Enjoy !


Windows Server 2016 – Perflib Error Event ID 1008

August 20, 2018

Some servers make notice of regular Perflib Event ID 1008 Error

image

image

SOLUTION :

Run these commands

C:\Windows\system32\lodctr.exe /R

C:\Windows\SysWOW64\lodctr.exe /R

C:\Windows\System32\wbem\winmgmt.exe /RESYNCPERF

C:\Windows\SysWOW64\wbem\winmgmt.exe /RESYNCPERF


image

After these commands you might see the Warning Event ID 2003

image

image

Run this command :

lodctr /T:TermService

And reboot the server to make sure all errors are gone

More info see here :

https://www.admin-enclave.com/en/articles/windows/306-resolved-the-open-procedure-for-service-bits-in-dll-c-windows-system32-bitsperf-dll-failed-performance-data-for-this-service-will-not-be-available-the-first-four-bytes-dword-of-the-data-section-contains-the-error-code.html

Success !


Xperia Z3 Compact GPS Not Working

May 2, 2017

We encountered a Sony Mobile where the GPS was not working suddenly ?

So I was thinking that a recent software update was the root cause…

Next I went on the Forum to see if there are where more issues like that… and indeed quite a lot found Confused smile

Solution :

Go into service mode by just dialing : *#*#7378423#*#* and then into Service Tests, GPS, Purge

See steps described on the Forum GPS not working,

image

But still it did not work ! Sad smile

This simple setting fixed it !

Go to Location Settings :

Go to MODE and change to HIGH ACCURARY

image

image

Problem Fixed… Smile


Windows Core IoT – Accessing a DotNet DLL assembly on a Raspberry PI3 using Windows Core IoT

January 23, 2017

In this post I showed how to create an Console app using my Visual Studio Light for ARM, to run on a Raspberry PI3 on Windows Core IoT.

Taking it one step further is that you access an DotNet Assembly that was created before, and seem to run as well on X86 as on ARM Smile

So most Assembly DLL’s seem to be architecture independend …

 

image

 

Let’s see here :

Using ILSpy you can see the source of the self made .NET Assembly.

image

 

image

I copied the DLL Assembly to the RPI3, did a remote access from PS IDE and ran the following code.

image

 

As you can see it ran without any issues ! the result was returned as expected … Smile

Enjoy !


Fiddler – How to capture non Web Browser traffic

March 21, 2016

I had a need to debug an external app using fiddler.

Seems to be a trivial exercise, but I could not see the captured traffic in fiddler ?

After Googling a bit, I could only find part of the solution.

Below is the full story.

Solution :

1. Proxy Settings : First of all you need to know that Fiddler acts as a proxy server on your machine when you start it.

The default address / port is 127.0.0.1:8888

You can check the settings after starting Fiddler in you Browser settings.

image

So you need to set the proxy settings in your local application that you want to test.

2. Decrypt HTTPS settings

Make sure you have set to Decrypt HTTPS

image

image

This needs a extra extension to Fiddler (which is not installed by default)

3. Capture all Processes

After that you need to make sure that you tell Fiddler to capture all traffic for all Processes.

image

This last step I overlooked for a few hours before my eyes caught the option menu at the bottom.

Enjoy Winking smile


WordPress – 2015 blog review

December 31, 2015

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 24,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 9 sold-out performances for that many people to see it.

Click here to see the complete report.