I am testing a powershell script when executed from a deployment server. The deployment server is ansible and this calls powershell. The powershell script is as follows.
workflow Test-ParallelForeachSQL
{
param
(
[String[]]
$instances
)
foreach -parallel -throttlelimit 8 ($instance in $instances)
{
"Begin $instance"
Invoke-SQLCMD -ServerInstance $instance -database "master" -query "select @@servername"
"End $instance"
}
}
Test-ParallelForeachSQL -instance "SQLServer,1433"
I get the error
Cannot find drive. A drive with the name 'SQLSERVER' does not exists
+ CategoryInfo: ObjectNotFound: (SQLSERVER:String){} ParentContainsErrorRecordException
+ FullyQualifiedErrorID: DriveNotFound
+ PSComputerName: Localhost
Placing the invoke-sqlcmd command in an inline script simply makes the process stall. It starts and never completes within ansible tower.
Any ideas for this behaviour.
