Copy link to clipboard
Copied
First let me say that I am a novice when it comes to Powershell and cfcexecute, though I've been using CF on and off since version 4.
I have a PowerShell/Migration shell console file script that updates email passwords on our MSOnline instance. It works fine if I run it from the run or command line in Windows, but from cfexecute in Coldfusion 9.0.1 it times out. If I set the timeout to 0 the timeout is ignored, but I'll have no idea if it ran. The odd thing is that the code actually does its job, but it leaves both the cmd.exe and powershell.exe processes running and I never get a return code regardless of how long I set the timeout. I have tried all of the /c, 2>$1, exit code, etc., I could find, but none of them seem to work.
I have also tried running the console script from a bat file and directly running Powershell command, but I get the same result when using cfexecute. Besides being over 87MB per instance Powershell, I really don't want to leave a bunch of orphaned processes running.
I'm sure there are better ways of doing this. Any thoughts would be appreciated.
Thanks,
Byron
Try the tip from James in the comments of this Ben Forta entry. ie Add the "-inputformat none" paramater.
ie
<cfexecute name="c:\path\to\powershell.exe"
arguments="-inputformat none c:\path\tosomeFile.ps1"
...
/>
Copy link to clipboard
Copied
Try the tip from James in the comments of this Ben Forta entry. ie Add the "-inputformat none" paramater.
ie
<cfexecute name="c:\path\to\powershell.exe"
arguments="-inputformat none c:\path\tosomeFile.ps1"
...
/>
Copy link to clipboard
Copied
Thank you. That did the trick. Took me a few minutes to figure out where in my string to put the command, but it now works like a charm. I did read that blog entry, but I guess I didn't get far enough down into the comments. In my hurry I sometimes forget there's lots of goodness there.
Copy link to clipboard
Copied
No worries, I know the feeling. Popular sites tend to have tons of comments. While some are true jewels, they are in no particular order. So the brain tends to skim after a while 😉