< Back

Set-ConfigData

Thu Jan 16, 2020 8:26 am

NAME Set-ConfigData



SYNOPSIS

Set data in a JSON config file





SYNTAX

Set-ConfigData [-Name] <String> [-Value] <Object> [-Encrypt] [[-JsonDepth] <Int32>] [[-Path] <String>] [-WhatIf]

[-Confirm] [<CommonParameters>]





DESCRIPTION





PARAMETERS

-Name <String>

Name of the config data to set



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value <Object>

Object to save in the config. May be simple or an object to ConvertTo-Json



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Encrypt [<SwitchParameter>]

Encrypt the data when storing it. Only the current user can decrypt it.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-JsonDepth <Int32>

The -Depth parameter for ConvertTo-Json defaults to 2



Required? false

Position? 3

Default value 2

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

Path to the config file



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Currently encryption only supported on Windows. On Linux/OSX secure the config file.



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



PS C:\\>Set-ConfigData -Name ItemName -Value "testing123" $env:home/myconfig.json















RELATED LINKS