Overview

The OData PowerShell provider allows you to mount OData feeds as drives in your powershell session. This enables simple and intuitive access to the catalogs, collections, and entities in the feed using the same cmdlets you use for working with files.

The current release (OData Provider 1.0) supports read operations only. If there is enough interest in the project write operations will be added.

For details about using the provider, please see the Documentation.

Synopsis

The example below mounts the NuGet package feed and performs a few canonical operations, including:
  • mounting the NuGet package feed as a drive
  • searching for NuGet packages using -filter parameters
  • downloading the StudioShell package using get-content

C:\> import-module OData;
C:\> new-psdrive -name nuget -psprovider OData -root 'http://packages.nuget.org'

Name           Used (GB)     Free (GB) Provider
----           ---------     --------- --------
nuget                                  ODATA

C:\> cd nuget:\packages
nuget:\packages> dir 

PSPath                   : OData::http:\\packages.nuget.org\packages\110
PSParentPath             : OData::http:\\packages.nuget.org\packages
PSChildName              : 110
PSDrive                  : nuget
PSProvider               : OData
PSIsContainer            : True
Id                       : 110
Version                  : 1.7
Authors                  : KIARASH Soleimanzadeh
#...

PSPath                   : OData::http:\\packages.nuget.org\packages\44nwodhterag
PSParentPath             : OData::http:\\packages.nuget.org\packages
PSChildName              : 44nwodhterag
PSDrive                  : nuget
PSProvider               : OData
PSIsContainer            : True
Id                       : 44nwodhterag
Version                  : 5.0
Authors                  : garethdown44
#...

PSPath                   : OData::http:\\packages.nuget.org\packages\51Degrees.mobi
PSParentPath             : OData::http:\\packages.nuget.org\packages
PSChildName              : 51Degrees.mobi
PSDrive                  : nuget
PSProvider               : OData
PSIsContainer            : True
Id                       : 51Degrees.mobi
Version                  : 1.0.2.2
Authors                  : James Rosewell,  Thomas Holmes
# ...

# ... and a whole lot more...

nuget:packages\> dir -filter "-1 ne indexof(Tags, 'VisualStudio')" | select Name,Version

Name                                                          Version
----                                                          -------
AddReference                                                  1.1.195
AddReference                                                  1.2
Flubu                                                         1.0.2.0
Flubu                                                         1.0.3.0
StudioShell                                                   1.2
Tfs.Common                                                    0.0.0.1

nuget:packages\> get-item  studioshell | select Name, Version, DownloadCount

Name                        Version                                  DownloadCount
----                        -------                                  -------------
StudioShell                 1.2                                      53

nuget:packages> $zip = get-content studioshell
nuget:packages> [Io.File]::WriteAllBytes( 'studioshell.zip' $zip )
nuget:packages> invoke-item ./studioshell.zip

Last edited Jan 27, 2012 at 10:33 PM by beefarino, version 5