< Back

Get-IndexedItem

Mon Jan 13, 2020 8:15 pm

NAME Get-IndexedItem



SYNOPSIS

Gets files that have been indexed by Windows Desktop Search.





SYNTAX

Get-IndexedItem [-Filter] <String[]> [[-Path] <String>] [-OrderBy <String[]>] [-First <Int32>] [-Property

<String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -Contains <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -Like <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -LT <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -GT <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -NE <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Where] <String> -EQ <String> [-OrderBy <String[]>] [-First <Int32>]

[-Property <String[]>] [-Recurse] [-NoFiles] [-Bare] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] -Value <String> [-Recurse] [-OutputVariable <String>] [<CommonParameters>]



Get-IndexedItem [[-Path] <String>] [-Recurse] -List [-OutputVariable <String>] [<CommonParameters>]





DESCRIPTION

Searches the Windows-Index on the local computer, or on a remote file serving computer,

looking for matching meta-data properties or performing free text searches against file content.





PARAMETERS

-Filter <String[]>

Alias INCLUDE.

A single string containing a WHERE condition, or containing multiple conditions linked with 'AND'

or multiple strings, each holding a single condition, which will be joined together.

The function tries to add file-name prefixes and single quotes around string values if they are omitted.

If no =, >,< , Like or Contains is specified, the terms will be used in a CONTAINS free text search.

Syntax Information for CONTAINS and FREETEXT can be found at

http://msdn.microsoft.com/en-us/library ... e.11).aspx .



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

A single string containing a path which should be searched.

This may be a UNC path to a share on a remote computer.

If -Path is not specified, the whole index will be searched.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Where <String>

Specifies a field-name for a WHERE condition; used in conjunction with -Eq etc.

An argument completer allows intellisense to suggest field names.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EQ <String>

Combined with -Where to specify "field is equal to ...".

An argument completer allows intellisense to suggest possible values for this field.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NE <String>

Used with -Where to specify "field is not equal to ...".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-GT <String>

Used with -Where to specify "field is greater than ...".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LT <String>

Used with -Where to specify "field is less than ...".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Like <String>

Used with -Where to specify a wild card match "field is like ...".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Contains <String>

Used with -Where to specify a free text search.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OrderBy <String[]>

Alias SORT.

Either a single string containing one or more ORDER BY conditions,

or multiple strings, each with a single condition which will be joined together.



Required? false

Position? named

Default value ITEMURL

Accept pipeline input? false

Accept wildcard characters? false



-First <Int32>

Alias TOP.

A single integer representing the number of items to be returned.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Value <String>

Alias GROUP

A single string containing a field-name. If specified the search will return

the unique values in this field, instead of objects for matching items.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Property <String[]>

By default all possible properties of indexed items are returned.

If -Property is specified only the named properties will be returned.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Recurse [<SwitchParameter>]

If -Path is specified only a single folder is searched unless -Recurse is specified.

If -Path is not specified the whole index is searched, and -Recurse is ignored.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-List [<SwitchParameter>]

Instead of querying the index, produces a list of known field names, with short names and aliases

which may be used instead.



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-NoFiles [<SwitchParameter>]

Normally if files are found, the command returns a file object with additional properties,

which can be piped into commands which accept files. This switch prevents the file being fetched

improving performance when the file object is not needed.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Bare [<SwitchParameter>]

If -Bare is not specified, the command will convert the field-names to easier to read names.

Specifying -Bare prevents this conversion and improves performance.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-OutputVariable <String>

PowerShell will normally expand a table into its rows and pass return the rows via the pipeline.

OutputVariable works like Common *variable Parameters, it takes a variable name and creates stores

the database table in it. This variable is accessible from the calling scope.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

IndexedItem



System.IO.FileInfo





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-IndexedItem -Filter "Contains(*,'Stingray')", "kind = 'picture'", "keywords='portfolio'" -path ~

-recurse



Finds picture files anywhere on the current users profile, which have 'Portfolio' as a keyword tag,

and 'stringray' in any indexed property.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-IndexedItem Stingray, kind=picture, keyword=portfolio -recurse ~ | copy -destination e:\\



Finds the same pictures as the previous example but uses Keyword as an alias for KeywordS, and

leaves the ' marks round Portfolio and Contains() round stingray to be automatically inserted;

then copies the found files to drive E:.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-IndexedItem -filter stingray -path OneIndex16:// -recurse



Finds OneNote items containing "Stingray".

(note, nothing will be found without -recurse and the number after OneIndex is Office-version specific.)









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-IndexedItem -filter stingray -path ([system.environment]::GetFolderPath(

[system.environment+specialFolder]::MyPictures )) -recurse



Looks for pictures with stingray in any indexed property, limiting the scope of the search

to the current user's 'My Pictures' folder and its subfolders.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-IndexedItem -Filter "system.kind = 'recordedTV' " -order "System.RecordedTV.RecordingTime" -path

"\\\\atom-engine\\users" -recurse | format-list path,title,episodeName,programDescription



Finds recorded TV files on a remote server named 'Atom-Engine' which are accessible via a share named 'users'.

In this example, field-name prefixes are specified explicitly, instead of letting the function add them.

Results are displayed as a list using a subset of the available fields specific to recorded TV.









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Get-IndexedItem -Value "kind" -path \\\\atom-engine\\users -recurse



Lists the kinds of files available on the on the 'users' share of a remote server named 'Atom-Engine'.









-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-IndexedItem -Value "title" -filter "kind=recordedtv" -path \\\\atom-engine\\users -recurse



Lists the titles of RecordedTv files available on the on the 'users' share of a remote server named 'Atom-Engine'.









-------------------------- EXAMPLE 8 --------------------------



PS C:\\>Start (Get-IndexedItem -path "\\\\atom-engine\\users" -recurse -Filter "title= 'Formula 1' " -order

"System.RecordedTV.RecordingTime DESC" -top 1 )



Finds files entitled "Formula 1" on the 'users' share of a remote server named 'Atom-Engine'.

Selects the most recent one by TV recording date, and opens it on the local computer.

Note: start does not support piped input.









-------------------------- EXAMPLE 9 --------------------------



PS C:\\>Get-IndexedItem -Filter "System.Kind = 'Music' AND AlbumArtist like '%' " -NoFiles | Group-Object

-NoElement -Property "AlbumArtist" | sort -Descending -property count



Gets all music files with an Album Artist set, using a single filter string holding a

where condition combining two terms which mix implicit and explicit field prefixes.

The result is grouped by Artist and sorted to give popular artist first.









-------------------------- EXAMPLE 10 --------------------------



Get-IndexedItem -Filter "Kind=music","DateModified>'2012-05-31'" -NoFiles | Select-Object -ExpandProperty name



Gets Music files which have been modified since a given date and shows just their names.

Note the date format is year-month-day; the date is actually a date time, so DataModified=

will only match files saved at midnight.









-------------------------- EXAMPLE 11 --------------------------



Get-IndexedItem "itemtype='.mp3'","AlbumArtist like '%'","RatingText <>'1 star'" -NoFiles -orderby

encodingBitrate,size -path $null | ft -a AlbumArtist,



Title, @{n="size"; e={($_.size/1MB).tostring("n2")+"MB"

}},@{n="duration";e={$_.duration.totalseconds.tostring("n0")+"sec"}},

@{n="Byes/Sec";e={($_.size/128/$_.duration.totalSeconds).tostring("n0")+"Kb/s"}},@{n="Encoding";e={($_.Encoding

Bitrate/1000).tostring("n0")+"Kb/s"}},

@{n="Sample Rate";e={($_.sampleRate/1000).tostring("n1")+"KHz"}}



Shows MP3 files with Artist and Track name, showing Size, duration, actual and encoding bits per second and

sample rate.









-------------------------- EXAMPLE 12 --------------------------



PS C:\\>Get-IndexedItem -path c:\\ -recurse -Filter cameramaker=Pentax* -Property focallength | group focallength

-no | sort -property @{e={[double]$_.name}}



Gets all the items which have a the Camera Maker set to "Pentax", anywhere on the C: drive

but ONLY get their FocalLength property, and returns a sorted count of how many of each focal length there are.











RELATED LINKS