Windows Server 2016 – Application Errors after a P2V conversion Event ID 1000 Error

October 30, 2018

After converting a Physical server to a VM, I got a lot of Application Errors 1000.

Looking at the details it was relating to, amongst others, HP related drivers and software

Example : This error shows it is trying to reach a Tape device which is not present in a VM…

image

SOLUTION :

First uninstall all hardware drivers that are not needed in the new VM.

1. Open CMD with admin privileges and run this command

set devmgr_show_nonpresent_devices=1

2. Next run this command

devmgmt.msc

And go to VIEW, select SHOW HIDDEN DEVICES

image


3. Make backup of your VM

Before going to next step MAKE SURE you have a good backup of the current SYSTEM STATE

4. Expanded list

Look at all the GREYED out devices and UNINSTALL these Software and Drives

image

5. Uninstall COM Objects

From the Event Viewer Error I could see we where dealing with a COM related DLL

Use WBEMTest.exe to investigate if the COM Object is still in use.

image

In my case I was sure it would not be needed since the HW was not available anymore

Look for the COM DLL : HPWMITape.dll


image

Run the uninstall command :

regsvr32 /u HPWMITape.dll

Enjoy !

Advertisements

PowerShell – Using PoSH SSH Module to shutdown a Synology NAS

October 29, 2018

 

Shutting down a Synology NAS has to be done using an SSH client. And using ROOT access.

SOLUTION :

This is how this is done using the famous PuTTY SSH client

Connect to your NAS

image

Once connected make sure you change to ROOT Access

This is done using this command :

sudo -i

image

Next enter : Poweroff

Of  course you can use Powershell to obtain the same result using the PoSH-SSH module.

See here for more info :

https://audministrator.wordpress.com/2017/10/21/powershell-using-posh-ssh-module-to-access-synology-nas/

Keep in mind that in order to run ‘sudo’ commands you need to use “Invoke-SSHStreamExpectSecureAction” command.

CLS

New-SSHSession -ComputerName NAS_IPAddress -Port ** -Credential (Get-Credential)
$stream = New-SSHShellStream -Index 0
Invoke-SSHStreamExpectSecureAction -ShellStream $stream -Command 'sudo -i' -ExpectString 'Password:' -SecureAction (read-host -AsSecureString) -Verbose
$stream.Read()

Enjoy !


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!


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 10 – Quickly connect to a VPN

October 12, 2018

In Windows 10 it is a pain to quickly select a VPN connection. Especially when you have a long list of entries in there.

On top of the sort order does not always stay the same Sad smile

And most frustrating is, is that it is very slow…

SOLUTION :

Windows 7 and Up has a build in little tool called RASPHONE.exe

It is located in the System32 directory :

image

When you run it, it will quickly list all the entries to select from and connect to your relevant VPN server.

image

Once selected you can connect or change the properties …

image

All Windows VPN entries are automatically stored in your rasphone.pbk file located in the %Appdata\Microsoft\Network\Connections\Pbk folder

This little built in tool is lightning fast compared to the Windows 10 network settings…

 

TIP :

1. Pin this Tool to your taskbar and you are ready to go ! Smile

2. Here is an other freeware tool that can help you automatically reconnect when the connection drops

https://vpnmyway.wordpress.com/

 

Enjoy!


Windows 10 – SkypeForBusiness no micro sound

October 5, 2018

After Updating to the latest Windows 10 build, I did not have any sound going out using the built in Microphone of the laptop ?

First I thought I had to update the audio driver to the latest version…

 

So I did but no success Sad smile

 

SOLUTION :

I decided to use the Voice Recorder to test the sound

image

But there was a message saying that I had a Mic issue and needed to allow this audio first.

 

Go to Microphone Settings :

 

image

This will open the Microphone settings panel

 

image

Now make sure Skype is selected as allowed Microphone sound.

clip_image002

 

Solved Smile