PowerShell Logo Small

New-ItemProperty



This is the built-in help made by Microsoft for the command 'New-ItemProperty', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates a new property for an item and sets its value. For example, you can use New-ItemProperty to create and change registry values and data, which are properties of a registry key.

SYNTAX


New-ItemProperty [-LiteralPath] <string[]> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Incl
ude <string[]>] [-PropertyType <string>] [-Value <Object>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
New-ItemProperty [-Path] <string[]> [-Name] <string> [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <st
ring[]>] [-PropertyType <string>] [-Value <Object>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


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. To add a property to an instance of an object, use the Add-Member cmdlet. To add a property to
all objects of a particular type, edit the Types.ps1xml file.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113354
about_Providers
Clear-ItemProperty
Copy-ItemProperty
Move-ItemProperty
Rename-ItemProperty
Get-ItemProperty
Set-ItemProperty
Remove-ItemProperty

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>new-itemproperty -path HKLM:\Software\MyCompany -name NoOfEmployees -value 822

C:\PS> get-itemproperty hklm:\software\mycompany


PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software\mycompany
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\software
PSChildName : mycompany
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry
NoOfLocations : 2
NoOfEmployees : 822



Description
-----------
This command adds a new registry entry, NoOfEmployees, to the MyCompany key of the HKLM:\Software hive.

The first command uses the Path parameter to specify the path to the MyCompany registry key. It uses the Name parameter to specify a name for the
entry and the Value parameter to specify its value.

The second command uses the Get-ItemProperty cmdlet to see the new registry entry.








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

C:\PS>get-item -path HKLM:\Software\MyCompany | new-Itemproperty -name NoOfLocations -value 3



Description
-----------
This command adds a new registry entry to a registry key. To specify the key, it uses a pipeline operator (|) to send an object representing the
key to the New-ItemProperty cmdlet.

The first part of the command uses the Get-Item cmdlet to get the MyCompany registry key. The pipeline operator (|) sends the results of the comm
and to the New-ItemProperty cmdlet, which adds the new registry entry, NoOfLocations, and its value, 3, to the MyCompany key.

This command works because the parameter-binding feature of Windows PowerShell associates the path of the RegistryKey object that Get-Item return
s with the LiteralPath parameter of New-ItemProperty. For more information, see about_Pipelines.