How to display only filesystemobjects from PSDrive command

Welcome Forums General PowerShell Q&A How to display only filesystemobjects from PSDrive command

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
4 weeks ago.

  • Author
    Posts
  • #112460

    Participant
    Points: 0
    Rank: Member

    How to get a list of objects which has Provider="FileSystem"

  • #112504

    Keymaster
    Points: 7
    Rank: Member

    If you mean using Get-PSDrive, just pipe to Where-Object and specify the filter criteria. Or, use the -Provider switch of Get-PSDrive.

    • #112508

      Participant
      Points: 0
      Rank: Member

      I got the collection from get-psdrive and since provider is sort of .net property of type System.Management.Automation.ProviderInfo Provider {get;}

      I had to compare with the collection object's property like

      $b[1].Provider.Name which was actually a filesystem type.

      Output from my pc

      Name           Used (GB)     Free (GB) Provider      Root                                               CurrentLocation
      —-           ———     ——— ——–      —-                                               —————
      Alias                                  Alias
      C                 168.96        492.78 FileSystem    C:\                                                 Users\Abhishe

  • #112513

    Participant
    Points: 19
    Rank: Member

    Get-PSDrive -PSProvider FileSystem

You must be logged in to reply to this topic.