AutoIT – Meets .NET Common Language Runtime (CLR) Framework

April 27, 2017

CLR : The Common Language Runtime (CLR) is a an Execution Environment .

Common Language Runtime (CLR)’s main tasks are to convert the .NET Managed Code to native code, manage running code like a Virtual Machine, and also controls the interaction with the Operating System.

As part of Microsoft’s .NET Framework, the Common Language Runtime (CLR) is managing the execution of programs written in any of several supported languages.

Allowing them to share common object-oriented classes written in any of the languages.

 

Appdomain : To access the CLR environment you need to create an Appdomain Object.

An AppDomain provides an isolated region in which code runs inside of an existing process.

Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies.

Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run.

 

CLR Runtime Hosts : When would you use CLR Runtime Hosts.

1. To access .NET Class Libraries :

  • System
  • System.Collections
  • System.Data
  • System.Drawing
  • System.IO
  • System.Text
  • System.Threading
  • System.Timers
  • System.Web
  • System.Web.Services
  • System.Windows.Forms
  • System.Xml

2. Accessing custom build .Net Assemblies :

Some Examples (but there are a ton out there)

  • AutoItX3 – The .NET Assembly for using AutoItX
  • JSonToXML libr.
  • XMLRPC Libr.
  • .NETPDF libr.
  • .NETOCR Libr
  • WInSCP Libr.

    3. To Compile .Net Code into an Assembly at Runtime

    4. To Run C# or VB.net Code at Runtime

    5. To Mix AU3 and .Net functionality in your Application

 

Documentation : Where to find info about CLR hosting

First of all you can find a lot on MSDN relating to .Net CLR Hosting and of course here :

AutoIt .NET CLR Framework

 

Examples : All examples are included in the above thread of the AutoIt forum.

1. To access .NET Class Libraries :

Example : “System.Text.UTF8Encoding”

image

Example : “System.IO.FileInfo”

image

Example : “System.Windows.Forms”

image

 

2. Accessing custom build .Net Assemblies :

Example : AutoItX3 .NET Assembly using AutoItX

image

 

3. To Compile .Net Code into an Assembly at Runtime

Example : Compile Code C# and Code VB

image

 

4. To Run C# or VB.net Code at Runtime

Example : Compile Code C# at Runtime

image

 

5. To Mix AU3 and .Net functionality in your Application

All of the above Examples have a mix of au3 functionality and .Net CLR code

 

This CLR.au3 UDF makes a bridge between .Net and Au3, which give a new dimension to our scripting experience.

Enjoy !

Advertisements

Windows – Active Directory – List applied Security Policies

April 27, 2017

Sometimes you need to get a clear view on which Security Policy is applied to a Users or other AD Object.

There are 2 Tools you can use :

1. Resultant set of Policies Snap-In

Run rsop.msc

clip_image002[4]

clip_image002[6]

clip_image006

clip_image002[8]

So as you can see on this AD User Object there are 3 GPO’s applied.

Which is important to know for Debugging Security Issues.

2. Command line version :

Run gpresult /Scope User /v

image

Enjoy !


Windows 2016 – DHCP server Name wrong

April 27, 2017

After migrating the DHCP server from one to the other I got a strange Server Name appearing in the DHCP Management Console ?

image

It just showed an IP address instead of the Server Name ?Confused smile

SOLUTION :

1. Close the DHCP Management snap-in

2. Go the Networks Adapters

image

Disable any Adapter you are not using !

image

Open the DHCP snap-in again, and you will see the problem is fixed.

You can enable the Adapter afterwards again no problem this settings will remain…

Enjoy!


Windows 10 – System Restore Error 0x80070091

April 24, 2017

When you encounter a Windows 10 System Restore Error 0x80070091

image

This is the work around to fix it :

1. Boot into safe mode.

2. Right click on the start button, left click on Command Prompt (Admin) Window will appear with a Command Prompt ending with >

3. takeown /f “C:\Program Files\WindowsApps”
/r /d Y

Press Enter. Wait for it to finish and go back to Command Prompt>

4. icacls “C:\Program Files\WindowsApps”
/grant “%USERDOMAIN%\%USERNAME%”:(F) /t

Press Enter. You will get a message:  Successfully processed xxxxx files: Failed to process 0 files

5. rd /s “C:\Program Files\Windows Apps”

Press Enter. It will ask you to confirm.  Yes. This will delete
the folder.

6. Now Reboot your computer and System Restore should work.

More Fix Options you can find here :

http://borncity.com/win/2017/02/22/windows10-version-1607-system-restore-error-0x80070091/


Windows 2016 – Prompts for a restart when adding Roles and Features

April 6, 2017

I wanted to install RAS VPN to the server but it failed all the time ?

image

Every time it asked to restart and ended up in the same circle….

“The operation cannot be completed, because the server that you specified requires a restart.”

image

Restarting the server provides no solution.

SOLUTION :

The solution is to grant the ‘log on as a service’ right to some addition built in accounts.

Start the Group Policy Management Console Open the Default Domain Controllers Policy or your specific server management policy.

Open the Computer Configuration –> Policies –> Windows Settings –> Security Settings –> Local Policies –> User Rights Assignment branch

And then double click the ‘Log on as a service’ setting. Add the IIS_WPG, NETWORK, NETWORK SERVICE, and SERVICE accounts (via the Browse option).

Once these settings have been applied the server needs to update to the current Group Policy version. On the server command line you can type

gpupdate /force

 

image

If this does not work best check the events :

For some services you will see these errors

image

So you need add one extra … to the GPO : Solution here

NT SERVICE\ALL SERVICES

Once updated the installation should progress smoothly.

Enjoy !


Windows 10 – How to change the Library position in the File Explorer

April 6, 2017

One of the most enervating things I ran into in Windows 10 compare to prior versions, was the position of where the Libraries was in the Windows File Explorer

Before it was on top above “This PC”, now you find in at the bottom Sad smile

image

This makes you click and scroll like hell !

SOLUTION :

Open REGET and go for HKEY_CLASSES_ROOT\CLSID\{031E4825-7B94-4dc3-B131-E946B44C8DD5}

image

Change the SORT ORDER form 84 Decimal to 56 RegKey

SortOrderIndex DWORD

54 (hex) = Below This PC
42 (hex) = Above This PC

image

More Tips  here :

http://www.winhelponline.com/blog/add-custom-folder-this-pc-navigation-pane-windows/

https://www.askvg.com/windows-10-tip-remove-onedrive-quick-access-homegroup-and-network-icons-from-navigation-pane-of-this-pc/

Enjoy !


Windows – Task Scheduler Fails With Error Code 2147943785

April 5, 2017

This is usually due to a permissions issue.

It’s due to the user that is running the scheduled task not having the Log On As Batch Job assignment.

To fix it, have your Network Administrator go to Start Menu > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment > Log On As Batch Job as seen below:

image

 

If you are on a domain controller you need to do this on the GROUP POLICY

image

Don’t forget to update the policy using GPUPDATE /Force

image

 

But if this still does not work Sad smile

SOLUTION :

Make sure you use the SYSTEM Account to schedule the job.

image

Enjoy !