Poweshell-Commands



Copy-Item Copy-ItemProperty

Example


Copy is alias for Copy-Item
PS C:\Users\Manoj> get-help copy*

Name                              Category  Synopsis
----                              --------  --------
copy                              Alias     Copy-Item
Copy-ItemProperty                 Cmdlet    Copies a property and value from...
Copy-Item                         Cmdlet    Copies an item from one location...

---------------------------------------------------

NAME
    Copy-ItemProperty
    
SYNOPSIS
    Copies a property and value from a specified location to another location.
    
SYNTAX
    Copy-ItemProperty [-LiteralPath]  [-Destination]  [-Name]
      [-Credential ] [-Exclude ] [-Filter ] [-Force] [-Include ] [-PassThru] [-Confirm] [-WhatIf] [-UseT
    ransaction] []
    
    Copy-ItemProperty [-Path]  [-Destination]  [-Name]  [-Credential ] [-Exclude ] [-Filter ] [-
    Force] [-Include ] [-PassThru] [-Confirm] [-WhatIf] [-UseTransact
    ion] []
    
    
DESCRIPTION
    The Copy-ItemProperty cmdlet copies a property and value from a specified l
    ocation to another location. For example, you can use Copy-ItemProperty to 
    copy one or more registry entries from one registry key to another registry
     key.
    

PARAMETERS
    -Credential 
        Specifies a user account that has permission to perform this action. Th
        e default is the current user. 
        
        Type a user name, such as "User01" or "Domain01\User01", or enter a PSC
        redential object, such as one generated by the Get-Credential cmdlet. I
        f you type a user name, you will be prompted for a password.
        
        This parameter is not supported by any providers installed with Windows
         PowerShell.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -Destination 
        Specifies the path to the destination location.
        
        Required?                    true
        Position?                    2
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -Exclude 
        Omits the specified items. Wildcards are permitted.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Filter 
        Specifies a filter in the provider's format or language. The value of t
        his parameter qualifies the Path parameter. The syntax of the filter, i
        ncluding the use of wildcards, depends on the provider. Filters are mor
        e efficient than other parameters, because the provider applies them wh
        en 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 []
        Allows the cmdlet to override restrictions such as renaming existing fi
        les as long as security is not compromised.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Include 
        Specifies only those items upon which the cmdlet will act, excluding al
        l others.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -LiteralPath 
        Specifies a path to the item property. 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 ma
        rks. Single quotation marks tell Windows PowerShell not to interpret an
        y characters as escape sequences.
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -Name 
        Specifies the name of the property to be copied.
        
        Required?                    true
        Position?                    3
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -PassThru []
        Returns an object representing the copied item property. By default, th
        is cmdlet does not generate any output.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies the path to the property to be copied.
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -UseTransaction []
        Includes the command in the active transaction. This parameter is valid
         only when a transaction is in progress. For more information, see abou
        t_Transactions.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".
    
INPUTS
    System.String
        You can pipe a string that contains a path to Copy-ItemProperty.
    
    
OUTPUTS
    None or System.Management.Automation.PSCustomObject
        When you use the Passthru parameter, Copy-ItemProperty generates a PsCu
        stomObject representing the copied item property. Otherwise, this cmdle
        t does not generate any output.
    
    
NOTES
    
    
        The Copy-ItemProperty cmdlet is designed to work with the data exposed 
        by any provider. To list the providers available in your session, type 
        "Get-PSProvider". For more information, see about_Providers.
        
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>copy-itemproperty -path MyApplication -destination HKLM:\Software\MyA
    pplicationRev2 -name MyProperty
    
    
    Description
    -----------
    This command copies the property named MyProperty from the MyApplication re
    gistry key to the MyApplicationRev2 registry key.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113293
    about_Providers 
    Clear-ItemProperty 
    New-ItemProperty 
    Move-ItemProperty 
    Rename-ItemProperty 
    Get-ItemProperty 
    Set-ItemProperty 




NAME
    Copy-Item
    
SYNOPSIS
    Copies an item from one location to another within a namespace.
    
SYNTAX
    Copy-Item [-LiteralPath]  [[-Destination] ] [-Container] 
    [-Credential ] [-Exclude ] [-Filter ] [-For
    ce] [-Include ] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-Use
    Transaction] []
    
    Copy-Item [-Path]  [[-Destination] ] [-Container] [-Crede
    ntial ] [-Exclude ] [-Filter ] [-Force] [-I
    nclude ] [-PassThru] [-Recurse] [-Confirm] [-WhatIf] [-UseTransac
    tion] []
    
    
DESCRIPTION
    The Copy-Item cmdlet copies an item from one location to another in a names
    pace. Copy-Item does not delete the items being copied. The particular item
    s that the cmdlet can copy depend on the Windows PowerShell providers avail
    able. For example, when used with the FileSystem provider, it can copy file
    s and directories and when used with the Registry provider, it can copy reg
    istry keys and entries.
    

PARAMETERS
    -Container []
        Preserves container objects during the copy operation.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Credential 
        Specifies a user account that has permission to perform this action. Th
        e default is the current user. 
        
        Type a user name, such as "User01" or "Domain01\User01", or enter a PSC
        redential object, such as one generated by the Get-Credential cmdlet. I
        f you type a user name, you will be prompted for a password.
        
        This parameter is not supported by any providers installed with Windows
         PowerShell.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -Destination 
        Specifies the path to the location where the items are to be copied.
        
        Required?                    false
        Position?                    2
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -Exclude 
        Omits the specified items. Wildcards are permitted.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Filter 
        Specifies a filter in the provider's format or language. The value of t
        his parameter qualifies the Path parameter. The syntax of the filter, i
        ncluding the use of wildcards, depends on the provider. Filters are mor
        e efficient than other parameters, because the provider applies them wh
        en 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 []
        Allows the cmdlet to copy items that cannot otherwise be changed, such 
        as copying over a read-only file or alias.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Include 
        Specifies only those items upon which the cmdlet will act, excluding al
        l others.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -LiteralPath 
        Specifies a path to the item. The value of the LiteralPath parameter is
         used exactly as it is typed. No characters are interpreted as wildcard
        s. If the path includes escape characters, enclose it in single quotati
        on marks. Single quotation marks tell Windows PowerShell not to interpr
        et any characters as escape sequences.
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false
        
    -PassThru []
        Returns an object representing each copied item. By default, this cmdle
        t does not generate any output.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Path 
        Specifies the path to the items to copy.
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  false
        
    -Recurse []
        Specifies a recursive copy.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Confirm []
        Prompts you for confirmation before executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -WhatIf []
        Describes what would happen if you executed the command without actuall
        y executing the command.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -UseTransaction []
        Includes the command in the active transaction. This parameter is valid
         only when a transaction is in progress. For more information, see abou
        t_Transactions.
        
        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, type,
        "get-help about_commonparameters".
    
INPUTS
    System.String
        You can pipe a string that contains a path to Copy-ItemProperty.
    
    
OUTPUTS
    None or an object representing the copied item.
        When you use the PassThru parameter, Copy-Item returns an object that r
        epresents the copied item. Otherwise, this cmdlet does not generate any
         output.
    
    
NOTES
    
    
        Copy-Item  is like the 'cp' or 'copy' commands in other shells. 
        
        The Copy-Item cmdlet is designed to work with the data exposed by any p
        rovider. To list the providers available in your session, type "Get-PsP
        rovider". For more information, see about_Providers.
        
    
    -------------------------- EXAMPLE 1 --------------------------
    
    C:\PS>copy-item C:\Wabash\Logfiles\mar1604.log.txt -destination C:\Presenta
    tion
    
    
    Description
    -----------
    This command will copy the file mar1604.log.txt to the C:\Presentation dire
    ctory. The command does not delete the original file.
    
    
    
    
    
    -------------------------- EXAMPLE 2 --------------------------
    
    C:\PS>copy-item C:\Logfiles -destination C:\Drawings -recurse
    
    
    Description
    -----------
    This command copies the entire contents of the Logfiles directory into the 
    Drawings directory. If the source directory contains files in subdirectorie
    s, those subdirectories will be copied with their file trees intact. The Co
    ntainer parameter is set to true by default. This preserves the directory s
    tructure.
    
    
    
    
    
    -------------------------- EXAMPLE 3 --------------------------
    
    C:\PS>copy-item C:\Logfiles -destination C:\Drawings\Logs -recurse
    
    
    Description
    -----------
    This command copies the contents of the C:\Logfiles directory to the C:\Dra
    wings\Logs directory. It will create the subdirectory \Logs if it does not 
    already exist.
    
    
    
    
    
    
RELATED LINKS
    Online version: http://go.microsoft.com/fwlink/?LinkID=113292
    about_Providers 
    Clear-Item 
    Get-Item 
    Invoke-Item 
    Move-Item 
    Set-Item 
    New-Item 
    Remove-Item 
    Rename-Item 


Copy and Try it