Cmdlets for Oracle Fusion Cloud SCM

Build 24.0.9060

Establishing a Connection

With the CData Cmdlets users can install a data module, set the connection properties, and start scripting. This section provides examples of using our OracleSCM Cmdlets with native PowerShell cmdlets, like the CSV import and export cmdlets.

Installing and Connecting

If you have PSGet, installing the cmdlets can be accomplished from the PowerShell Gallery with the following command. You can also obtain a setup from the CData site.

Install-Module OracleSCMCmdlets

The following line is then added to your profile, loading the cmdlets on the next session:

Import-Module OracleSCMCmdlets;

You can then use the Connect-OracleSCM cmdlet to create a connection object that can be passed to other cmdlets:

$conn = Connect-OracleSCM -Url "https://abc.oraclecloud.com" -User "user" -Password "password"

Connecting to Oracle Fusion Cloud SCM

The following connection properties are required to connect to Oracle Fusion Cloud SCM data.

  • Url: The URL of the account that you want to connect to. Typically, this will be the URL of your Oracle Cloud service. For example, https://servername.fa.us2.oraclecloud.com.
  • User: The username of your Oracle Cloud service account.
  • Password: The password of your Oracle Cloud service account.

Retrieving Data

The Select-OracleSCM cmdlet provides a native PowerShell interface for retrieving data:

$results = Select-OracleSCM -Connection $conn -Table "Carriers" -Columns @("CarrierId, CarrierId") -Where "CarrierName='Bob'"
The Invoke-OracleSCM cmdlet provides an SQL interface. This cmdlet can be used to execute an SQL query via the Query parameter.

Piping Cmdlet Output

The cmdlets return row objects to the pipeline one row at a time. The following line exports results to a CSV file:

Select-OracleSCM -Connection $conn -Table Carriers -Where "CarrierName = 'Bob'" | Select -Property * -ExcludeProperty Connection,Table,Columns | Export-Csv -Path c:\myCarriersData.csv -NoTypeInformation

You will notice that we piped the results from Select-OracleSCM into a Select-Object cmdlet and excluded some properties before piping them into an Export-CSV cmdlet. We do this because the CData Cmdlets append Connection, Table, and Columns information onto each row object in the result set, and we do not necessarily want that information in our CSV file.

However, this makes it easy to pipe the output of one cmdlet to another. The following is an example of converting a result set to JSON:

 
PS C:\> $conn  = Connect-OracleSCM -Url "https://abc.oraclecloud.com" -User "user" -Password "password"
PS C:\> $row = Select-OracleSCM -Connection $conn -Table "Carriers" -Columns (CarrierId, CarrierId) -Where "CarrierName = 'Bob'" | select -first 1
PS C:\> $row | ConvertTo-Json
{
  "Connection":  {

  },
  "Table":  "Carriers",
  "Columns":  [

  ],
  "CarrierId":  "MyCarrierId",
  "CarrierId":  "MyCarrierId"
} 

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060