One Journey. Multiple Technologies
Menu
!doctype>
!doctype>
!doctype>
!doctype>
Thursday 17 August 2017
Sunday 14 May 2017
Tuesday 9 May 2017
Friday 14 April 2017
Monday 27 February 2017
Saturday 21 January 2017
Friday 20 January 2017
Ignoring Self-signed Certificates
When using Windows PowerShell as a client, to avoid SSL Certificate trust issues if using HTTPS, enter this function in the PowerShell window:
Sunday 13 November 2016
Oracle Database Query From Powershell
- Download Oracle Data Provider for .NET (ODP.NET). (Just search for “Oracle ODP.NET”.)
- Select “Download the latest ODP.NET production release.”
- Select “64-bit ODAC Downloads”
- Select “ODP.NET_Managed_ODAC12cR4.zip”
- Extract the ZIP file to
C:\
, which createsC:\ODP.NET_Managed_ODAC12cR4
. - Run
cmd
as administrator, navigate to C:\ODP.NET_Managed_ODAC12cR4, and run:install_odpm.bat C:\oracle\instantclient_10_2 both
In Powershell, add the DLL and set up a database connection and a query:
Script:
Add-Type -Path "C:\Users\User1\ODP.NET_Managed_ODAC12cR4\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
$username = Read-Host -Prompt "Enter database username"
$password = Read-Host -Prompt "Enter database password"
$datasource = Read-Host -Prompt "Enter database TNS name"
$query = "SELECT first_name, last_name FROM users WHERE last_name = 'Lastname' ORDER BY last_name"
$connectionString = 'User Id=' + $username + ';Password=' + $password + ';Data Source=' + $datasource
$connection = New-Object Oracle.ManagedDataAccess.Client.OracleConnection($connectionString)
$connection.open()
$command=$connection.CreateCommand()
$command.CommandText=$query
$reader=$command.ExecuteReader()
while ($reader.Read()) {
$reader.GetString(1) + ', ' + $reader.GetString(0)
}
$connection.Close()
Expected Output:
User1_Firstname, Lastname
User2_Firstname, Lastname
User3_Firstname, Lastname
User2_Firstname, Lastname
User3_Firstname, Lastname
Saturday 12 November 2016
Friday 11 November 2016
Sunday 6 November 2016
Saturday 5 November 2016
Thursday 3 November 2016
Object Oriented Scripting in Powershell
Object Oriented Development in PowerShell. PsClass is currently implemented in Powershell in a single file. Makes it simple to use. It supports the following Object Oriented concepts.
- Inheritance
- Polymorphism
- Encapsulation
- Constructors with parameters
- Notes – read-write variables
- Methods – scriptblocks
- Properties with Get scriptblocks and optional Set scriptblocks
- Static and Private Notes and Methods
Sunday 23 October 2016
Saturday 22 October 2016
Thursday 20 October 2016
Wednesday 19 October 2016
Invoke a GUI from Remote Input
Input from remote and Invoke a GUI script
cmd.exe /C "pushd \\remoteserver\FolderName && Filename && popd"
Subscribe to:
Posts (Atom)