• Narrow screen resolution
  • Wide screen resolution
  • Increase font size
  • Decrease font size
  • Default font size
  • default color
  • red color
© Diana Scherff, Amas-Veritas.com

Welcome to Amas Veritas [dot] com

Updates: Media (lyrics) has a new layout. I could never figure out how to lay it out, but it's easier to navigate now. I'm still working on a better duplicate Mamblog mod. I'm trying to make submittions easier but the poetry form died for some reason. Quizzes are also on their way from the old site. Joomla content isn't very code friendly so I'm having to rewrite old code. You can still click on News > AH v21 > Screen if you wish to use the quizzes.
 
Home arrow Tools arrow Windows PowerShell arrow Get-Item [gi]
Get-Item [gi] Print E-mail
Written by Diana, on 04-09-2007 02:11
Views 120    
Favoured None

PS C:\Users\Admin> help gi -full

NAME
    Get-Item

SYNOPSIS
    Gets the item at the specified location.

SYNTAX
    Get-Item [-path] <string[]> [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-force] [-credential <PSCredential>] [<CommonParameters>]

    Get-Item [-literalPath] <string[]> [-include <string[]>] [-exclude <string[]>] [-filter <string>] [-force] [-credential <PSCredential>] [<CommonParameters>]


DETAILED DESCRIPTION
    The Get-Item cmdlet gets the item at the specified location. It does not get contents of the item at the location, unless you use a wildcard character (*) to request all contents of the item.

    The Get-Item cmdlet is used by Windows PowerShell providers to enable you to navigate through different types of data stores.


PARAMETERS
    -path <string[]>
        Specifies the path to an item. Get-Item gets the item at the specified location. Wildcards are permitted. This parameter is required, but the parameter name ("-Path") is optional.

        Use a dot (.) to specify the current location. Use the wildcard character (*) to specify the all items in the current location.

        Required?                    true
        Position?                    1
        Default value                <Current Location>
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  true

    -include <string[]>
        Retrieves only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted.

        The Include parameter is effective only when the command includes the contents of a item, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  true

    -exclude <string[]>
        Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or pattern, such as "*.txt". Wildcards are permitted.

        The Exclude parameter is effective only when the command includes the contents of a item, such as C:\Windows\*, where the wildcard character specifies the contents of the C:\Windows directory.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  true

    -filter <string>
        Specifies a filter in the provider's format or language. The value of this parameter qualifies the Path parameter. The syntax of the filter, including the use of wildcards, depends on the provider. Filters are more efficient than other parameters, because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter the objects after they are retrieved.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?       false
        Accept wildcard characters?  false

    -force <SwitchParameter>
        Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security. For example, Force will override the read-only attribute or create directories to complete a file path, but it will not attempt to change file permissions.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wilĂcard characters?  false

    -credential <PSCredential>
        Uses a credential to validate access to the file. <Credential> represents a user-name, such as "User01" or "Domain01\User01", or a PSCredential object, such as the one retrieved by using the Get-Credential cmdlet. If you type a user name, you will be prompted for a password. This parameterappears, but it is not supported in any Windows PowerShell core cmdlets or providers.

        Required?                    false
        Position?                    named
        Default value
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false

    -literalPath <string[]>
        Specifies a path to the item. Unlike Path, 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 Windows PowerShell not to interpret any characters as escape sequences.

        Required?                    true
        Position?                    1
        Default value
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false

    <CommonParameters>
        This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".


INPUT TYPE
    String


RETURN TYPE
    Any


NOTES


        For more information, type "Get-Help Get-Item -detailed". For technical information, type "Get-Help Get-Item -full".

        Get-Item does not have a Recurse parameter, because it gets only an item, not its contents. To get the contents of an item recursively, use Get-Childitem.

        To navigate through the registry, use Get-Item to get registry keys and Get-ItemProperty to get registry values and data. The registry values are considered to be properties of the registry key.

        When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

        You can also refer to Get-Item by its built-in alias, "gi". For more information, see About_Alias.


    ----------------- EXAMPLE 1 --------------Ă--

    C:\PS>get-item .


    This command gets the current directory. The dot (.) represents the item at the current location (not its contents).


    Directory: Microsoft.PowerShell.Core\FileSystem::C:\

    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----         7/26/2006  10:01 AM            ps-test


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

    C:\PS>get-item *


    This command gets all items in the current directory. The wildcard character (*) represents all contents of the current item.


    Directory: Microsoft.PowerShell.Core\FileSystem::C:\ps-test

    Mode                LastWriteTime     Length Name
    ----                -------------     ------ ----
    d----         7/26/2006  9:29 AM             Logs
    d----         7/26/2006  9:26 AM             Recs
    -a---         7/26/2006  9:28 AM         80  date.csv
    -a---         7/26/2006  10:01 AM        30  filenoext
    -a---         7/26/2006  9:30 AM      11472  process.doc
    -a---         7/14/2006  10:47 AM        30  test.txt


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

    C:\PS>get-item C:\


    This command gets the current directory of the C: drive. The object that is retrieved represents only the directory, not its contents.





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

    C:\PS>get-item C:\*


    This command gets the items in the C: drive. The wildcard character (*) represents all items in the container, and not just the container.

    In PowerShell, use a single asterisk (*) to get contents, instead of the traditional "*.*". In PowerShell, the format is interpreted literally, so "*.*" would not retrieve directories or file names without a dot.





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

    C:\PS>(get-item C:\Windows).LastAccessTime


    This command gets the LastAccessTime property of the C:\WĂndows directory. LastAccessTime is just one property of file system directories. To see all of the properties of a directory, type "(Get-Item <directory-name>) | Get-Member".





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

    C:\PS>get-item hklm:\software\microsoft\powershell\1\shellids\microsoft.powershell\*


    This command shows the contents of the Microsoft.PowerShell registry key. You can use Get-Item with the Windows PowerShell Registry provider to get registry keys and subkeys, but you must use Get-ItemProperty to get the registry values and data.





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

    C:\PS>get-item c:\Windows\* -include *.* -exclude w*


    This command gets items in the Windows directory with names that include a dot (.), but do not begin with w*. This command works only when the path includes a wildcard character (*) to specify the contents of the item.






RELATED LINKS
    Clear-Item
    Copy-Item
    Invoke-Item
    Move-Item
    Set-Item
    New-Item
    Remove-Item
    Rename-Item
    about_namespace


Last update: 04-09-2007 02:11

Published in : Tools, Windows PowerShell

Users' Comments (0) RSS feed comment

No comment posted

Add your comment



mXcomment 1.0.4 © 2007-2009 - visualclinic.fr
License Creative Commons - Some rights reserved
 
< Prev   Next >




Double click any word on this page for a definition.
Using Firefox? Enable definitions by downloading the extension.
Sorry, this feature does not currently work in Opera or Safari.

No Users Online

Statistics

OS: FreeBSD
PHP: 5.2.1
MySQL: 4.1.21-log
Time: 21:33
Caching: Disabled
GZIP: Disabled
Members: 36
News: 2448
Web Links: 39
Visitors: 1443465

Syndicate

Login

Particls