PowerShell – Using PoSH SSH Module to access Synology NAS

October 21, 2017

You can now access any SSH device using the PoSH SSH module.

Let’s give it a try using a Synology NAS Device.

Make sure that you enable the SSH Access Service


Next make sure you have installed the PoSH-SSH module

Find-Module Posh-SSH


Next install it using this command (run as Administrator) :

Find-Module Posh-SSH | Install-Module

After installing you can check the commands available

Get-Command -Module Posh-SSH


Now you are ready to make a connection Smile

New-SSHSession -ComputerName YourNASDeviceNAME


You can check the session info like this

Get-SSHTrustedHost | fl


Let’s run some commands

Invoke-SSHCommand -SessionId 0 -Command "ls -all" | select-Object output -expandproperty output | fl


Or using this format :

$result = Invoke-SSHCommand -Index 0 -Command "uname -a; cd /; pwd; ls /volume1" 


$result = Invoke-SSHCommand -Index 0 -Command "uname -a" 


To stop the session use this command :

Remove-SSHSession -Index 0 -Verbose


Enjoy !!


PowerShell – Database Choise SQLite vs SQLCE

October 12, 2017


Over time I wrote some posts relating to SQLCE as a nice standalone Database platform that can by used in PowerShell or Webmatrix on IIS etc.

Now that MS has announced the end of life of Webmatrix Sad smile

“WebMatrix product support ends on November 1st, 2017”

As Webmatrix runs on MSSQLCE we need to look for alternatives…

“MS SQLCE support will end in July 2021”

One of the most obvious alternative is of course SQLite, which is shipped as part of AutoIT Winking smile


Besides this, SQLite has much more to offer then SQLCE :

Comparison http://erikej.blogspot.be/2011/01/comparison-of-sql-server-compact-4-and.html


As you can see the size limit is 140 TB and unlimited concurrent users !

And it runs on Windows / Linux / Mac … and as well on Mobile devices.

So this will do for a while … Winking smile



1. Download the appropriate .NET Assembly for your environment


2. Run this PS code :

Add-Type -Path "C:\Temp\.NET SQLite Library\System.Data.SQLite.dll" 

$con = New-Object -TypeName System.Data.SQLite.SQLiteConnection
$con.ConnectionString = "Data Source=C:\Temp\.NET SQLite Library\northwindEF.db"


$sql = $con.CreateCommand()
$sql.CommandText = "SELECT * FROM Customers"
$adapter = New-Object -TypeName System.Data.SQLite.SQLiteDataAdapter $sql
$data = New-Object System.Data.DataSet


"Rows # :  " + $data.tables.rows.count
$data.tables.rows | Out-GridView # | ft

3. Test it.

Once you run it you can access the SQLite Database lightning fast …




Some more Tips and Tools you can find here :



Enjoy !

Windows – Server 2012r2 cannot install .Net Framework 3 / 3.5

September 21, 2017

This error when you try to install Microsoft .Net Framework 3 or 3.5 on a server running Windows Server 20012 R2.

Using Windows Server 2012 RC from the VHD, and selecting the .NET Framework 3.5 Feature, gives error message “The source files could not be found”


This issue continues even if you manually download the application and try to install it.

Solution :

To solve this issue, you need to install the .Net 3.5 framework from the Windows 2012 R2 installation DVD. The files are located on “Source\sxs”.

Note: To improve the speed you can copy the files from the DVD to any folder on the server.

For this example, the files were copy to “C:\temp\sxs”.

Open a CMS windows as an “Administrator” and paste the following command:

C:\Windows\system32>dism.exe /online /enable-feature /featurename:NetFX3 /Source :C:\temp\sxs /LimitAccess /all

Note: Modify the /Source attribute if needed.

If the process was successful, you will see the following message


PowerShell – Import-Pssession is not Importing Cmdlets for O365 Exchange Online

August 30, 2017


I noticed that after connecting to O365 Exchange Online using PowerShell, the connection was done OK.

But I could recognize any of the Cmdlets after connecting Sad smile



$LiveCred = Get-Credential -credential "patrick.taels@plastiflex.com"
   $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-Module (Import-PSSession $Session -WarningAction SilentlyContinue -AllowClobber) -Global 


As you can notice you need to add the Import-Module( … –AllowClobber) –Global Command and Parameters …

Enjoy !

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

August 9, 2017

Since we AutoIT have got access the to the .NET Common Language Runtime (CLR) Framework 

We can access the PowerShell Automation Classes as well.

This is really powerfull stuff … because we can reuse .NET code as well as all the native CMDlet’s and scripts.

As you can see the script runs an PowerShell command that lists all running processes on your machine. And return the Output to a .NET Grid.


Which runs inside our Unmanaged Host, isn’t that cool …Smile

We can access native .NET Classes as well because PS runs on top off it.

Next is that you could access any kind of Cloud Web Service using the multitude of PS Modules that are available.

As well as accessing Custom Build Assemblies.

How to :

For more information on how to access .NET Classes see the above post about .NET Common Language CLR Framework.

Or Join the most friendly and helpful AutoIT Community on the net Smile

I will post some more examples and How To’s later on, so stay tuned …

PowerShell – Download Module from Gallery

May 3, 2017

Option 1 :

Use a system that has a PS 5.0 or higher and save it there.

Copy it over and install it on a PS 3.0 or 4.0 version.


PS> Save-Module -Name SqlServer -Path <path>


PS> Install-Module -Name SqlServer


Option 2 :

Install the GUI : PackageManagement PowerShell Modules Preview – March 2016



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”


Example : “System.IO.FileInfo”


Example : “System.Windows.Forms”



2. Accessing custom build .Net Assemblies :

Example : AutoItX3 .NET Assembly using AutoItX



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

Example : Compile Code C# and Code VB



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

Example : Compile Code C# at Runtime



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 !