Basically install an Oracle Client (with .NET support), and define and use the following function (courtesy of PoshCode comunity):
function Get-OLEDBData ($connectstring, $sql) { $OLEDBConn = New-Object System.Data.OleDb.OleDbConnection($connectstring) $OLEDBConn.open() $readcmd = New-Object system.Data.OleDb.OleDbCommand($sql,$OLEDBConn) $readcmd.CommandTimeout = '300' $da = New-Object system.Data.OleDb.OleDbDataAdapter($readcmd) $dt = New-Object system.Data.datatable [void]$da.fill($dt) $OLEDBConn.close() return $dt }
A test is here:$connString = "password=pwd;User ID=id;Data Source=ambarabaciccicocco;Provider=OraOLEDB.Oracle" $query= "SELECT * FROM HR.DEPARTMENTS" Get-OLEDBData -connection $connString -sql $query
Here are the guides:
http://guyharrison.typepad.com/oracleguy/2008/01/accessing-oracl.html
http://sev17.com/2010/02/28/querying-oracle-from-powershell-part-1/
http://cmille19.wordpress.com/2010/03/01/querying-oracle-from-powershell-part-2/
Enjoy!
Sayonara