RuS*_*SSe 3 powershell maintenance automation azure runbook
我已完成以下教程的所有步骤,以获得用于自动化索引和统计维护的Runbook:
我能够毫无错误地完成所有教程,但是当我执行Runbook时,它返回一个错误:
Invoke-Sqlcmd : The term 'Invoke-Sqlcmd' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:6 char:16
+ $SQLOutput = $(Invoke-Sqlcmd -ServerInstance $AzureSQLServerName -Use ...
+ ~~~~~~~~~~~~~
+ CategoryInfo: ObjectNotFound: (Invoke-Sqlcmd:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)
我能做什么?我在Azure中使用SQL Server.具体而言,Azure SQL数据库具有定价/模型层"S4标准(200 DTU)".
关注那个博客,我转载了你的错误.
您可以通过此页面部署sqlserver模块:
这是我的Runbook:
$AzureSQLServerName = "jasonsql"
$AzureSQLDatabaseName = "jasondatabase"
$AzureSQLServerName = $AzureSQLServerName + ".database.windows.net"
$Cred = Get-AutomationPSCredential -Name "SQLLogin"
$SQLOutput = $(Invoke-Sqlcmd -ServerInstance $AzureSQLServerName -Username $Cred.UserName -Password $Cred.GetNetworkCredential().Password -Database $AzureSQLDatabaseName -Query "SELECT * FROM INFORMATION_SCHEMA.TABLES " -QueryTimeout 65535 -ConnectionTimeout 60 -Verbose) 4>&1
Write-Output $SQLOutput
Run Code Online (Sandbox Code Playgroud)
结果如下:
希望这可以帮助.
归档时间: |
|
查看次数: |
1775 次 |
最近记录: |