Set-DotNetConnectionString

Sets a named connection string in the .NET machine.config file

Syntax

Set-DotNetConnectionString [-Name] <String> [-Value] <String> [-Framework] [-Framework64] [-Clr2] [-Clr4] [-WhatIf] [-Confirm] [<CommonParameters>]

Description

The connection string setting can be set in up to four different machine.config files:

Any combination of Framework and Clr switch can be used, but you MUST supply one of each.

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String The name of the .net connection string to be set true false
Value String The connection string to be set. true false
Framework SwitchParameter Set the connection string in the 32-bit machine.config. false false
Framework64 SwitchParameter Set the connection string in the 64-bit machine.config false false
Clr2 SwitchParameter Set the app setting in the .NET 2.0 machine.config. false false
Clr4 SwitchParameter Set the app setting in the .NET 4.0 machine.config. false false
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

EXAMPLE 1

Set-DotNetConnectionString -Name DevDB -Value "data source=.\DevDB;Integrated Security=SSPI;" -Framework -Framework64 -Clr2 -Clr4

Sets the DevDB connection string in the following machine.config files:

EXAMPLE 2

Set-DotNetConnectionString -Name DevDB -Value "data source=.\DevDB;Integrated Security=SSPI;" -Framework64 -Clr4

Sets the DevDB connection string in the following machine.config file: