PowerShell Logo Small

Set-Item



This is the built-in help made by Microsoft for the command 'Set-Item', 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

Changes the value of an item to the value specified in the command.

SYNTAX


Set-Item [-LiteralPath] <string[]> [[-Value] <Object>] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <
string[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]
Set-Item [-Path] <string[]> [[-Value] <Object>] [-Credential <PSCredential>] [-Exclude <string[]>] [-Filter <string>] [-Force] [-Include <string[
]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-Item cmdlet changes the value of an item, such as a variable or registry key, to the value specified in the command.



<

RELATED LINKS

Online version: http://go.microsoft.com/fwlink/?LinkID=113395
about_Providers
Get-Item
New-Item
Remove-Item
Clear-Item
Invoke-Item
Rename-Item
Move-Item
Copy-Item

REMARKS

<

Examples


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

C:\PS>set-item -path alias:np -value c:\windows\notepad.exe



Description
-----------
This command creates an alias of "np" for Notepad.








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

C:\PS>set-item -path env:UserRole -value Administrator



Description
-----------
This command uses the Set-Item cmdlet to change the value of the "UserRole" environment variable to "Administrator".








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

C:\PS>set-item -path function:prompt -value {'PS '+ $(Get-Date -format t) + " " + $(Get-Location) + '> '}



Description
-----------
This command uses the Set-Item cmdlet to change the "prompt" function so that it displays the time before the path.








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

C:\PS>set-item -path function:prompt -options "AllScope,ReadOnly"



Description
-----------
This command sets the AllScope and ReadOnly options for the "prompt" function. This command uses the Options dynamic parameter of the Set-Item cm
dlet. The Options parameter is available in Set-Item only when you use it with the Alias or Function provider.