cancel
Showing results for 
Search instead for 
Did you mean: 
cccn714
Active Contributor

Can Powershell Scripts be ran from One2Many

I am trying to run a .ps1 script using One2Many. I have pushed a file to a system file.ps1. Then I want to execute it via a seperate One2Many task. I have tried executing it directly with a Custom task and via a batch script. Both give me the error File.ps1 "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." 

 

Is there Powershell support in One2Many? What is the best way to do this. 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
cccn714
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

Thanks will be reworking the scripts and custom tasks soon and will let the thread know the results when I do.

View solution in original post

6 REPLIES 6
JoJenkinsIsHere
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

Use remote comand then have the file on the machine.  Also you have to make sure all your needed modules are there for powershell.

 

powershell.exe -command "& 'C:\location\to\shell.ps1'"

cccn714
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

Thanks I will give it a shot. 

Beep-Beep
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

Custom task.

Upload .ps1 and any other resources needed

 

Command:

powershell -executionpolicy bypass -file <name of file you uploaded>.ps1

cccn714
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

Thanks will be reworking the scripts and custom tasks soon and will let the thread know the results when I do.

cccn714
Active Contributor

Re: Can Powershell Scripts be ran from One2Many

This is what worked.

Once the files were uploaded to the systems I created a .bat to run the following command

Powershell.exe -executionpolicy remotesigned -Command "C:\filepath\file.ps1"

MIA-usr
New Member

Re: Can Powershell Scripts be ran from One2Many

@cccn714  Can you share how you created the .bat file??