无法在PowerShell工作流程中打印变量

2022-01-28 07:21:14 标签 windowspowershellpowershell-workflow

我使用下面的Powershell工作流脚本。我在Windows ISE上运行这个。

我不能打印变量$ElasticPoolList来查看输出。

谁能告诉我如何打印PowerShell工作流的变量。

clear-host
workflow index_job {
   
    $FullServerName='dev.database.windows.net'
    $masterDB='master'
$UserName='someUserName'
$Password= 'somePassword'
$ElasticPoolList = inlinescript{
         $UserName =$Using:UserName
         $Password = $Using:Password
         $ServerName = $Using:ServerName
         $FullServerName = $Using:FullServerName
         $masterDB = $Using:masterDB
$ElasticPoolListDBNames=@"
SELECT DISTINCT elastic_pool_name
FROM sys.database_service_objectives
WHERE elastic_pool_name IS NOT NULL
UNION ALL
SELECT d.name AS elastic_pool_name
FROM sys.databases d
INNER JOIN sys.database_service_objectives dso ON d.database_id = dso.database_id
WHERE d.Name <> 'master'
AND dso.elastic_pool_name IS NULL
"@
$ElasticPoolListDBNames_Conn=Invoke-Sqlcmd -ServerInstance $FullServerName    -Database $masterDB -Username $UserName -Password $Password -Query $ElasticPoolListDBNames
}
$ElasticPoolList
foreach -parallel($pool in $ElasticPoolList){
     Write-output "Inside Pool:" $pool
}
}
# To call the workflow
index_job 

在输出窗口中,我想将输出打印为

阅读全文

▼ 版权说明

相关文章也很精彩
推荐内容
更多标签
相关热门
全站排行
随便看看

错说 cuoshuo.com —— 程序员的报错记录

部分内容根据CC版权协议转载;网站内容仅供参考,生产环境使用务必查阅官方文档

辽ICP备19011660号-5

×

扫码关注公众号:职场神器
发送: 1
获取永久解锁本站全部文章的验证码