93 questions
0
votes
1
answer
35
views
Format change not working if there is small change in input
I have a file with below content, i wanted to convert all the build jobs into a different format like in expected output.
parallel
(
{
build( "job2", parameter3: value3, parameter4: ...
0
votes
1
answer
718
views
PowerShell script doesnt continue after reboot
I am pretty new to PowerShell scripting so I wanted to write a script that helps our apprentices in setting up new laptops for our customers.
This script should rename the computer, then restart it ...
0
votes
0
answers
45
views
Execute command with relative path inside Inline script
I've the following code to execute parallels command in powershell
workflow Test-Workflow {
$Sites = "Param1", "Param2", "Param3"
ForEach -Parallel ($...
0
votes
1
answer
501
views
Powershell Is it possible to start process -wait in parallel
I tried something like this and it starts one after the other
function start-parallel {
workflow work {
start-process $exe1 -wait
start-process $exe2 -wait
}
work
}
0
votes
0
answers
695
views
Error with Powershell Workflow in Automation Account foreach -parallel
I have issues publishing a PowerShell workflow. Most of the script I am using is run in sequence, including the first for loop. But I would like to final for loop to execute in parallel. The code is ...
0
votes
1
answer
325
views
Posh-SSH is giving an error when in WorkFlow
I wrote a script to export rows from a SQL DB, encrypt them using PGP, then transfer them using POSH-SSH v2.3.0. It all works fine, until I put it in a PowerShell WorkFlow to run multiple at a time.
...
0
votes
1
answer
281
views
Azure Automation Runbook Workflow looses AzContext
I have written the following runbook workflow, but from time to time I see the error when it try's to start or stop a VM:
Start-AzVM : Your Azure credentials have not been set up or have expired, ...
0
votes
2
answers
1k
views
Pass multiple arguments/parameters to powershell workflow
I have a powershell workflow script as below:
workflow mytest{
param($param1,$param2,$param3)
//code
}
mytest $param1,$param2,$param3
Issue here is all the three params were received as ...
0
votes
1
answer
382
views
How to get values from workflow parallel code block?
I'm trying to run two Invoke-Sqlcmd in parallel and then wait all the results.
$server1 = '...'
$server2 = '...'
workflow work {
parallel {
$r1 = Invoke-Sqlcmd -ServerInstance $server1 'select ...
0
votes
1
answer
185
views
Include PowerShell Workflow Scripts in a Workflow
I have several Workflow scripts defined.
I want to write a master script to reference the dependent scripts.
I am expecting there is some kind of Import or Include statement to reference the dependent ...
0
votes
1
answer
2k
views
foreach -parallel in PowerShell
I have written a script to get the offline cluster resources using foreach syntax and it is working fine. But I need to get the cluster offline resources for 50 clusters and I have tried foreach -...
0
votes
1
answer
3k
views
Check if a reboot is needed and continue Powershell script after reboot?
This question was asked a few times before but I could not find a solution to my scenario in any of them.
Basically I need the script to continue after it reboots if needed. It will check a few ...
1
vote
1
answer
383
views
How to pass args to the parallel foreach
I get list of endpoints as arguments to my script, I want to send http request to all of them, but I don't want to do it in sequence, but rather simultaneously. I found that there is something like ...
0
votes
1
answer
690
views
Pass arguments to Invoke-Command
This is my script:
workflow Run-RemoteScript {
Param(
[Parameter(Mandatory,Position=0)][string[]]$Targets,
[Parameter(Mandatory,Position=1)][PSCredential]$Credentials,
[...
0
votes
1
answer
3k
views
Parallel T-SQL execution in PowerShell
Can anyone help with this problem? I am referring to a example from the internet for executing T-SQL statements in parallel.
https://www.mssqltips.com/sqlservertip/3539/complete-common-sql-server-...
1
vote
0
answers
263
views
Workflows return unpredictable results on long workflow calls in foreach parallels
When I call a workflow in another workflow's foreach -parallel, I get weird and inconsistent results. Here's some sample code:
workflow test-workflow1 {
Start-Sleep 2
"Stuff"
}
workflow test-...
0
votes
1
answer
546
views
How to iterate over Object properties of an input parameter
I have an Azure Automation Powershell Workflow:
workflow wf
{
param(
[parameter(Mandatory=$True)]
[object] $p
)
inlinescript
{
# ...
}
}
I am testing it using the Test pane and ...
1
vote
1
answer
2k
views
Return multiple values in PowerShell
Given the following Script, how can I return two variables to the main code?
I have tried the return command but show an error. Please find the code and error message below.
Code:
workflow Test-...
0
votes
1
answer
190
views
UNC error on a powershell workflow
When I run the following powershell workflow :
Function Start-LocalRScript {
Param([Parameter(ValueFromPipeline, Mandatory)]$Name)
$ScriptPath = "C:\Exploration.RScripts"
$RScriptExePath = "C:\...
0
votes
2
answers
1k
views
powershell -parallel not working
I am writing a PowerShell script to display the status of free space and CPU, below is snippet:
function Get_FreeSpace ($authType, $comp) {
$freespace = Invoke-Command -ScriptBlock {
Get-...
1
vote
0
answers
369
views
Starting Azure Vm in parallel with runbook throws InvalidOperationException
I'm trying to use Azure runbooks to start virtual machines with a specified tag. I use powershell workflow so i can start them i parallel.
The code below works, but it always have problem starting ...
1
vote
3
answers
4k
views
Running a power shell script in Azure
Hi there I'm new to running powershell scripts in azure and looking for the best guidance ?
I have created a powershell script to locate running machines in a resource group and output to a text file,...
3
votes
3
answers
842
views
Using a recursive function beside a workflow
I have a PowerShell script whose purpose is to get a list of files then do some work on each file.
The list of files is generated by a recursive function like this:
function Recurse($path)
{
.. ...
6
votes
2
answers
10k
views
How to hide console output from Select-AzureRmSubscription
Does anyone know how to hide output from command Select-AzureRmSubscription inside azure workbook which runs as powershell workflow
Thanks
5
votes
2
answers
5k
views
Does powershell's parallel foreach use at most 5 thread?
The throttlelimit parameter of foreach -parallel can control how many processes are used when executing the script. But I can't have more than 5 processes even if I set throttlelimit greater than 5.
...