Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
I am trying to use workflow to run a python script on different machines. I am doing this because each run takes a long time to complete so I need to run it parallel. I am using the script below. It works if I write out the path but I need to be able to check the path before using it. So I am using another function to do this. The only issue is when I use the other function and then use $using: it makes the arg the path for some reason. I looked around but I cant seem to determine if you can use $using: twice in a Inlinescript. This is the error I am getting.
You cannot call an external function in a workflow.
You do not want to check a path like this since it is on the remote computer. The function does not return a valid share name. It returns an object with all share properties and the "Where" does nothing useful.
To get a share path you will need to use both the actual share name and extract the path:
ERROR: C:\Python27\python.exe: can't open file 'GroupMain': [Errno 2] No such file or directory
ERROR: + CategoryInfo : NotSpecified: (C:\Python27\pyt...le or directory:String) [], RemoteException
ERROR: + FullyQualifiedErrorId : NativeCommandError
ERROR: + PSComputerName : [localhost]
ERROR:
For the second one I am getting nothing. So I changed $args[1] to $args[0] and I get this error.
ERROR: Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then
ERROR: try the command again.
foreachptest (6, 6): ERROR: At Line: 6 char: 6
ERROR: +
ERROR: + CategoryInfo : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException
ERROR: + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand
ERROR: + PSComputerName : [localhost]
ERROR:
ERROR: Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then
ERROR: try the command again.
The funny thing is if I use the below it works with no issue but I am unable to check the share path
This works Thanks! Sorry about the formatting. Quick question. If I put the server name in a file and use GC it looks like workflow does not run parallel. Is there a way to pass a file full over servers into memory and then hand it to the workflow function. Because I am thinking that GC is handing the server names one at a time instead of all at once.
This topic is 4 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.