
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Parallel and Sequence Execution in PowerShell Workflow
PowerShell workflows are the best way to design the script to execute on more than one node parallel which saves extensive time for the output to produce but we always don’t want to run all the commands parallel but also need some of them to run sequentially and we can design both Parallel and Sequence commands using PowerShell Workflow.
Workflow TestWorkflow{ parallel{ Command1 Command2 } Sequence{ Command3 Command4 } } TestWorkflow
In the above code, Command1, Command2 will be executed parallelly in any order while command3 and command4 will be executed in a serial manner because they are inside the sequence block as shown with the below example.
Example
Workflow TestWorkflow{ parallel{ Get-CimInstance Win32_LogicalDisk Get-CimInstance Win32_BIOS } sequence{ Get-Service WinRM Get-Process Notepad++ } } TestWorkFlow
Output
TestWorkFlow SMBIOSBIOSVersion : F.13 Manufacturer : AMI Name : F.13 SerialNumber : 5CD015JY8D Version : HPQOEM - 1072009 PSComputerName : DeviceID : C: DriveType : 3 ProviderName : FreeSpace : 219602677760 Size : 511123124224 VolumeName : OSDisk PSComputerName : Status : Running Name : WinRM DisplayName : Windows Remote Management (WS-Management) PSComputerName : localhost Id : 676 Handles : 738 CPU : 15.875 Name : notepad++ PSComputerName : localhost
Advertisements