The Sandbox Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

WinFS Provider for MSH (Monad)

Back to Forum: The Sandbox
  • User profile image

    This is a very basic plugin for Microsoft Command Shell Beta 1 (MSH aka Monad) to reach WinFS data stores. Each WinFS store appears as a "drive" in MSH. This is a readonly plugin. Sources and binaries are also included.

    - WinFX Beta 1 SDK (available here)
    - Microsoft Command Shell Beta 1 (contained within the WinFX Beta 1 SDK)
    - WinFS Beta 1 (available to MSDN subscribers)

    written in VS2k5 beta 2

    There is a screen shot of this whithin the zip file.


    The get-winfsitem Cmdlet supports WinFS OPath queries now. A sample:

    MSH> get-winfsitem "Extent(@0).Filter(Container.GetPath() = @1)" ([System.Storage.Item]) "\Users" | ft -a ShellPath, {$_}, ItemSize, SizeX, SizeY, Comments

    As seen, the first argument is the OPath query expression and the remaining arguments are the positional parameters for the query expression.


    The get-winfsitem Cmdlet can return any object now. This means, it can write StorageRecord to the pipeline as well, if the OPath query contains "Project"-ing constructs.

    MSH> get-winfsitem "Extent(@0).Top(5).Project(FullName.GivenName as gn, FullName.Surname as sn)" ([System.Storage.Contacts.Person]) | ft -a {$_["gn"]}, {$_["sn"]}


    The built-in WinFS Schema assemblies are preloaded correctly now. If you want to preload your custom schema assembly, use one of the following commands:

    [Reflection.Assembly]::Load("assembly strong name")

    You can check the loaded assemblies this way:


  • User profile image

    OK, it's better here:

    MSH> get-winfsitem "Extent(@0).Filter(Container.GetPath() = @1)" ([System.Storage.Item]) "\Users" | ft -a ShellPath, {$_}, ItemSize, SizeX, SizeY, Comments

    ShellPath                             $_                                   ItemSize SizeX SizeY Comments
    ---------                             --                                   -------- ----- ----- --------
    \Users\WinFS Beta1 Sample Data Folder System.Storage.Folder                     184
    \Users\Kazi                           System.Storage.Folder                     132
    \Users\winfs.png                      System.Storage.GenericFile              44355
    \Users\Akos.jpg                       System.Storage.Image.Photo             477425 1600  1200
    \Users\Karen Berg                     System.Storage.Contacts.Person           3730
    \Users\Control Desk                   System.Storage.Contacts.Organization      777
    \Users\Szia.doc                       System.Storage.Documents.Document       20695             De most már más lett
    \Users\test.txt                       System.Storage.Documents.Document         161
    \Users\Copy of Szia.doc               System.Storage.Documents.Document       20659             Na

  • User profile image

    and this is on the screen shot:

    <C:\> get-provider | ft -a

    Name        Capabilities          Drives
    ----        ------------          ------
    Alias       ShouldProcess         {Alias}
    Environment ShouldProcess         {Env}
    FileSystem  Filter, ShouldProcess {C, D}
    Function    ShouldProcess         {function}
    Registry    ShouldProcess         {HKLM, HKCU}
    Variable    ShouldProcess         {Variable}
    Certificate ShouldProcess         {cert}
    WinFS       Filter, ShouldProcess {DefaultStore, Catalog}

    <C:\> get-drive | sort Provider, Name | ft -a

    Name         Provider    Root               CurrentLocation
    ----         --------    ----               ---------------
    Alias        Alias
    cert         Certificate \
    Env          Environment
    C            FileSystem  C:\
    D            FileSystem  D:\
    function     Function
    HKCU         Registry    HKEY_CURRENT_USER
    HKLM         Registry    HKEY_LOCAL_MACHINE
    Variable     Variable
    Catalog      WinFS       Catalog:\
    DefaultStore WinFS       DefaultStore:\

    <C:\> get-childitem DefaultStore:\ | ft ShellPath, ItemSize, CreationTime, LastModificationTime, ItemId, MshIsContainer -a

    ShellPath         ItemSize CreationTime        LastModificationTime ItemId                               MshIsContainer
    ---------         -------- ------------        -------------------- ------                               --------------
    \StoreInformation      122 2005.08.29 20:28:55 2005.08.29 20:28:55  c8769183-cb18-da11-bc6f-000e3593317d           True
    \Users                 122 2005.08.29 20:28:56 2005.08.29 20:28:56  c9769183-cb18-da11-bc6f-000e3593317d           True

  • User profile image

    <C:\> get-winfsitem "Extent(@0).Top(5).Project(FullName.GivenName as gn, FullName.Surname as sn)" ([System.Storage.Contacts.Person]) | ft -a {$_["gn"]}, {$_["sn"]}

    $_["gn"] $_["sn"]
    -------- --------
    Zainal   Arifin
    Sean     Chai
    Karen    Berg
    Terri    Duffy
    Jian     Wang

  • User profile image

    How does WinFS store its data internally? You can find everything within the "\System Volume Information\WinFS" directory. Follow the instructions here.

    You can find the database.mdf+database.ldf files there, and the stream files within the subdirectories.

    I have copied those database files to a different location (stopping all the WinFS services is required) and tried to attach to this database via Sql Server Management Studio April CTP. The result is the following error message:

    "The database 'Store{1FA0C5E2-2EE1-4C95-8956-801D633CB28C}' cannot be opened because it is version 607. This server supports version 603 and earlier. A downgrade path is not supported. Could not open new database 'Store{1FA0C5E2-2EE1-4C95-8956-801D633CB28C}'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)"

    It's really SQL server database files, but not the current available CTP version.

    Good news, in my opinion.

  • User profile image

    There are more obvious places for Catalog Store and other utility databases in C:\WINDOWS\System32\WinFS\Data folder (as someone wrote this on the WinFS NG).

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.