Last active
March 6, 2018 21:05
-
-
Save alainassaf/c3821f90b3a0c2ad6e977645d27d2cdd to your computer and use it in GitHub Desktop.
showflow example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# *** START: ShowFlow ********************************************************* | |
if ($ShowFlow) { | |
# Install GraphViz from the Chocolatey repo | |
#Register-PackageSource -Name Chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/ | |
Find-Package graphviz | Install-Package -ForceBootstrap | |
# Install PSGraph from the Powershell Gallery | |
Find-Module PSGraph | Install-Module | |
# Import Module PSGraph | |
Import-Module PSGraph | |
graph killprocess { | |
node start @{label = "Script Start"; shape = 'oval'} | |
#Confrim Delivery Group Exists | |
edge start, DG | |
node DG @{label = "Does delivery`ngroup exist?"; shape = "diamond"} | |
node dgYes @{label = "Seach delivery group`nfor published application"} | |
node dgNo @{label = "Seach all servers for`npublished application"} | |
edge DG, dgNo | |
edge DG, dgYes | |
#Confirm Published Application Exists | |
edge dgNo, pubapp | |
edge dgYes, pubapp | |
node pubapp @{label = "Does Pub`nApp Exist?"; shape = "diamond"} | |
node pubappYes @{label = "YES"} | |
node pubappNo @{label = "NO"} | |
edge pubapp, pubappYes | |
edge pubapp, pubappNo | |
#Get List of users who are running Published Application | |
node getUsers @{label = "Get users running`npublished application"; shape = "rectangle"} | |
edge pubappYes, getUsers | |
#Check if threshold met | |
edge getUsers, threshhold | |
node threshhold @{label = "Does count of the`npublished application`nexceed threshold?"; shape = "diamond"} | |
node threshholdYes @{label = "YES"} | |
node threshholdNo @{label = "NO"} | |
Edge threshhold, threshholdYes | |
Edge threshhold, threshholdNo | |
#If not report and stop script | |
node report @{label = "Generate log`nand email report"; shape = "rectangle"} | |
Edge threshholdNo, report | |
#If so start iterating through user list and stop the process associated with published application | |
node killProcess @{label = "Loop through sessions`nand stop published`napplication"; shape = "invtrapezium"} | |
Edge threshholdYes, killProcess | |
edge killProcess, report @{label = "Completed`nloop"} | |
#End script | |
edge pubappNo, end | |
edge report, end | |
node end @{label = "Script End"; shape = 'oval'} | |
} | Show-PSGraph | |
Write-Verbose "Script flow chart displayed. Script exiting..." | |
Exit 0 | |
} | |
# *** END: ShowFlow *********************************************************** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment