PowerShell Genie

Get-Item

Use Get-Item to return the item at a path — file, folder, registry key, or any provider item — to inspect its properties.

Command 1 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — Get-Item

Syntax

1PS> Get-Item [-Path] <String[]> [-Force] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-Item [-Path] <String[]> [-Force] [<CommonParameters>]
  1. Stage 1Get-Item-Path -Force

    Try it

    Windows PowerShell

    PowerShell example · browser support is limited.

    Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.

    Interactive simulation · fictional data

    Examples

    List all with Get-Item

    1PS> Get-Item C:\Logs\app.log
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name     Length  LastWriteTime
    -------  ------  ------------------
    app.log  4096    9/10/2026 11:42 PM

    List all with Get-Item (2)

    1PS> Get-Item HKLM:\SOFTWARE\Microsoft
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Name                           Property
    ----                           --------
    HKEY_LOCAL_MACHINE\SOFTWARE  ProgramFilesDir : C:\Program Files

    List all with Get-Item (3)

    1PS> Get-Item Cert:\CurrentUser\My\*
    Show reference output

    Sample output · fictional data, shaped like the real thing

    Thumbprint                                Subject
    ----------                                -------
    5A8C1F3D7A6B1234567890ABCDEF1234567890AB  CN=PowerShell Genie Demo

    Parameters

    Parameter definitions:

    • -Path
    • -Force

    Get-Item on Microsoft Learn

    Practical use and troubleshooting

    Practical scenario: Use Get-Item when you need to return the item at a path — file, folder, registry key, or any provider item — to inspect its properties. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.

    Common error and fix: An unexpected wildcard match can select the wrong file. Use -LiteralPath to address the exact name rather than treating brackets or asterisks as wildcard syntax. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.

    See also: Get-Content. Get-Content reads the contents of a file; Get-Item returns the file object and its metadata. A file object is not the text stored inside it. Read the linked command before substituting it; similar names do not imply identical inputs or output.

    Get-Item reference on Microsoft Learn

    Recap

    Get-Item Use Get-Item to return the item at a path — file, folder, registry key, or any provider item — to inspect its properties.

    Next: New-Item
    Genie guideGet-Item

    Use Get-Item to return the item at a path — file, folder, registry key, or any provider item — to inspect its properties. The console below is pre-loaded — run it, then change a value and run it again.