As of Aug 2017, googled the link to download the latest version 5.1 and found below:
Powershell 5.1 on microsoft site. Refer figure below
Click on download button to move to next page and select the appropriate .msi to download.
“W2K12-KB3191565-x64.msu” may be the file you choose for download and run. So i did
the same and found the error that this may not be the correct setup to run.
Read on article to choose the correct file on
Powershell on Win server 2012 R
Went back to download page and this time downloaded the file as per below snapshot:
and executed it. It ran successfully.
The purpose of this blog is to get the dev aware of how the PowerShell can be used to connect to MySQL db and insert a sample record.
With the increase of automation in industry, powershell is made responsible for doing many more things including inserting a new record in MySQL database.
The script flow start at line 28 by setting bthe username/ password/ database name, server name of the MYSQL database. By Default the port to connect db is 3306.
$query parameter of powershell need to be set for correct insert DML statement.
Next is Powershell function call which takes username, password, server, database, query as parameter. Line 1 to 26 is PowerShell function which handles this.
For this function to work perfectly it necessary for[reflection.assembly]::LoadFrom(“C:\abc\MySql.Data.dll”)
Statement to execute with success. What this statement do is load MySQL.data.dll assembly in script.
Its >net and MySQL connector Dll. You can get this dll by creating a new project in .Net Visual studio and add a new package by searching ‘MySQL’. Make sure you correctly set this DLL path in script.
This function takes care of establishing the connection with MySQL, Open the connection, execute the SQL DML query and return the response.
I tested this script in Windows 10, Powershell 4 and MySQL 8.4.5 and works fine.
$path = “<local computer path\>"
$setup = "Jenkins.msi"
$program = $path + $setup
Start-Process -FilePath $program -ArgumentList "/quiet"
This script is tested on Jenkins build 1.646 and works perfect.
DSC stands for Desired State Configuration. Its a declarative language that works on top of PowerShell.
DSC was introdcured in Powershell 4.0.
It can do system configuration, software deployment, Configuration validation, enforce compliance activities for you.
Not only the Windows O/s configuration DSC can do the Linux machine configurations for you. Further more these configuration may be used in conjunction with Automation frameworks like Chef, puppet, azure etc..