In this article, the cmdlet “Get-Item” of PowerShell will be illustrated in detail.
How to Use Get-Item (Microsoft.PowerShell.Management) Cmdlet in PowerShell?
To get the items at a specified location, use the “Get-Item” cmdlet and then provide the item, such as a directory, registry key, or file. Examples demonstrating the stated cmdlet are specified under.
Example 1: Use the “Get-Item” Cmdlet to Retrieve the Current Working Directory
Execute the “Get-Item” cmdlet along with the “.” to get the current directory:
Example 2: Use the “Get-Item” Cmdlet to Get the Current Directories Detail
Use the “Get-Item” cmdlet along with the “*” wildcard character to get the details of the current directory:
Example 3: Use the “Get-Item” Cmdlet to Get the Items in the Specified Directory
To retrieve the items of the specified directory, use the “Get-Item” cmdlet along with the directory address and a wild “*” character:
Example 4: Use the “Get-Item” Cmdlet to Get the Last Access Time of a Property in the Specified Location
Concatenate the “LastAccessTime” with the “Get-Item” cmdlet and the directory address to retrieve its last access time:
That’s all! We have illustrated the “Get-Item” cmdlet in detail.
Conclusion
PowerShell’s “Get-Item” cmdlet is used to retrieve the items at a specified location. These items include a file, directory, or a registry. However, it does not get the content of an item. In this post, the “Get-Item” cmdlet has been demonstrated with the assistance of several examples.