DAC Connection using the SSMS for executing the code Can anyone help me on below . I am trying to execute the SQLCMD with DAC (-A switch) but unable to do so .

How can I do it both ways below :


Execute in SSMS Query Pane 
Execute using PowerShell 


Below is what I have tried with no luck .

EXEC master.dbo.xp_cmdshell "SQLCMD -S SQLServer -d Db1 -A
go
select count(*) AS FileCount from TableName
go"


output


  'select' is not recognized as an internal or external command,
  operable program or batch file. NULL


Message


  Msg 103, Level 15, State 4, Line 1 The identifier that starts with '


SQLCMD -S SQLServer -d Db1 -A
go
select count(*) AS FileCount' is too long. Maximum length is 128.
You should pass in your query according to sqlcmd syntax specifying -Q (or -q or -i for the script file) like this:

EXEC master.dbo.xp_cmdshell 'SQLCMD -S SQLServer -A -d Db1 -Q"select count(*) AS FileCount from TableName" '