Get-ItemProperty (Microsoft.PowerShell.Management) - PowerShell (2024)

  • Reference
Module:
Microsoft.PowerShell.Management

Gets the properties of a specified item.

Syntax

Get-ItemProperty [-Path] <String[]> [[-Name] <String[]>] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>] [-Credential <PSCredential>] [<CommonParameters>]
Get-ItemProperty -LiteralPath <String[]> [[-Name] <String[]>] [-Filter <String>] [-Include <String[]>] [-Exclude <String[]>] [-Credential <PSCredential>] [<CommonParameters>]

Description

The Get-ItemProperty cmdlet gets the properties of the specified items. For example, you can usethis cmdlet to get the value of the LastAccessTime property of a file object. You can also usethis cmdlet to view registry entries and their values.

Examples

Example 1: Get information about a specific directory

This command gets information about the C:\Windows directory.

Get-ItemProperty C:\Windows

Example 2: Get the properties of a specific file

This command gets the properties of the C:\Test\Weather.xls file. The result is piped to theFormat-List cmdlet to display the output as a list.

Get-ItemProperty C:\Test\Weather.xls | Format-List

Example 3: Get the value name and data of a registry entry in a registry subkey

This command gets the value name and data of the ProgramFilesDir registry entry in theCurrentVersion registry subkey. The Path specifies the subkey and the Name parameterspecifies the value name of the entry.

Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion -Name "ProgramFilesDir"

Note

This command requires that there is a PowerShell drive named HKLM: that is mapped to theHKEY_LOCAL_MACHINE hive of the registry.

A drive with that name and mapping is available in PowerShell by default. Alternatively, the pathto this registry subkey can be specified by using the following alternative path that begins withthe provider name followed by two colons:

Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion.

Example 4: Get the value names and data of registry entries in a registry key

This command gets the value names and data of the registry entries in the PowerShellEngineregistry key. The results are shown in the following sample output.

Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngineApplicationBase : C:\Windows\system32\WindowsPowerShell\v1.0\ConsoleHostAssemblyName : Microsoft.PowerShell.ConsoleHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=msilPowerShellVersion : 2.0RuntimeVersion : v2.0.50727CTPVersion : 5PSCompatibleVersion : 1.0,2.0

Parameters

-Credential

Note

This parameter is not supported by any providers installed with PowerShell. To impersonate anotheruser, or elevate your credentials when running this cmdlet, useInvoke-Command.

Type:PSCredential
Position:Named
Default value:Current user
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Exclude

Specifies, as a string array, an item or items that this cmdlet excludes in the operation. The valueof this parameter qualifies the Path parameter. Enter a path element or pattern, such as*.txt. Wildcard characters are permitted. The Exclude parameter is effective only when thecommand includes the contents of an item, such as C:\Windows\*, where the wildcard characterspecifies the contents of the C:\Windows directory.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-Filter

Specifies a filter to qualify the Path parameter. TheFileSystem provider is the onlyinstalled PowerShell provider that supports the use of filters. You can find the syntax for theFileSystem filter language inabout_Wildcards. Filters are more efficientthan other parameters, because the provider applies them when the cmdlet gets the objects ratherthan having PowerShell filter the objects after they are retrieved.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-Include

Specifies, as a string array, an item or items that this cmdlet includes in the operation. The valueof this parameter qualifies the Path parameter. Enter a path element or pattern, such as*.txt. Wildcard characters are permitted. The Include parameter is effective only when thecommand includes the contents of an item, such as C:\Windows\*, where the wildcard characterspecifies the contents of the C:\Windows directory.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-LiteralPath

Specifies a path to one or more locations. The value of LiteralPath is used exactly as it istyped. No characters are interpreted as wildcards. If the path includes escape characters, encloseit in single quotation marks. Single quotation marks tell PowerShell not to interpret any charactersas escape sequences.

For more information, seeabout_Quoting_Rules.

Type:String[]
Aliases:PSPath, LP
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the property or properties to retrieve. Wildcard characters are permitted.

Type:String[]
Aliases:PSProperty
Position:1
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:True

-Path

Specifies the path to the item or items. Wildcard characters are permitted.

Type:String[]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:True

Inputs

String

You can pipe a string that contains a path to this cmdlet.

Outputs

Boolean

String

DateTime

FileInfo

DirectoryInfo

This cmdlet returns an object for each item property that it gets. The object type depends onthe object that is retrieved. For example, in a file system drive, it might return a file or folder.

Notes

PowerShell includes the following aliases for Get-ItemProperty:

  • All platforms:
    • gp

The Get-ItemProperty cmdlet is designed to work with the data exposed by any provider. To list theproviders available in your session, type Get-PSProvider. For more information, seeabout_Providers.

  • Clear-ItemProperty
  • Copy-ItemProperty
  • Move-ItemProperty
  • New-ItemProperty
  • Remove-ItemProperty
  • Rename-ItemProperty
  • Set-ItemProperty
  • about_Providers
Get-ItemProperty (Microsoft.PowerShell.Management) - PowerShell (2024)

FAQs

How do you get-item Attributes in PowerShell? ›

To view or manipulate the file system attributes in PowerShell, use the “Get-Item” or “Get-Childitem” cmdlets to create an object of “System. IO. FileInfo” class for each of your target files and folders. This object has an “Attributes” property.

How do you retrieve property value in PowerShell? ›

The most common way to get the values of the properties of an object is to use the member access operator ( . ). Type a reference to the object, such as a variable that contains the object, or a command that gets the object. Then, type the operator ( . ) followed by the property name.

How to get all properties of an object in PowerShell? ›

Get-Member. Get-Member helps you discover what objects, properties, and methods are available for commands. Any command that produces object-based output can be piped to Get-Member .

What does set ItemProperty do in PowerShell? ›

The Set-ItemProperty cmdlet changes the value of the property of the specified item. You can use the cmdlet to establish or change the properties of items. For example, you can use Set-ItemProperty to set the value of the IsReadOnly property of a file object to $True .

How to get all attributes for user in PowerShell? ›

Default Limitations: The standard get-aduser cmdlet in PowerShell returns only 10 user attributes by default. Expanding Output:To view all attributes, modify the cmdlet with the -properties * parameter. For example, get-aduser -Identity username -properties * displays all attributes of a user.

What is get-item in PowerShell? ›

Description. The Get-Item cmdlet gets the item at the specified location. It doesn't get the contents of the item at the location unless you use a wildcard character ( * ) to request all the contents of the item. This cmdlet is used by PowerShell providers to navigate through different types of data stores.

How to get value in PowerShell? ›

The Get-Variable cmdlet gets the Windows PowerShell variables in the current console. You can retrieve just the values of the variables by specifying the ValueOnly parameter, and you can filter the variables returned by name.

How do I see all properties in PowerShell get service? ›

To see all of the properties, type Get-Service | Get-Member .

What is noteproperty in PowerShell? ›

NoteProperties are generic properties that are created by Powershell (as opposed to properties that are inherited from a specific dotnet object type).

How can you get the list of all properties in an object? ›

The getOwnPropertyNames() method returns all properties. The Object.keys() method returns all enumerable properties. If you define object properties without enumerable:false, the two methods will return the same.

What does $_ mean in PowerShell? ›

PowerShell includes the $PSItem variable and its alias, $_ , as automatic variables in scriptblocks that process the current object, such as in the pipeline. This article uses $PSItem in the examples, but $PSItem can be replaced with $_ in every example.

What is the PowerShell command to view all the properties of a specific process? ›

To see all of the properties, type Get-Process | Get-Member . By default, the values of all amount properties are in bytes, even though the default display lists them in kilobytes and megabytes.

What is the new ItemProperty registry value? ›

The New-ItemProperty cmdlet creates a new property for a specified item and sets its value. Typically, this cmdlet is used to create new registry values, because registry values are properties of a registry key item. This cmdlet does not add properties to an object.

What is the difference between set ItemProperty and new ItemProperty in PowerShell? ›

If it doesn't exist, it creates the key using `New-Item`. This way, you ensure that the required registry structure is in place before setting the value entry. If we know that the registry key value already exists and we want to modify the value, we can use the `Set-ItemProperty` cmdlet.

What is the difference between get-ItemProperty and get item? ›

Get-Item will get registry keys and subkeys, but you must use Get-ItemProperty to get the registry values and data.

How do I view ad object attributes? ›

Right click on the desired object and select Properties. The Attribute Editor tab displays the list of attributes and values of the selected object. The necessary changes can be made under the Attribute Editor tab. Click OK once the properties have been viewed and changed.

What are attributes in PowerShell? ›

An attribute consists of an attribute-name and an optional list of positional and named arguments. The positional arguments (if any) precede the named arguments. A named argument consists of a simple-name, optionally followed by an equal sign and followed by an expression.

How do I view custom attributes in Active Directory PowerShell? ›

To view the value of a custom attribute in Active Directory, you can use the PowerShell cmdlet Get-ADUser. You'll need to include the -Properties parameter and specify the attribute you want to retrieve.

Top Articles
Netflix Error ui-800-3
Ask HN: Is 20 too late to go to college?
Foxy Roxxie Coomer
AllHere, praised for creating LAUSD’s $6M AI chatbot, files for bankruptcy
Truist Bank Near Here
It's Official: Sabrina Carpenter's Bangs Are Taking Over TikTok
Is pickleball Betts' next conquest? 'That's my jam'
Missing 2023 Showtimes Near Cinemark West Springfield 15 And Xd
Craigslist Parsippany Nj Rooms For Rent
Bucks County Job Requisitions
Produzione mondiale di vino
Music Archives | Hotel Grand Bach - Hotel GrandBach
City Of Spokane Code Enforcement
Garrick Joker'' Hastings Sentenced
Jasmine Put A Ring On It Age
Los Angeles Craigs List
Gwdonate Org
Burn Ban Map Oklahoma
2016 Ford Fusion Belt Diagram
Gon Deer Forum
Overton Funeral Home Waterloo Iowa
Driving Directions To Bed Bath & Beyond
라이키 유출
A Biomass Pyramid Of An Ecosystem Is Shown.Tertiary ConsumersSecondary ConsumersPrimary ConsumersProducersWhich
Craigslist Personals Jonesboro
Georgia Cash 3 Midday-Lottery Results & Winning Numbers
Toothio Login
Sherburne Refuge Bulldogs
Cpt 90677 Reimbursem*nt 2023
Craigslist Ludington Michigan
Pixel Combat Unblocked
1636 Pokemon Fire Red U Squirrels Download
Tottenham Blog Aggregator
Pfcu Chestnut Street
Metro By T Mobile Sign In
Does Iherb Accept Ebt
Synchrony Manage Account
In Polen und Tschechien droht Hochwasser - Brandenburg beobachtet Lage
Amc.santa Anita
Strange World Showtimes Near Century Stadium 25 And Xd
Spurs Basketball Reference
Port Huron Newspaper
Tacos Diego Hugoton Ks
Phmc.myloancare.com
Dying Light Mother's Day Roof
Das schönste Comeback des Jahres: Warum die Vengaboys nie wieder gehen dürfen
Mlb Hitting Streak Record Holder Crossword Clue
Random Warzone 2 Loadout Generator
Quest Diagnostics Mt Morris Appointment
What Time Do Papa John's Pizza Close
Fallout 76 Fox Locations
Latest Posts
Article information

Author: Rev. Leonie Wyman

Last Updated:

Views: 6595

Rating: 4.9 / 5 (79 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Rev. Leonie Wyman

Birthday: 1993-07-01

Address: Suite 763 6272 Lang Bypass, New Xochitlport, VT 72704-3308

Phone: +22014484519944

Job: Banking Officer

Hobby: Sailing, Gaming, Basketball, Calligraphy, Mycology, Astronomy, Juggling

Introduction: My name is Rev. Leonie Wyman, I am a colorful, tasty, splendid, fair, witty, gorgeous, splendid person who loves writing and wants to share my knowledge and understanding with you.