Guest User

Untitled

a guest
Nov 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #Powershell Workflow InArguments object type sample: the objects can have complex types (not just String, Int)
  2.  
  3. workflow paralleltest {
  4.  
  5. param(
  6. [Object[]]$ServicesList,
  7. [System.ServiceProcess.ServiceController]$FirstService
  8. )
  9.  
  10. InlineScript { Write-Host "output single FirstService object:"}
  11. $FirstService.DisplayName
  12.  
  13. InlineScript {Write-Host "output all services async:"}
  14. foreach -parallel ($service in [System.ServiceProcess.ServiceController[]]$ServicesList) {
  15. $service
  16. }
  17.  
  18. }
  19.  
  20. #get 10 local windows services
  21. $input = Get-Service | Select-Object -first 10;
  22.  
  23. #get type of $input list
  24. $input.GetType().FullName
  25.  
  26. #get type of $input item
  27. $input[0].GetType().FullName
  28.  
  29. #test workflow with arguments of complex types
  30. paralleltest -ServicesList $input -FirstService $input[0]
Add Comment
Please, Sign In to add comment