<?xml version="1.0" encoding="utf-8"?>
<helpItems xmlns="http://msh" schema="maml">

<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<_locDefinition xmlns="urn:locstudio">
    <_locDefault _loc="locNone"/>
    <_locTag _loc="locData">maml:description</_locTag>
    <_locTag _loc="locData">maml:para</_locTag>
    <_locTag _loc="locData">dev:remarks</_locTag>
</_locDefinition>
<!--Generated by Help Cmdlet Editor-->
	<command:details>
		<command:name>Invoke-PolicyEvaluation</command:name>
		<maml:description>
			<maml:para>Evaluates one or more SQL Server Policy-Based Management policies against a target set, either reporting the compliance level of the set, or bringing the set into compliance.</maml:para>
		</maml:description>
		<maml:copyright>
           <maml:para/>
		<!--Add copy right info here.-->
		</maml:copyright>
		<command:verb>Invoke</command:verb>
		<command:noun>PolicyEvaluation</command:noun>
		<!--Add Dev version info here.-->
		<dev:version/>
	</command:details>
	<maml:description>
	<!--This is the Description section-->
		<maml:para>Evaluates one or more Policy-Based Management policies against a set of SQL Server objects named the target set. The policies specify the allowed values for various properties that are associated with SQL Server objects, such as establishing site standards for database names or collations.
When Invoke-PolicyEvaluation runs in check mode, it reports whether the current properties of the objects in the target set comply with the rules policy definitions. The objects in the target set are not reconfigured if their properties do not comply with the policies. In configure mode, Invoke-PolicyEvaluation reconfigures any objects in the target set that do not comply with the policy definitions.</maml:para>
	</maml:description>
	<command:syntax>		<command:syntaxItem>
			<maml:name>Invoke-PolicyEvaluation</maml:name>
			<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="1">
				<maml:name>Policy</maml:name>
				<maml:description>
					<maml:para>Specifies one or more policies to be evaluated. Policies can be stored in an instance of the SQL Server Database Engine, or as exported XML files. For policies that are stored in an instance of the Database Engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices. For policies that are stored as XML files, use a file system path to specify the location the policies.
-Policy can take a string that specifies the names of one or more policies to evaluate. If only a file or policy name is specified in the string, Invoke-PolicyEvaluation uses the setting of the current path. For policies that are stored in an instance of the Database Engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status". For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml".
-Policy can take a set of FileInfo objects, such as the piped output of a Get-ChildItem cmdlet that is run against a folder that contains exported XML policies. -Policy can also take a set of Policy objects, such as the piped output of a Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>AdHocPolicyEvaluationMode</maml:name>
				<maml:description>
					<maml:para>Specifies whether Invoke-PolicyEvaluation only reports on the compliance status of the target set (Check), or if it also reconfigures the target set to comply with the policies (Configure).

Check - Report the compliance status of the target set by using the credentials of your login account, and without reconfiguring any objects.
CheckSqlScriptAsProxy - Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.
Configure - Reconfigure target set objects that do not comply with the policies, and report the resulting status. Invoke-PolicyEvaluation only reconfigures properties that are settable and deterministic.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue>
			</command:parameter>
			<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>TargetServerName</maml:name>
				<maml:description>
					<maml:para>Specifies the instance of the Database Engine that contains the target set. You can specify a variable that contains a Microsoft.SqlServer.Management.Sfc.Sdk.SQLStoreConnection object. You can also specify a string that complies with the formats that are used in the ConnectionString property of the System.Data.SqlClient.SQLConnection class. These include strings such as those created by using the System.Data.SqlClient.SqlConnectionStringBuilder class. By default, Invoke-PolicyEvaluation connects by using Windows Authentication.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>TargetExpression</maml:name>
				<maml:description>
					<maml:para>Specifies a query that returns the list of objects that defines the target set. The queries are specified as a string that has nodes which are separated by the '/' character. Each node is in the format ObjectType[Filter]. ObjectType is one of the objects in the SQL Server Management Objects (SMO) object model, and Filter is an expression that filters for specific objects at that node. The nodes must follow the hierarchy of the SMO objects.
For example, the following query expression returns the AdventureWorks sample database:
"Server[@Name='MyComputer']/Database[@Name='AdventureWorks']"
If -TargetExpression is specified, do not specify -TargetObject.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>OutputXml</maml:name>
				<maml:description>
					<maml:para>Specifies that the Invoke-PolicyEvaluation cmdlet produce its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para>
				</maml:description>
			</command:parameter>
		</command:syntaxItem>
		<command:syntaxItem>
			<maml:name>Invoke-PolicyEvaluation</maml:name>
			<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="1">
				<maml:name>Policy</maml:name>
				<maml:description>
					<maml:para>Specifies one or more policies to be evaluated. Policies can be stored in an instance of the SQL Server Database Engine, or as exported XML files. For policies that are stored in an instance of the Database Engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices. For policies that are stored as XML files, use a file system path to specify the location the policies.
-Policy can take a string that specifies the names of one or more policies to evaluate. If only a file or policy name is specified in the string, Invoke-PolicyEvaluation uses the setting of the current path. For policies that are stored in an instance of the Database Engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status". For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml".
-Policy can take a set of FileInfo objects, such as the piped output of a Get-ChildItem cmdlet that is run against a folder that contains exported XML policies. -Policy can also take a set of Policy objects, such as the piped output of a Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>AdHocPolicyEvaluationMode</maml:name>
				<maml:description>
					<maml:para>Specifies whether Invoke-PolicyEvaluation only reports on the compliance status of the target set (Check), or if it also reconfigures the target set to comply with the policies (Configure).

Check - Report the compliance status of the target set by using the credentials of your login account, and without reconfiguring any objects.
CheckSqlScriptAsProxy - Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.
Configure - Reconfigure target set objects that do not comply with the policies, and report the resulting status. Invoke-PolicyEvaluation only reconfigures properties that are settable and deterministic.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue>
			</command:parameter>
			<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named">
				<maml:name>TargetObjects</maml:name>
				<maml:description>
					<maml:para>Specifies a PSObject or an array of PSObjects that define the set of SQL Server objects against which the policy is evaluated. To connect to an instance of SQL Server Analysis Services, specify a Microsoft.AnalysisServices.Server object for -TargetObject.
If -TargetObject is specified, do not specify -TargetExpression.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="true">PSObject[]</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>OutputXml</maml:name>
				<maml:description>
					<maml:para>Specifies that the Invoke-PolicyEvaluation cmdlet produce its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para>
				</maml:description>
			</command:parameter>
		</command:syntaxItem>
	</command:syntax>
	<command:parameters>
		<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="1">
			<maml:name>Policy</maml:name>
			<maml:description>
				<maml:para>Specifies one or more policies to be evaluated. Policies can be stored in an instance of the SQL Server Database Engine, or as exported XML files. For policies that are stored in an instance of the Database Engine, use a path that is based on the SQLSERVER:\SQLPolicy folder to specify the location of the polices. For policies that are stored as XML files, use a file system path to specify the location the policies.
-Policy can take a string that specifies the names of one or more policies to evaluate. If only a file or policy name is specified in the string, Invoke-PolicyEvaluation uses the setting of the current path. For policies that are stored in an instance of the Database Engine, use the policy name, such as "Database Status" or "SQLSERVER:\SQLPolicy\MyComputer\DEFAULT\Policies\Database Status". For policies that are exported as XML files, use the name of the file, such as "Database Status.xml" or "C:\MyPolicyFolder\Database Status.xml".
-Policy can take a set of FileInfo objects, such as the piped output of a Get-ChildItem cmdlet that is run against a folder that contains exported XML policies. -Policy can also take a set of Policy objects, such as the piped output of a Get-ChildItem run against a SQLSERVER:\SQLPolicy path.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			<dev:type>
				<maml:name>PSObject</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>AdHocPolicyEvaluationMode</maml:name>
			<maml:description>
				<maml:para>Specifies whether Invoke-PolicyEvaluation only reports on the compliance status of the target set (Check), or if it also reconfigures the target set to comply with the policies (Configure).

Check - Report the compliance status of the target set by using the credentials of your login account, and without reconfiguring any objects.
CheckSqlScriptAsProxy - Run a check report by using the ##MS_PolicyTSQLExecutionLogin## proxy account credentials.
Configure - Reconfigure target set objects that do not comply with the policies, and report the resulting status. Invoke-PolicyEvaluation only reconfigures properties that are settable and deterministic.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">AdHocPolicyEvaluationMode</command:parameterValue>
			<dev:type>
				<maml:name>AdHocPolicyEvaluationMode</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>TargetServerName</maml:name>
			<maml:description>
				<maml:para>Specifies the instance of the Database Engine that contains the target set. You can specify a variable that contains a Microsoft.SqlServer.Management.Sfc.Sdk.SQLStoreConnection object. You can also specify a string that complies with the formats that are used in the ConnectionString property of the System.Data.SqlClient.SQLConnection class. These include strings such as those created by using the System.Data.SqlClient.SqlConnectionStringBuilder class. By default, Invoke-PolicyEvaluation connects by using Windows Authentication.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			<dev:type>
				<maml:name>PSObject</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>TargetExpression</maml:name>
			<maml:description>
				<maml:para>Specifies a query that returns the list of objects that defines the target set. The queries are specified as a string that has nodes which are separated by the '/' character. Each node is in the format ObjectType[Filter]. ObjectType is one of the objects in the SQL Server Management Objects (SMO) object model, and Filter is an expression that filters for specific objects at that node. The nodes must follow the hierarchy of the SMO objects.
For example, the following query expression returns the AdventureWorks sample database:
"Server[@Name='MyComputer']/Database[@Name='AdventureWorks']"
If -TargetExpression is specified, do not specify -TargetObject.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>OutputXml</maml:name>
			<maml:description>
				<maml:para>Specifies that the Invoke-PolicyEvaluation cmdlet produce its report in XML format using the Service Modeling Language Interchange Format (SML-IF) schema.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="false" position="named">
			<maml:name>TargetObjects</maml:name>
			<maml:description>
				<maml:para>Specifies a PSObject or an array of PSObjects that define the set of SQL Server objects against which the policy is evaluated. To connect to an instance of SQL Server Analysis Services, specify a Microsoft.AnalysisServices.Server object for -TargetObject.
If -TargetObject is specified, do not specify -TargetExpression.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="true">PSObject[]</command:parameterValue>
			<dev:type>
				<maml:name>PSObject[]</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
	</command:parameters>
	<command:inputTypes>
		<command:inputType>
			<dev:type>
				<maml:name></maml:name>
				<maml:uri/>
				<maml:description>
					<maml:para></maml:para>
				</maml:description>
			</dev:type>
			<maml:description></maml:description>
		</command:inputType>
	</command:inputTypes>
	<command:returnValues>
		<command:returnValue>
			<dev:type>
				<maml:name></maml:name>
				<maml:uri/>
				<maml:description>
					<maml:para></maml:para>
				</maml:description>
			</dev:type>
			<maml:description></maml:description>
		</command:returnValue>
	</command:returnValues>
	<command:terminatingErrors>
	</command:terminatingErrors>
	<command:nonTerminatingErrors>
	</command:nonTerminatingErrors>
	<maml:alertSet>
		<maml:title></maml:title>
		<maml:alert>
			<maml:para></maml:para>
		</maml:alert>
	</maml:alertSet>
	<command:examples>
		<command:example>
			<maml:title>
--------------  Example 1 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server"
sl "100\Tools\Policies\DatabaseEngine\1033"
Invoke-PolicyEvaluation -Policy "Trustworthy Database.xml" -TargetServer "MYCOMPUTER"</dev:code>
  			<dev:remarks>
				<maml:para>Evaluate a policy on the default instance of the specified computer. Read the policy from an XML file and connect by using Windows Authentication.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 2 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server"
sl "100\Tools\Policies\DatabaseEngine\1033"
gci "Database Status.xml", "Trustworthy Database.xml" | Invoke-PolicyEvaluation -TargetServer "MYCOMPUTER"</dev:code>
  			<dev:remarks>
				<maml:para>Use Get-Childitem to read two policies from XML files in a folder, and then pipe them to Invoke-PolicyEvaluation.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 3 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server"
sl "100\Tools\Policies\DatabaseEngine\1033"
Invoke-PolicyEvaluation -Policy "Database Status.xml" -TargetServer "MYCOMPUTER" -OutputXML &gt; C:\MyReportFolder\MyReport.xml</dev:code>
  			<dev:remarks>
				<maml:para>Format the output of a policy evaluation by using the Services Modeling Language Interchange Format (SML-IF) schema, and then redirect the output to a file.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 4 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl SQLSERVER:\SQLPolicy\MYCOMPUTER\DEFAULT\Policies
gci | Where-Object { $_.PolicyCategory -eq "Microsoft Best Practices: Maintenance" } | Invoke-PolicyEvaluation -TargetServer "MYCOMPUTER"</dev:code>
  			<dev:remarks>
				<maml:para>Set the current path to a SQL Server policy store. Use Get-ChildItem to read all the polices, and Where-Object to filter for the policies that have their PolicyCategory property set to "Microsoft Best Practices: Maintenance". Then pipe the filtered set of policies to Invoke-PolicyEvaluation.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 5 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server"
sl "100\Tools\Policies\DatabaseEngine\1033"
$conn = New-Object Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection("server='MYCOMPUTER';Trusted_Connection=True")
Invoke-PolicyEvaluation -Policy "Database Status.xml" -TargetServer $conn</dev:code>
  			<dev:remarks>
				<maml:para>How to use an Sfc.SqlStoreConnection object to specify the target server.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 6 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\program files\Microsoft SQL Server\100
sl "tools\Policies\analysisservices\1033"
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$SSASsvr = new-object Microsoft.AnalysisServices.Server
$SSASsvr.Connect("Data Source=localhost")
Invoke-PolicyEvaluation 'Surface Area Configuration for Analysis Services Features.xml' -TargetObject $SSASsvr</dev:code>
  			<dev:remarks>
				<maml:para>How to load the SQL Server Analysis Services assembly, and then create a connection to the default instance on the local computer and run the Analysis Services surface area configuration policy.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 7 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server"
sl "100\Tools\Policies\DatabaseEngine\1033"
Invoke-PolicyEvaluation "Database Status.xml" -TargetServer "MYCOMPUTER" -TargetExpression "Server[@Name='MYCOMPUTER']/Database[@Name='AdventureWorks']"</dev:code>
  			<dev:remarks>
				<maml:para>Using a -TargetExpression query expression to specify that the Database Status policy be evaluated against the AdventureWorks sample database.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 8 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>sl "C:\Program Files\Microsoft SQL Server\100\Tools\Policies\ReportingServices\1033"
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Dmf.Adapters")
$SSRSsvr = new-object Microsoft.SqlServer.Management.Adapters.RSContainer('MyComputer')
Invoke-PolicyEvaluation -Policy "Surface Area Configuration for Reporting Services 2008 Features.xml" -TargetObject $SSRSsvr</dev:code>
  			<dev:remarks>
				<maml:para>How to loading the SQL Server Reporting Services assembly, and then create a connection to the default instance on the local computer and run the Reporting Services surface area configuration policy.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
	</command:examples>
	<maml:relatedLinks>
		<maml:navigationLink>
			<maml:linkText>SQL Server Books Online: Using the Invoke-PolicyEvaluation cmdlet</maml:linkText>
			<maml:uri/>
		</maml:navigationLink>
	</maml:relatedLinks>
</command:command>
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
<!--Generated by Help Cmdlet Editor-->
	<command:details>
		<command:name>Invoke-Sqlcmd</command:name>
		<maml:description>
			<maml:para>Runs a script containing statements from the languages (Transact-SQL and XQuery) and commands supported by the SQL Server sqlcmd utility.</maml:para>
		</maml:description>
		<maml:copyright>
           <maml:para/>
		<!--Add copy right info here.-->
		</maml:copyright>
		<command:verb>Invoke</command:verb>
		<command:noun>Sqlcmd</command:noun>
		<!--Add Dev version info here.-->
		<dev:version/>
	</command:details>
	<maml:description>
	<!--This is the Description section-->
		<maml:para>Runs a script containing the languages and commands supported by the SQL Server sqlcmd utility. The languages supported are Transact-SQL and the XQuery syntax supported by the Database Engine. Invoke-Sqlcmd also accepts many of the  commands supported by sqlcmd, such as GO and QUIT. Invoke-Sqlcmd accepts the sqlcmd scripting variables, such as SQLCMDUSER. Invoke-Sqlcmd does not set sqlcmd scripting variables by default.
Invoke-Sqlcmd does not support the sqlcmd commands primarily related to interactive script editing. The commands not supported include :!!, :connect, :error, :out, :ed, :list, :listvar, :reset, :perftrace, and :serverlist.
The first result set the script returns is displayed as a formatted table. Result sets after the first are not displayed if their column list is different from the column list of the first result set. If result sets after the first set have the same column list, their rows are appended to the formatted table that contains the rows that were returned by the first result set.
Invoke-Sqlcmd does not return message output, such as the output of PRINT statements, unless you use the PowerShell -Verbose parameter.</maml:para>
	</maml:description>
	<command:syntax>		<command:syntaxItem>
			<maml:name>Invoke-Sqlcmd</maml:name>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named">
				<maml:name>ServerInstance</maml:name>
				<maml:description>
					<maml:para>Character string or SMO server object specifying the name of an instance of the Database Engine. For default instances, only specify the computer name: "MyComputer". For named instances, use the format "ComputerName\InstanceName".</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>Database</maml:name>
				<maml:description>
					<maml:para>A character string specifying the name of a database. Invoke-Sqlcmd connects to this database in the instance that is specified in -ServerInstance.
If -Database is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, Invoke-Sqlcmd connects to the database that is specified in the path. If the path is not based on the SQL folder, or the path does not contain a database name, Invoke-Sqlcmd connects to the default database for the current login ID. If you specify the -IgnoreProviderContext switch, Invoke-Sqlcmd does not consider any database specified in the current path, and connects to the database defined as the default for the current login ID.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>EncryptConnection</maml:name>
				<maml:description>
					<maml:para>Specifies whether Invoke-Sqlcmd uses Secure Sockets Layer (SSL) encryption for the connection to the instance of the Database Engine specified in -ServerInstance. If TRUE is specified SSL encryption is used. If FALSE is specified encryption is not used.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>Username</maml:name>
				<maml:description>
					<maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine. The password must be specified using -Password. If -Username and -Password are not specified, Invoke-Sqlcmd attempts a Windows Authentication connection using the Windows account running the PowerShell session.
When possible, use Windows Authentication.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>Password</maml:name>
				<maml:description>
					<maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in -Username. Passwords are case-sensitive.
When possible, use Windows Authentication.
Do not use a blank password, when possible use a strong password. For more information, see "Strong Password" in SQL Server Books Online.

SECURITY NOTE: If you type -Password followed by your password, the password is visible to anyone who can see your monitor. If you code -Password followed by your password in a .ps1 script, anyone reading the script file will see your password. Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1">
				<maml:name>Query</maml:name>
				<maml:description>
					<maml:para>Specifies one or more queries to be run. The queries can be Transact-SQL or XQuery statements, or sqlcmd commands. Multiple queries separated by a semicolon can be specified. Do not specify the sqlcmd GO separator. Escape any double quotation marks included in the string. Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>QueryTimeout</maml:name>
				<maml:description>
					<maml:para>Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer between 1 and 65535.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>ConnectionTimeout</maml:name>
				<maml:description>
					<maml:para>Specifies the number of seconds when Invoke-Sqlcmd times out if it cannot successfully connect to an instance of the Database Engine. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>ErrorLevel</maml:name>
				<maml:description>
					<maml:para>Specifies that Invoke-Sqlcmd display only error messages whose severity level is equal to or higher than the value specified. All error messages are displayed if -ErrorLevel is not specified or set to 0. Database Engine error severities range from 1 to 24.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>SeverityLevel</maml:name>
				<maml:description>
					<maml:para>Specifies the lower limit for the error message severity level Invoke-Sqlcmd returns to the ERRORLEVEL PowerShell variable. Invoke-Sqlcmd returns the highest severity level from the error messages generated by the queries it runs, provided that severity is equal to or higher than -SeverityLevel. If -SeverityLevel is not specified or set to 0, Invoke-Sqlcmd returns 0 to ERRORLEVEL. The severity levels of Database Engine error messages range from 1 to 24. Invoke-Sqlcmd does not report severities for informational messages that have a severity of 10.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>MaxCharLength</maml:name>
				<maml:description>
					<maml:para>Specifies the maximum number of characters returned for columns with character or Unicode data types, such as char, nchar, varchar, and nvarchar. The default is 4,000 characters.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>MaxBinaryLength</maml:name>
				<maml:description>
					<maml:para>Specifies the maximum number of bytes returned for columns with binary string data types, such as binary and varbinary. The default is 1,024 bytes.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>AbortOnError</maml:name>
				<maml:description>
					<maml:para>Specifies that Invoke-Sqlcmd stop running and return an error level to the PowerShell ERRORLEVEL variable if Invoke-Sqlcmd encounters an error. The error level returned is 1 if the error has a severity higher than 10, and the error level is 0 if the error has a severity of 10 or less. If -ErrorLevel is also specified, Invoke-Sqlcmd returns 1 only if the error message severity is also equal to or higher than the value specified for -ErrorLevel.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>DedicatedAdministratorConnection</maml:name>
				<maml:description>
					<maml:para>Uses a Dedicated Administrator Connection (DAC) to connect to an instance of the Database Engine. DAC is used by system administrators for actions such as troubleshooting instances that will not accept new standard connections. The instance must be configured to support DAC. If DAC is not enabled, Invoke-Sqlcmd reports an error and stops running.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>DisableVariables</maml:name>
				<maml:description>
					<maml:para>Specifies that Invoke-Sqlcmd ignore sqlcmd scripting variables. This is useful when a script contains many INSERT statements that may contain strings that have the same format as variables, such as $(variable_name).</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>DisableCommands</maml:name>
				<maml:description>
					<maml:para>Turns off some sqlcmd features that might compromise security when run in batch files. It prevents PowerShell variables from being passed in to the Invoke-Sqlcmd script. The startup script specified in the SQLCMDINI scripting variable is not run.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>HostName</maml:name>
				<maml:description>
					<maml:para>Specifies a workstation name. The workstation name is reported by the sp_who system stored procedure and in the hostname column of the sys.processes catalog view. If HostName is not specified, the default is the name of the computer on which Invoke-Sqlcmd is running. HostName can be used to identify different Invoke-Sqlcmd sessions.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>NewPassword</maml:name>
				<maml:description>
					<maml:para>Specifies a new password for a SQL Server Authentication login ID. Invoke-Sqlcmd changes the password and then exits. -Username and -Password must also be specified, with -Password specifying the current password for the login.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named">
				<maml:name>Variable</maml:name>
				<maml:description>
					<maml:para>Creates a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. Use a PowerShell array to specify multiple variables and their values.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="true">String[]</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>InputFile</maml:name>
				<maml:description>
					<maml:para>Specifies a file to be used as the query input to Invoke-Sqlcmd. The file can contain Transact-SQL statements, XQuery statements, and sqlcmd commands and scripting variables. Specify the full path to the file. Spaces are not allowed in the file path or file name.
Only run scripts from trusted sources. Ensure all input scripts are secured with the appropriate NTFS permissions.</maml:para>
				</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>OutputSqlErrors</maml:name>
				<maml:description>
					<maml:para>Specifies whether error messages are displayed in the Invoke-Sqlcmd output.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>SuppressProviderContextWarning</maml:name>
				<maml:description>
					<maml:para>Suppresses the warning that Invoke-Sqlcmd has used the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para>
				</maml:description>
			</command:parameter>
			<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
				<maml:name>IgnoreProviderContext</maml:name>
				<maml:description>
					<maml:para>Invoke-Sqlcmd ignores the database context that was established by the current SQLSERVER:\SQL path. If the -Database parameter is not specified, Invoke-Sqlcmd uses the default database for the current login ID or Windows account.</maml:para>
				</maml:description>
			</command:parameter>
		</command:syntaxItem>
	</command:syntax>
	<command:parameters>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named">
			<maml:name>ServerInstance</maml:name>
			<maml:description>
				<maml:para>Character string or SMO server object specifying the name of an instance of the Database Engine. For default instances, only specify the computer name: "MyComputer". For named instances, use the format "ComputerName\InstanceName".</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">PSObject</command:parameterValue>
			<dev:type>
				<maml:name>PSObject</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>Database</maml:name>
			<maml:description>
				<maml:para>A character string specifying the name of a database. Invoke-Sqlcmd connects to this database in the instance that is specified in -ServerInstance.
If -Database is not specified, the database that is used depends on whether the current path specifies both the SQLSERVER:\SQL folder and a database name. If the path specifies both the SQL folder and a database name, Invoke-Sqlcmd connects to the database that is specified in the path. If the path is not based on the SQL folder, or the path does not contain a database name, Invoke-Sqlcmd connects to the default database for the current login ID. If you specify the -IgnoreProviderContext switch, Invoke-Sqlcmd does not consider any database specified in the current path, and connects to the database defined as the default for the current login ID.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>EncryptConnection</maml:name>
			<maml:description>
				<maml:para>Specifies whether Invoke-Sqlcmd uses Secure Sockets Layer (SSL) encryption for the connection to the instance of the Database Engine specified in -ServerInstance. If TRUE is specified SSL encryption is used. If FALSE is specified encryption is not used.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>Username</maml:name>
			<maml:description>
				<maml:para>Specifies the login ID for making a SQL Server Authentication connection to an instance of the Database Engine. The password must be specified using -Password. If -Username and -Password are not specified, Invoke-Sqlcmd attempts a Windows Authentication connection using the Windows account running the PowerShell session.
When possible, use Windows Authentication.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>Password</maml:name>
			<maml:description>
				<maml:para>Specifies the password for the SQL Server Authentication login ID that was specified in -Username. Passwords are case-sensitive.
When possible, use Windows Authentication.
Do not use a blank password, when possible use a strong password. For more information, see "Strong Password" in SQL Server Books Online.

SECURITY NOTE: If you type -Password followed by your password, the password is visible to anyone who can see your monitor. If you code -Password followed by your password in a .ps1 script, anyone reading the script file will see your password. Assign the appropriate NTFS permissions to the file to prevent other users from being able to read the file.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="1">
			<maml:name>Query</maml:name>
			<maml:description>
				<maml:para>Specifies one or more queries to be run. The queries can be Transact-SQL or XQuery statements, or sqlcmd commands. Multiple queries separated by a semicolon can be specified. Do not specify the sqlcmd GO separator. Escape any double quotation marks included in the string. Consider using bracketed identifiers such as [MyTable] instead of quoted identifiers such as "MyTable".</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>QueryTimeout</maml:name>
			<maml:description>
				<maml:para>Specifies the number of seconds before the queries time out. If a timeout value is not specified, the queries do not time out. The timeout must be an integer between 1 and 65535.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>ConnectionTimeout</maml:name>
			<maml:description>
				<maml:para>Specifies the number of seconds when Invoke-Sqlcmd times out if it cannot successfully connect to an instance of the Database Engine. The timeout value must be an integer between 0 and 65534. If 0 is specified, connection attempts do not time out.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>ErrorLevel</maml:name>
			<maml:description>
				<maml:para>Specifies that Invoke-Sqlcmd display only error messages whose severity level is equal to or higher than the value specified. All error messages are displayed if -ErrorLevel is not specified or set to 0. Database Engine error severities range from 1 to 24.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>SeverityLevel</maml:name>
			<maml:description>
				<maml:para>Specifies the lower limit for the error message severity level Invoke-Sqlcmd returns to the ERRORLEVEL PowerShell variable. Invoke-Sqlcmd returns the highest severity level from the error messages generated by the queries it runs, provided that severity is equal to or higher than -SeverityLevel. If -SeverityLevel is not specified or set to 0, Invoke-Sqlcmd returns 0 to ERRORLEVEL. The severity levels of Database Engine error messages range from 1 to 24. Invoke-Sqlcmd does not report severities for informational messages that have a severity of 10.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>MaxCharLength</maml:name>
			<maml:description>
				<maml:para>Specifies the maximum number of characters returned for columns with character or Unicode data types, such as char, nchar, varchar, and nvarchar. The default is 4,000 characters.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>MaxBinaryLength</maml:name>
			<maml:description>
				<maml:para>Specifies the maximum number of bytes returned for columns with binary string data types, such as binary and varbinary. The default is 1,024 bytes.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
			<dev:type>
				<maml:name>Int32</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>AbortOnError</maml:name>
			<maml:description>
				<maml:para>Specifies that Invoke-Sqlcmd stop running and return an error level to the PowerShell ERRORLEVEL variable if Invoke-Sqlcmd encounters an error. The error level returned is 1 if the error has a severity higher than 10, and the error level is 0 if the error has a severity of 10 or less. If -ErrorLevel is also specified, Invoke-Sqlcmd returns 1 only if the error message severity is also equal to or higher than the value specified for -ErrorLevel.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>DedicatedAdministratorConnection</maml:name>
			<maml:description>
				<maml:para>Uses a Dedicated Administrator Connection (DAC) to connect to an instance of the Database Engine. DAC is used by system administrators for actions such as troubleshooting instances that will not accept new standard connections. The instance must be configured to support DAC. If DAC is not enabled, Invoke-Sqlcmd reports an error and stops running.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>DisableVariables</maml:name>
			<maml:description>
				<maml:para>Specifies that Invoke-Sqlcmd ignore sqlcmd scripting variables. This is useful when a script contains many INSERT statements that may contain strings that have the same format as variables, such as $(variable_name).</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>DisableCommands</maml:name>
			<maml:description>
				<maml:para>Turns off some sqlcmd features that might compromise security when run in batch files. It prevents PowerShell variables from being passed in to the Invoke-Sqlcmd script. The startup script specified in the SQLCMDINI scripting variable is not run.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>HostName</maml:name>
			<maml:description>
				<maml:para>Specifies a workstation name. The workstation name is reported by the sp_who system stored procedure and in the hostname column of the sys.processes catalog view. If HostName is not specified, the default is the name of the computer on which Invoke-Sqlcmd is running. HostName can be used to identify different Invoke-Sqlcmd sessions.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>NewPassword</maml:name>
			<maml:description>
				<maml:para>Specifies a new password for a SQL Server Authentication login ID. Invoke-Sqlcmd changes the password and then exits. -Username and -Password must also be specified, with -Password specifying the current password for the login.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="false" position="named">
			<maml:name>Variable</maml:name>
			<maml:description>
				<maml:para>Creates a sqlcmd scripting variable for use in the sqlcmd script, and sets a value for the variable. Use a PowerShell array to specify multiple variables and their values.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="true">String[]</command:parameterValue>
			<dev:type>
				<maml:name>String[]</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>InputFile</maml:name>
			<maml:description>
				<maml:para>Specifies a file to be used as the query input to Invoke-Sqlcmd. The file can contain Transact-SQL statements, XQuery statements, and sqlcmd commands and scripting variables. Specify the full path to the file. Spaces are not allowed in the file path or file name.
Only run scripts from trusted sources. Ensure all input scripts are secured with the appropriate NTFS permissions.</maml:para>
			</maml:description>
			<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
			<dev:type>
				<maml:name>String</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>OutputSqlErrors</maml:name>
			<maml:description>
				<maml:para>Specifies whether error messages are displayed in the Invoke-Sqlcmd output.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>SuppressProviderContextWarning</maml:name>
			<maml:description>
				<maml:para>Suppresses the warning that Invoke-Sqlcmd has used the database context from the current SQLSERVER:\SQL path setting to establish the database context for the cmdlet.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
		<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
			<maml:name>IgnoreProviderContext</maml:name>
			<maml:description>
				<maml:para>Invoke-Sqlcmd ignores the database context that was established by the current SQLSERVER:\SQL path. If the -Database parameter is not specified, Invoke-Sqlcmd uses the default database for the current login ID or Windows account.</maml:para>
			</maml:description>
			<dev:type>
				<maml:name>SwitchParameter</maml:name>
				<maml:uri/>
			</dev:type>
			<dev:defaultValue></dev:defaultValue>
		</command:parameter>
	</command:parameters>
	<command:inputTypes>
		<command:inputType>
			<dev:type>
				<maml:name>PSObject</maml:name>
				<maml:uri/>
				<maml:description>
					<maml:para>A script containing the languages (Transact-SQL and XQuery) and commands supported by the SQL Server sqlcmd utility.</maml:para>
				</maml:description>
			</dev:type>
			<maml:description></maml:description>
		</command:inputType>
	</command:inputTypes>
	<command:returnValues>
		<command:returnValue>
			<dev:type>
				<maml:name>Formatted table</maml:name>
				<maml:uri/>
				<maml:description>
					<maml:para></maml:para>
				</maml:description>
			</dev:type>
			<maml:description></maml:description>
		</command:returnValue>
	</command:returnValues>
	<command:terminatingErrors>
	</command:terminatingErrors>
	<command:nonTerminatingErrors>
	</command:nonTerminatingErrors>
	<maml:alertSet>
		<maml:title></maml:title>
		<maml:alert>
			<maml:para></maml:para>
		</maml:alert>
	</maml:alertSet>
	<command:examples>
		<command:example>
			<maml:title>
--------------  Example 1 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>Invoke-Sqlcmd -Query "SELECT GETDATE() AS TimeOfQuery;" -ServerInstance "MyComputer\MyInstance"</dev:code>
  			<dev:remarks>
				<maml:para>This example connects to a named instance of the Database Engine on a computer and runs a basic Transact-SQL script.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>TimeOfQuery
-----------
10/7/2007 1:04:20 PM
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 2 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>Invoke-Sqlcmd -InputFile "C:\MyFolder\TestSqlCmd.sql" | Out-File -filePath "C:\MyFolder\TestSqlCmd.rpt"</dev:code>
  			<dev:remarks>
				<maml:para>This example reads a file containing Transact-SQL statements and sqlcmd commands, runs the file, and writes the output to another file. Ensure all output files are secured with the appropriate NTFS permissions.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>Output sent to TestSqlCmd.rpt.
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 3 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>$MyArray = "MYVAR1='String1'", "MYVAR2='String2'"
Invoke-Sqlcmd -Query "SELECT `$(MYVAR1) AS Var1, `$(MYVAR2) AS Var2;" -Variable $MyArray</dev:code>
  			<dev:remarks>
				<maml:para>This example uses an array of character strings as input to the -Variable parameter. The array defines multiple sqlcmd variables. The $ signs in the SELECT statement that identify the sqlcmd variables are escaped using the back-tick (`) character.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>Var1                        Var2
----                        ----
String1                     String2
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 4 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>Set-Location SQLSERVER:\SQL\MyComputer\MyInstance
Invoke-Sqlcmd -Query "SELECT GETDATE() AS TimeOfQuery;" -ServerInstance (Get-Item .)</dev:code>
  			<dev:remarks>
				<maml:para>This example uses Set-Location to navigate to the SQL Server PowerShell provider path for an instance of the Database Engine. Then the example uses Get-Item to retrieve an SMO Server object for use as the -ServerInstance parameter of Invoke-Sqlcmd.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>TimeOfQuery
-----------
10/18/2007 8:49:43 PM
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 5 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>Invoke-Sqlcmd -Query "PRINT N'abc'" -Verbose</dev:code>
  			<dev:remarks>
				<maml:para>This example uses the PowerShell -Verbose parameter to return the message output of the PRINT command.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>VERBOSE: abc
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
		<command:example>
			<maml:title>
--------------  Example 6 --------------			</maml:title>
			<maml:introduction>
				<maml:para>C:\PS&gt;</maml:para>
C:\PS&gt;			</maml:introduction>
  			<dev:code>Set-Location SQLSERVER:\SQL\MyComputer\DEFAULT\Databases\AdventureWorks
Invoke-Sqlcmd "SELECT DB_NAME() AS DatabaseName;"</dev:code>
  			<dev:remarks>
				<maml:para>This examples uses a positional string to supply the input to the -Query parameter. It also shows how Invoke-Sqlcmd uses the current path to set the database context to AdventureWorks.</maml:para>
				<maml:para></maml:para>
				<maml:para></maml:para>
				<maml:para>WARNING: Using provider context. Server = MyComputer, Database = AdventureWorks.

DatabaseName
------------
AdventureWorks
				</maml:para>
				<maml:para></maml:para>
  			</dev:remarks>
			<command:commandLines>
				<command:commandLine>
					<command:commandText>
					</command:commandText>
				</command:commandLine>
			</command:commandLines>
		</command:example>
	</command:examples>
	<maml:relatedLinks>
		<maml:navigationLink>
			<maml:linkText>SQL Server Books Online: Transact-SQL Reference</maml:linkText>
			<maml:uri/>
		</maml:navigationLink>
		<maml:navigationLink>
			<maml:linkText>SQL Server Books Online: sqlcmd Utility</maml:linkText>
			<maml:uri/>
		</maml:navigationLink>
		<maml:navigationLink>
			<maml:linkText>SQL Server Books Online: XQuery Reference</maml:linkText>
			<maml:uri/>
		</maml:navigationLink>
	</maml:relatedLinks>
</command:command>
</helpItems>
