Windows Updates – Error Code 66A, 645, …

June 17, 2018

If you encounter these errors doing updates :

Code 66A, 645, etc

image

It might just mean that your .NET evironment is corrupt ?

SOLUTION :

Open Control Panel, go to Programs and Features

Select Microsoft .NET Framework Client Profile

image

Select REPAIR, next reboot the server and install the Windows Updates again.

Errors should be gone …

Success !

Advertisements

Windows 2016 – RADIUS Server Config

June 11, 2018

We had to configure RADIUS authentication on multiple servers 2008r2 / 2012 and 2016

On some of the servers we had already Routing and Remote access service running.

When we opened the console it already showed RADIUS ..?

image

So we where under the impression that this was already installed as part of the Routing and Remote Access Service

But when trying to authenticate nothing was happening … Sad smile

After al long time trying to figure out what was wrong, we noticed this …. ?

image

Even if we could open and configure the RADIUS Client config, it was not installed or running …

image

SOLUTION :

Make sure the Network Policy Server is installed and running

clip_image002

You need to see the Service Running

clip_image002[5]

You will see NPS appearing in the Server Manager too afterwards

image

Windows 2012 / 2016 see here :

image

Check the NPS service is running :

image

No you are ready to configure the RADIUS client policy setup.

And test the the VPN access …

TIP : Don’t forget to give the AD user Access Permissions

image

Enjoy !


Windows Core IoT – ASP DotNet Core Razor Pages & SQLite & Web Service on a Raspberry PI3

May 28, 2018

Building a Web Server App using ASP .Net Core using a SQLite Database and a Web Service starts here using this example.

https://docs.microsoft.com/en-us/aspnet/core/data/ef-rp/intro?view=aspnetcore-2.1

I gave it a little twist in order to get it to use SQLite and add a Web Service to it.

This means you need to follow page 1 of 8 from this Tutorial.

But make the necessary change mentioned below.

Requirements are that you have Dotnet Core installed.

And have the DB using EF Tools installed from NuGet

Creating the  .Net Razor App

1. Create a new blank RAZOR project

Create a new folder in your PC and run the command to create a new RAZOR project

image

Command : dotnet New Razor

This will create a new blank Razor project

2. Install the DB using EF Tools

Go to Nuget and look for this package

image

I used the version 2.1.0-rc1-final

Run this command :

dotnet add package Microsoft.EntityFrameworkCore.Tools –version 2.1.0-rc1-final

3. Add more packages needed

dotnet add package Microsoft.EntityFrameworkCore.Tools.DotNet –version 2.1.0-preview1-final

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design –Version 2.0.0

dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Utils –Version 2.0.0

3. Add missing other packages

correct the project .Json package references

4. Add the missing code like to generate the DB

Or generate the code based on an existing DB using Scaffolding

Example : Create a Models folder. In the Models folder, create a class file named Student.cs

5. Create the xxxxContext DB context

In the Data folder create SchoolContext.cs

In Startup.cs add the missing references (Using xxx)

add the DB Context refence : services.AddEntityFrameworkSqlite().AddDbContext<SchoolContext>(); // Added

In the Data folder, create a new class file named DbInitializer.cs

6. Generate the View pages based on the model

Courses :

dotnet aspnet-codegenerator razorpage -m Course -dc SchoolContext -udl -outDir Pages\Courses –referenceScriptLibraries

Instructor :

dotnet aspnet-codegenerator razorpage -m Instructor -dc SchoolContext -udl -outDir Pages\Instructors –referenceScriptLibraries

7. Correct the ERRORS

When running the command in step 6 you will get ERRORS.

Globally change _context.Student to _context.Students (add an “s” to Student)

image

There are 7 occurrences found and updated. This is a bug and the hope to fix this bug in the next release.


=> TEST THE APP

8. BEFORE publishing add the following string in the program.cs and republish again.

UseURLs(“http://*:5000)

image

9. Publish for RPI3 – ARM

Run this command :

dotnet publish -r win8-arm

10. Copy from Publish to your RPI3

Copy the Files from the PUBLISH folder to your RPI3.

ASPRazor -> C:\CoreIoT\ASPRazor\bin\Debug\netcoreapp2.0\win8-arm\ASPRazor.dll

ASPRazor -> C:\CoreIoT\ASPRazor\bin\Debug\netcoreapp2.0\win8-arm\publish\

Next MAKE SURE your FOLDER STRUCTURE on the RPI3, is exactly the same as it was on your PC before Publishing.

Next COPY the SQLite Database to your RPI3. Because this is NOT included when publishing using DotNet Core to win8Arm

11. Test the .Net Razor App on your RPI3

Connect to PowerShell Remote to your RPI3 and start the app.

image

Let access the database ?

clip_image002

Let’s add some data ?

clip_image004

clip_image006

Haleluja, this is fully functional and cross platform !!

Since you now have an SQLite DB running your can feed it with your RPI3 SENSOR data and read it out using the Web J

Adding a Web Service to the .Net Razor App

Next I will add it to the site to see we can access the data using a web service API.

Again instead of using the full blown Visual Studio we will only use the command line options.

Because we don’t want to install an elephant weight of software !

image

Actually Visual Studio uses all these commands in the background too … Winking smile

Run this command :

dotnet aspnet-codegenerator controller -api -name StudentAPIController -m Student -dc SchoolContext -udl -outDir Models\API –referenceScriptLibraries -f

image

see the result

image

You also have the option to generate XML instead of JSON

image

Check the result !!

image

This is how you you select ID 5

ID = 5

clip_image002[5]

It contains GET / POST / PUT / DELETE methods !

Accessing the Web Service using PowerShell

image

CLS

$URL = "http://localhost:5000/api/StudentAPI"

$APIService = Invoke-RestMethod -Uri $URL

$APIService | select ID, lastName, firstMidName 

Enjoy !


Windows – Taskkill Error Access denied

May 17, 2018

Just a tip, sometimes when you run taskkill to kill a process you get the “access denied” Error.

Even if you run it with Admin privileges Sad smile

Example :

Taskkill /IM notepad.exe /T /F

SOLUTION :

Just use the WMIC cmdline tool instead Smile

wmic process where name=’notepad.exe’ delete

Enjoy !


Windows Core IoT – ASP DotNet Core Razor Pages on a Raspberry PI3

April 20, 2018

Continuing on based on my prior posts

.Net Core on RPI3

SQLite on RPI3

I am going to explain how to use Windows IoT and ASP .Net Core on a RPI3.

As of version 2.0 we now can create ASP Razor webpages in .NET Core.

Remember that in the past I made some post about Web Matrix

That is in fact the predecessor of ASP .Net Core. Read more here

How to use Razor Pages in ASP.NET Core 2.0

Start with installing the DotNet Core Template to begin with

Run command :

dotnet new Razor -n ASPnetCoreRazor -o C:\CoreIoT\ASPnetCoreRazor

image

Next Run the Template Application on your Windows PC.

Use command :

cd C:\CoreIoT\ASPnetCoreRazor

dotnet Run

image

Voila as simple as that Smile

image

Next Publish it for Windows IoT on a RPI3 Architecture

Run command :

dotnet publish -r win8-arm


image

Copy the files to your RPI3 from C:\CoreIoT\ASPnetCoreRazor\bin\Debug\netcoreapp2.0\win8-arm\publish

image


Connect to RPI3 using PowerShell remote session and start the ASPNetCoreRazor.exe Application

image

No connection … ? Sad smile

image

SOLUTION :

1. You need to open the Firewall Port 5000 on your RPI3 first.

Run command :

netsh advfirewall firewall add rule name=” ASPnetCoreRazor ” dir=in action=allow protocol=TCP localport=5000


image

2. Modify the Template Program.cs script

And add this line : .UseUrls(http://*:5000)


image

Publish again :

dotnet publish -r win8-arm

image

Copy the files back over to your RPI3 :

C:\CoreIoT\ASPnetCoreRazor\bin\Debug\netcoreapp2.0\win8-arm\publish\


Next connect to RPI3 using PowerShell and start the app ….

.\ASPnetCoreRazor.exe


image

Open the browser and go to : http://rpi3:5000

image

It runs as expected !! Smile

So now we know how to create RAZOR pages, the door is open to start experimenting with the RAZOR syntax.

As well as integrating SQLite database using the ASP .NetCore Razor Front End….

Enjoy !


MAPISendMail Error 26

April 6, 2018

Recently I ran into an Error 26 – MAPISendMail Failed

Using a Windows 10 Pro x64 and an Outlook 2010 installation.

This Error was triggered if an external Application (FormDesigner) was trying to send an Email using the users MAPI Profile in Outlook.

image

Solution :

1. Close Outlook

2. Locate folder :

x64 : C:\Program Files\Common Files\System\Msmapi\1033 or

x32 : C:\Program Files (x86)\Common Files\system\MSMAPI\1033

3. Rename MSMapi32.dll to MSMapi32.old

4. Open outlook again. Outlook will repair the file again.

5. Test it, the Email work again.

And the Error will be gone too Smile

Enjoy !


Windows – How to delete Device Drivers

March 28, 2018

 

At some point I had big issues removing drivers from a Windows system.

As you can see all the flagged drivers I needed to remove.

image

But after uninstalling they always came back automatically. Even if I did this in SAFE MODE … ?

Solution :

I used this PowerShell Script to find the incorrect drivers and remove them.

The cmdline utility used was PnPUtil.exe

image

image

CLS

$x = get-wmiobject Win32_PnpsignedDriver | where {$_.DeviceName -like "*Ncp*" -and $_.InfName -like "*oem*"}

foreach ($InfName in $x){
#$InfName

 pnputil -f -d $InfName.InfName

write-host "Deleted - " $InfName.InfName " "$InfName.Friendlyname

}

image

If this does not work you can used the this alternative

image

Make sure you check the DELETE driver software for this device option.

Next do a SCAN Hardware changes and it will install again properly.

More information on how to remove drivers you can find here : https://www.online-tech-tips.com/computer-tips/unable-delete-network-adapter-windows-10/

Enjoy !