PowerShell Logo Small

Set-Item



This is the built-in help made by Microsoft for the command 'Set-Item', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' 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 [-Path] <String[]> [[-Value] <Object>] [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include
<String[]>] [-PassThru] [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Set-Item [[-Value] <Object>] [-Credential <PSCredential>] [-Exclude <String[]>] [-Filter <String>] [-Force] [-Include <String[]>] [-PassThru]
-LiteralPath <String[]> [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<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
Clear-Item
Copy-Item
Get-Item
Invoke-Item
Move-Item
New-Item
Remove-Item
Rename-Item
about_Providers

REMARKS

<

Examples


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

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



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








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

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



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








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

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



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








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

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



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