I have a powershell script file called test.ps1 written as follows:
in the ps1 file, contents are:
& 'C:\Invoke-Parallel.ps1'
$Sciptblock = {.....}
Invoke-Parallel -scriptblock $Scriptblock -inputobject $(get-content "C:\info.txt") -runspaceTimeout 300 -throttle 30 -NoCloseonTimeOut -quiet
I have a problem running this in windows command prompt because '&' is not invoking the script that I am using (Invoke-Parallel.ps1) for the new script that I created.
I could get this to work when the script runs inside Powershell window or even in Powershell ISE but not in the command line.
Please let me know what command line I need to use to run this successfully or it is not possible to do this in windows commandline. Does anyone have any idea how to fix this? Thanks.
Error I got when I ran this:
The term 'Invoke-Parallel' 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 C:\test.ps1:9 char:16 + Invoke-Parallel <<<< -scriptblock $Scriptblock -inputobject $(get-content "C:\info.txt") -runspaceTimeout 300 -throttle 30 -NoCloseonTimeOut -quiet + CategoryInfo : ObjectNotFound: (Invoke-Parallel:String) [], Com mandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Import-Module C:\Invoke-Parallel.ps1?