Hello,
I have a workflow which is saved as psm1. I import the module and have certain commands that need to execute by calling workflows in the module. These commands are saved as ps1 file. I would like to run these commands in parallel.
Below is the code:
Import-Module CMHealth.psm1 Workflow RunChecks { Parallel { #Common Checks InlineScript{$OnlineStatus | Select -Property ServerName, DNS, IP, Ping, Error | Export-Csv -Path D:\CMHealth\Build\OnlineStatus.csv -NoTypeInformation} InlineScript{Check-DiskSpace -SrvList $OnlineMachines | Select -Property ServerName, DriveName, TotalSpace, UsedSpace, FreeSpace, PercentFree | Export-Csv -Path D:\CMHealth\Build\DiskSpace.csv -NoTypeInformation} #Checks for Site Server InlineScript{Check-Services -SrvList $OnlineMachines -SvcName $SiteServices | Select -Property ServerName, ServiceName, DisplayName, StartMode, State | Export-Csv -Path D:\CMHealth\Build\SiteServerServices.csv -NoTypeInformation} #Checks for DBServer InlineScript{Check-Services -SRVList $DBServers -SvCName $DBServices | Select -Property ServerName, ServiceName, DisplayName, StartMode, State | Export-Csv -Path D:\CMHealth\Build\DBServerServices.csv -NoTypeInformation} #Checks for MP InlineScript{Check-MPStatus -SRVList $MPServers | Select -Property ServerName, URL, StatusCode, StatusDescription | Export-Csv -Path D:\CMHealth\Build\MPStatus.csv -NoTypeInformation} InlineScript{Check-Services -SrvList $OnlineMachines -SvcName $MPServices | Select -Property ServerName, ServiceName, DisplayName, StartMode, State | Export-Csv -Path D:\CMHealth\Build\MPServices.csv -NoTypeInformation} } }
RunChecks
When I execute the ps1, I get the below error:
Check-DiskSpace : The term 'Check-DiskSpace' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At RunChecks:53 char:53+ + CategoryInfo : ObjectNotFound: (Check-DiskSpace:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException+ PSComputerName : [localhost] Check-Services : The term 'Check-Services' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At RunChecks:53 char:53+ + CategoryInfo : ObjectNotFound: (Check-Services:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException+ PSComputerName : [localhost] Check-Services : The term 'Check-Services' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At RunChecks:53 char:53+ + CategoryInfo : ObjectNotFound: (Check-Services:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException+ PSComputerName : [localhost] Check-MPStatus : The term 'Check-MPStatus' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At RunChecks:53 char:53+ + CategoryInfo : ObjectNotFound: (Check-MPStatus:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException+ PSComputerName : [localhost] Check-Services : The term 'Check-Services' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At RunChecks:53 char:53+ + CategoryInfo : ObjectNotFound: (Check-Services:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException+ PSComputerName : [localhost]
Please help. Thanks in advance
Rajiv