다음을 통해 공유


Get-ItemPropertyValue

Gets the value for one or more properties of a specified item.

구문

Path (기본값)

Get-ItemPropertyValue
    [[-Path] <String[]>]
    [-Name] <String[]>
    [-Filter <String>]
    [-Include <String[]>]
    [-Exclude <String[]>]
    [-Credential <PSCredential>]
    [-UseTransaction]
    [<CommonParameters>]

LiteralPath

Get-ItemPropertyValue
    [-Name] <String[]>
    -LiteralPath <String[]>
    [-Filter <String>]
    [-Include <String[]>]
    [-Exclude <String[]>]
    [-Credential <PSCredential>]
    [-UseTransaction]
    [<CommonParameters>]

Description

The Get-ItemPropertyValue gets the current value for a property that you specify when you use the Name parameter, located in a path that you specify with either the Path or LiteralPath parameters.

예제

Example 1: Get the value of the ProductID property

This command gets the value of the ProductID property of the \SOFTWARE\Microsoft\WindowsNT\CurrentVersion object in the Windows Registry provider.

Get-ItemPropertyValue 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ProductID
94253-50000-11141-AA785

Example 2: Get the last write time of a file or folder

This command gets the value of the LastWriteTime property, or the last time a file or folder was changed, from the C:\Program Files\WindowsPowerShell folder, working in the FileSystem provider.

Get-ItemPropertyValue -Path 'C:\Program Files\WindowsPowerShell' -Name LastWriteTime
Wednesday, September 3, 2014 2:53:22 PM

Example 3: Get multiple property values of a file or folder

This command gets the values of the LastWriteTime, CreationTime, and Root properties of a folder. The property values are returned in the order in which you specified the property names.

Get-ItemPropertyValue -Path 'C:\Program Files\WindowsPowerShell' -Name LastWriteTime,CreationTime,Root
Tuesday, March 23, 2021 6:53:13 AM
Monday, August 14, 2017 1:42:40 PM

Name              : C:\
FullName          : C:\
Parent            :
Exists            : True
Root              : C:\
Extension         :
CreationTime      : 10/30/2015 1:28:30 AM
CreationTimeUtc   : 10/30/2015 6:28:30 AM
LastAccessTime    : 5/26/2021 9:24:31 AM
LastAccessTimeUtc : 5/26/2021 2:24:31 PM
LastWriteTime     : 5/25/2021 7:25:08 AM
LastWriteTimeUtc  : 5/25/2021 12:25:08 PM
Attributes        : Hidden, System, Directory
Mode              : d--hs-
BaseName          : C:\
Target            : {}
LinkType          :

매개 변수

-Credential

Specifies a user account that has permission to perform this action. The default is the current user.

Type a user name, such as "User01" or "Domain01\User01", or enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, you are prompted for a password.

Warning

This parameter is not supported by any providers installed with Windows PowerShell.

매개 변수 속성

형식:PSCredential
Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-Exclude

Specifies, as a string array, an item or items that this cmdlet excludes from the operation. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcard characters are permitted.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:True
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Filter

Specifies a filter in the format or language of the provider. The value of this parameter qualifies the Path parameter.

The syntax of the filter, including the use of wildcard characters, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when the cmdlet gets the objects rather than having PowerShell filter the objects after they are retrieved.

매개 변수 속성

형식:String
Default value:None
와일드카드 지원:True
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Include

Specifies, as a string array, an item or items that this cmdlet includes in the operation. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcard characters are permitted.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:True
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-LiteralPath

Specifies the path to the current ___location of the property. Unlike the Path parameter, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell PowerShell not to interpret any characters as escape sequences.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False
별칭:PSPath

매개 변수 집합

LiteralPath
Position:Named
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-Name

Specifies the name of the property or properties to retrieve.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False
별칭:PSProperty

매개 변수 집합

(All)
Position:1
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Path

Specifies the path to the item or items.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

Path
Position:0
필수:False
파이프라인의 값:True
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-UseTransaction

Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_Transactions.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:usetx

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

입력

String

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

출력

PSObject

This cmdlet returns an object for each item property value that it gets. The object type depends on the property value that is retrieved.

참고

Windows PowerShell includes the following aliases for Get-ItemPropertyValue:

  • gpv

This cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, run the Get-PSProvider cmdlet. For more information, see about_Providers.