Skip to content

Instantly share code, notes, and snippets.

@orosandrei
Last active November 21, 2017 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orosandrei/9c6abdc9843c8d39748edcc1c9782005 to your computer and use it in GitHub Desktop.
Save orosandrei/9c6abdc9843c8d39748edcc1c9782005 to your computer and use it in GitHub Desktop.
Powershell Workflow InArguments object type sample: the objects can have complex types (not just String, Int)
#Powershell Workflow InArguments object type sample: the objects can have complex types (not just String, Int)
workflow paralleltest {
param(
[Object[]]$ServicesList,
[System.ServiceProcess.ServiceController]$FirstService
)
InlineScript { Write-Host "output single FirstService object:"}
$FirstService.DisplayName
InlineScript {Write-Host "output all services async:"}
foreach -parallel ($service in [System.ServiceProcess.ServiceController[]]$ServicesList) {
$service
}
}
#get 10 local windows services
$input = Get-Service | Select-Object -first 10;
#get type of $input list
$input.GetType().FullName
#get type of $input item
$input[0].GetType().FullName
#test workflow with arguments of complex types
paralleltest -ServicesList $input -FirstService $input[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment