This section describes the New-MDTDatabase Windows PowerShell cmdlet. Run this cmdlet from a Windows PowerShell console that has the MDT PowerShell snap-in loaded. For more information on how to start a Windows PowerShell console that has the MDT PowerShell snap-in loaded, see Loading the MDT Windows PowerShell Snap-In.

Syntax

New-MDTDatabase [-Path <String>] [-Force] -SQLServer <String> [-Instance <String>] [-Port <String>] [-Netlib <String>] -Database <String> [-SQLShare <String>] [<CommonParameters>]

Description

This cmdlet creates a new MDT DB database that is associated with a deployment share. Each deployment share can be associated with only one MDT DB database.

Parameters

This subsection provides information about the various parameters that can be used with the New-MDTDatabase cmdlet.

-Path <String>

This parameter specifies the fully qualified Windows PowerShell path to the deployment share to which the new MDT DB database will be associated placed.

Note   If this parameter is not provided, then the Windows PowerShell working directory must default to the desired location within the deployment share.

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-Force [<SwitchParameter>]

This parameter specifies that tables within the MDT DB should be recreated if the database specified in the Database parameter already exist. If this parameter is:

·     Provided, then the tables within an existing MDT DB will be re-created

·     Omitted, then the tables within an existing MDT DB will not be re-created

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

True (ByValue)

Accept wildcard characters?

False

 

-SQLServer <String>

This parameter specifies the name of the computer running SQL Server where the new MDT DB database will be created.

 

Parameter

Value

Required?

True

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-Instance <String>

This parameter specifies the SQL Server instance in which the new MDT DB database will be created. If this parameter is omitted, the MDT DB database is created in the default SQL Server instance.

Note   The SQL Browser service must be running on the computer running SQL Server for the cmdlet to locate the instance specified in this parameter.

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-Port <String>

This parameter specifies the TCP port to be used in communication with the SQL Server instance specified in the SQLServer parameter. The default port that SQL Server uses is 1433. Specify this parameter when SQL Server is configured to use a port other than the default value. The value of this parameter must match the port configured for SQL Server.

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-Netlib <String>

This parameter specifies the SQL network library used in communication with the SQL Server instance specified in the SQLServer parameter. The parameter can be set to one of the following values:

·     DBNMPNTW, which is used to specify named pipes communication

·     DBSMSOCN, which is used to specify TCP/IP sockets communication

If this parameter is not provided, the named pipes SQL network library (DBNMPNTW) is used.

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-Database <String>

This parameter specifies the name of the database to be created in the SQL Server instance specified in the Instance parameter on the SQL Server specified in the SQLServer parameter. The default location and naming convention will be used for the database and log files when creating the database.

If the database specified in this parameter already exists, the database will not be recreated. The tables within the database can be recreated based on the Force parameter.

 

Parameter

Value

Required?

True

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

-SQLShare <String>

This parameter specifies the name of a network shared folder on the computer where SQL Server is running. This connection is used to establish Windows Integrated Security connections using the Named Pipes protocol.

Note   If this parameter is not included, then a secured IPC$ connection is not established. As a result, named pipes communication with SQL Server may fail.

 

Parameter

Value

Required?

False

Position?

Named

Default value

Accept pipeline input?        

False

Accept wildcard characters?

False

 

<CommonParameters>

This cmdlet supports the following common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see the topic, “about_CommonParameters,” which you can access by typing the following command, and then pressing ENTER:

Get-Help about_CommonParameters

Outputs

This cmdlet outputs a PSObject type object for the new MDT DB that was created.

Example 1

New-MDTDatabase -Path "DS001:" –SQLServer "WDG‑SQL‑01" ‑Database "MDTDB" –SQLShare "\\WDG‑SQL‑01\MDTShare$"

Description

This example creates an MDT DB named MDTDB in the default SQL Server instance on a computer named WDG-SQL-01. If the database already exists, the tables in the existing database will not be recreated. The connection will be made using the default SQL Server TCP port and the Named Pipes protocol.

Example 2

New-MDTDatabase -Path "DS001:" –Force –SQLServer "WDG‑SQL‑01" –Instance "MDTInstance" ‑Database "MDTDB" –SQLShare "\\WDG‑SQL‑01\MDTShare$"

Description

This example creates an MDT DB named MDTDB in the SQL Server instance named MDTInstance on a computer named WDG-SQL-01. If the database already exists, the tables in the existing database will be recreated. The connection will be made using the default SQL Server TCP port and the Named Pipes protocol.

Related Topics

MDT Windows PowerShell Cmdlets