Sets a named connection string in the .NET machine.config file
Set-DotNetConnectionString [-Name] <String> [-Value] <String> [-Framework] [-Framework64] [-Clr2] [-Clr4] [-WhatIf] [-Confirm] [<CommonParameters>]
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.
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 . |
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:
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
%SYSTEMROOT%\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config
%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config
Set-DotNetConnectionString -Name DevDB -Value "data source=.\DevDB;Integrated Security=SSPI;" -Framework64 -Clr4
Sets the DevDB connection string in the following machine.config file:
%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.config