Ready to get started?

Learn more about the CData ADO.NET Provider for FedEx or download a free trial:

Download Now

Automate FedEx Integration Tasks from PowerShell

Are you looking for a quick and easy way to access FedEx data from PowerShell? We show how to use the Cmdlets for FedEx and the CData ADO.NET Provider for FedEx to connect to FedEx data and synchronize, automate, download, and more.

The CData Cmdlets for FedEx are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time and bidirectional access to FedEx.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the FedEx API, but also an SQL interface; this tutorial shows how to use both to create, retrieve, update, and delete FedEx data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for FedEx. To access FedEx data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for FedEx.

After obtaining the needed connection properties, accessing FedEx data in PowerShell consists of three basic steps.

There are five pieces of information needed in order to authenticate its actions with the FedEx service. This information is below.

  • Server: This controls the URL where the requests should be sent. Common testing options for this are: "", "", "", and ""
  • DeveloperKey: This is the identifier part of the authentication key for the sender's identity. This value will be provided to you by FedEx after registration.
  • Password: This is the secret part of the authentication key for the sender's identity. This value will be provided to you by FedEx after registration.
  • AccountNumber: This valid 9-digit FedEx account number is used for logging into the FedEx server.
  • MeterNumber: This value is used for submitting requests to FedEx. This value will be provided to you by FedEx after registration.
  • PrintLabelLocation: This property is required if one intends to use the GenerateLabels or GenerateReturnLabels stored procedures. This should be set to the folder location where generated labels should be stored.

The Cache Database

Many of the useful tasks available from FedEx require a lot of data. To ensure this data is easy to input and recall later, utilizes a cache database to make these requests. You must set the cache connection properties:

  • CacheProvider: The specific database you are using to cache with. For example, org.sqlite.JDBC.
  • CacheConnection: The connection string to be passed to the cache provider. For example, jdbc:sqlite:C:\users\username\documents\fedexcache.db


  1. Install the module:

    Install-Module FedExCmdlets
  2. Connect:

    $fedex = Connect-FedEx -Server "$Server" -DeveloperKey "$DeveloperKey" -Password "$Password" -AccountNumber "$AccountNumber" -MeterNumber "$MeterNumber" -PrintLabelLocation "$PrintLabelLocation" -CacheProvider "$CacheProvider" -CacheConnection "$CacheConnection"
  3. Search for and retrieve data:

    $senderid = "ab26f704-5edf-4a9f-9e4c-25" $senders = Select-FedEx -Connection $fedex -Table "Senders" -Where "SenderID = `'$SenderID`'" $senders

    You can also use the Invoke-FedEx cmdlet to execute SQL commands:

    $senders = Invoke-FedEx -Connection $fedex -Query 'SELECT * FROM Senders WHERE SenderID = @SenderID' -Params @{'@SenderID'='ab26f704-5edf-4a9f-9e4c-25'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for FedEx\lib\System.Data.CData.FedEx.dll")
  2. Connect to FedEx:

    $conn= New-Object System.Data.CData.FedEx.FedExConnection("Server='';DeveloperKey='alsdkfjpqoewiru';Password='zxczxqqtyiuowkdlkn';AccountNumber='110371337';MeterNumber='240134349'; PrintLabelLocation='C:\users\username\documents\mylabels';CacheProvider='org.sqlite.JDBC';CacheConnection='jdbc:sqlite:C:\users\username\documents\fedexcache.db';") $conn.Open()
  3. Instantiate the FedExDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT FirstName, Phone from Senders" $da= New-Object System.Data.CData.FedEx.FedExDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.firstname $ }

Update FedEx Data


Update-FedEx -Connection $FedEx -Columns @('FirstName','Phone') -Values @('MyFirstName', 'MyPhone') -Table Senders -Id "MyId"


$cmd = New-Object System.Data.CData.FedEx.FedExCommand("UPDATE Senders SET SenderID='ab26f704-5edf-4a9f-9e4c-25' WHERE Id = @myId", $conn) $cmd.Parameters.Add(new System.Data.CData.FedEx.FedExParameter("@myId","10456255-0015501366")) $cmd.ExecuteNonQuery()

Insert FedEx Data


Add-FedEx -Connection $FedEx -Table Senders -Columns @("FirstName", "Phone") -Values @("MyFirstName", "MyPhone")


$cmd = New-Object System.Data.CData.FedEx.FedExCommand("INSERT INTO Senders (SenderID) VALUES (@mySenderID)", $conn) $cmd.Parameters.Add(new System.Data.CData.FedEx.FedExParameter("@mySenderID","ab26f704-5edf-4a9f-9e4c-25")) $cmd.ExecuteNonQuery()

Delete FedEx Data


Remove-FedEx -Connection $FedEx -Table "Senders" -Id "MyId"


$cmd = New-Object System.Data.CData.FedEx.FedExCommand("DELETE FROM Senders WHERE Id=@myId", $conn) $cmd.Parameters.Add(new System.Data.CData.FedEx.FedExParameter("@myId","001d000000YBRseAAH")) $cmd.ExecuteNonQuery()