

Set-ItemProperty -Path "HKLM:\Software\ContosoCompany" -Name "NoOfEmployees" -Value 823 Use Set-ItemProperty to create registry entries, and to establish and change their values. HKLM\Software key and sets its value to 823.īecause registry entries are considered to be properties of the registry keys, which are items, you It creates the "NoOfEmployees" entry in the "ContosoCompany" key in
Change file details comment how to#
This example shows how to use Set-ItemProperty to create a new registry entry and to assign a Set-ItemProperty -Path C:\GroupFiles\final.doc -Name IsReadOnly -Value $true Example 2: Create a registry entry and value For more information, seeĪbout_Automatic_Variables. The $true automatic variable represents a value of "TRUE". To see all of the properties, type Get-Item C:\GroupFiles\final.doc | Get-Member -MemberType Property. The file is a System.IO.FileInfo object and IsReadOnly is just one of its properties. Value parameter to specify the new value. It uses Path to specify the file, Name to specify the name of the property, and the This command sets the value of the IsReadOnly property of the "final.doc" file to "true". Examples Example 1: Set a property of a file You also use Set-ItemProperty to create and change registry values and data.įor example, you can add a new registry entry to a key and establish or change its value. You can use the cmdlet to establish or change the properties of items.įor example, you can use Set-ItemProperty to set the value of the IsReadOnly property of a The Set-ItemProperty cmdlet changes the value of the property of the specified item. Creates or changes the value of a property of an item.
