Create a common database object.
New-DbProviderObject.ps1 [-TypeName] <String> [[-InitialValue] <String>] [-Provider <String>]
[[-ConnectionString] <String>] [-StoredProcedure] [-OpenConnection] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
New-DbProviderObject.ps1 SqlClient ConnectionStringBuilder 'Server=ServerName;Database=DbName;Integrated Security=True'
Key Value — —– Data Source ServerName Initial Catalog DbName Integrated Security True
$conn = New-DbProviderObject.ps1 SqlClient Connection $connstr -Open
($conn contains an open DbConnection object.)
$cmd = New-DbProviderObject.ps1 odbc Command -ConnectionString $connstr -StoredProcedure -OpenConnection
($cmd contains a DbCommand with a CommandType of StoredProcedure and an open connection to $connstr.)
The type of object to create.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A value to initialize the object with, such as CommandText for a Command object, or a ConnectionString for a Connection or ConnectionStringBuilder.
Type: String
Parameter Sets: (All)
Aliases: Value
Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
The DbProviderFactory subclass to use to create the object.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Sql
Accept pipeline input: False
Accept wildcard characters: False
A connection string to use (when creating a Command object). No connection will be made if not specified.
Type: String
Parameter Sets: (All)
Aliases: CS
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Sets the CommandType property of a Command object to StoredProcedure. Ignored for other objects.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Opens the Connection object (or Command connection) if an InitialValue was provided, ignored otherwise.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
https://msdn.microsoft.com/library/system.data.common.dbproviderfactories.aspx