Ready to get started?

Download a free trial of the Redis Data Provider to get started:

 Download Now

Learn more:

Redis Icon Redis ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Redis data stores.

Automate Redis Integration Tasks from PowerShell

Are you in search of a quick and easy way to access Redis data from PowerShell? This article demonstrates how to utilize the Redis Cmdlets for tasks like connecting to Redis data, automating operations, downloading data, and more.

The CData Cmdlets for Redis 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 Redis.

PowerShell Cmdlets or ADO.NET Provider?

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

Once you have acquired the necessary connection properties, accessing Redis data in PowerShell can be enabled in three steps.

Set the following connection properties to connect to a Redis instance:

  • Server: Set this to the name or address of the server your Redis instance is running on. You can specify the port in Port.
  • Password: Set this to the password used to authenticate with a password-protected Redis instance , using the Redis AUTH command.

Set UseSSL to negotiate SSL/TLS encryption when you connect.


  1. Install the module:

    Install-Module RedisCmdlets
  2. Connect:

    $redis = Connect-Redis -Server "$Server" -Port "$Port" -Password "$Password"
  3. Search for and retrieve data:

    $country = "US" $customers = Select-Redis -Connection $redis -Table "Customers" -Where "Country = `'$Country`'" $customers

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

    $customers = Invoke-Redis -Connection $redis -Query 'SELECT * FROM Customers WHERE Country = @Country' -Params @{'@Country'='US'}


  1. Load the provider's assembly:

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

    $conn= New-Object System.Data.CData.Redis.RedisConnection("Server=;Port=6379;Password=myPassword;") $conn.Open()
  3. Instantiate the RedisDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT City, CompanyName from Customers" $da= New-Object System.Data.CData.Redis.RedisDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $ $_.companyname }

Update Redis Data


Update-Redis -Connection $Redis -Columns @('City','CompanyName') -Values @('MyCity', 'MyCompanyName') -Table Customers -Id "MyId"


$cmd = New-Object System.Data.CData.Redis.RedisCommand("UPDATE Customers SET Country='US' WHERE Id = @myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Redis.RedisParameter("@myId","10456255-0015501366"))) $cmd.ExecuteNonQuery()

Insert Redis Data


Add-Redis -Connection $Redis -Table Customers -Columns @("City", "CompanyName") -Values @("MyCity", "MyCompanyName")


$cmd = New-Object System.Data.CData.Redis.RedisCommand("INSERT INTO Customers (Country) VALUES (@myCountry)", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Redis.RedisParameter("@myCountry","US"))) $cmd.ExecuteNonQuery()

Delete Redis Data


Remove-Redis -Connection $Redis -Table "Customers" -Id "MyId"


$cmd = New-Object System.Data.CData.Redis.RedisCommand("DELETE FROM Customers WHERE Id=@myId", $conn) $cmd.Parameters.Add((New-Object System.Data.CData.Redis.RedisParameter("@myId","001d000000YBRseAAH"))) $cmd.ExecuteNonQuery()