3

I am hoping someone has ran into this problem and may give me some tips on what to try next.

I am trying to run some powercli scripts (ran in powershell) in jmeter. I am using the BSF sampler in jmeter using beanshell

I am using this script:

exec("powershell.exe -PSConsoleFile "C:\Program Files\VMware\InfrastructurVSphere PowerCLI\vim.psc1"
 - command .\CoreApplAdmin.ps1");

The test runs (I see the output of the test in the screen) but the test does not return after running. Basically, it's hung. I had to kill jmeter. I dont see anything in the jmeter logs.

Any ideas? Thanks much for any info/suggestions.

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
  • 1
    Sounds kind of similar to when one invokes powershell.exe via PsExec - it just hangs at the end. You can try the same workaround from here: http://www.leeholmes.com/blog/2007/10/02/using-powershell-and-psexec-to-invoke-expressions-on-remote-computers/ Bascially, use something like `cmd.exe /c "echo . | powershell.exe -psconsolefile 'blahblah' -command .\CoreApplAdmin.ps1"` – latkin Dec 12 '12 at 06:42
  • Thank you for the answer. I tried your suggestion ... and now it does not hang anymore! .. However, jmeter result file does not show anything. Normally, when the testrun is successful, the result file should show that (ie. rc=ok, etc). – Glenda Boja Dec 12 '12 at 08:07
  • Well, I'm afraid I can't help with that part, never used jmeter before ;-) – latkin Dec 12 '12 at 18:35

1 Answers1

0

Use Os Process sampler, it is better for your requirement

UBIK LOAD PACK
  • 33,980
  • 5
  • 71
  • 116
  • Thanks for the response. I did try that and somehow I could not make it work. In the example, it shows: CMD /C DIR C:/DIR .. What is the purpose of the /C after CMD? ... – Glenda Boja Dec 18 '12 at 22:05
  • In thiscase /C identifies the shell cmd to run. But in you case it would be powershell.exe ..., each word being a parameter. – UBIK LOAD PACK Dec 18 '12 at 22:26
  • powershell.exe -PSConsoleFile "C:\Program Files\VMware\InfrastructurVSphere PowerCLI\vim.psc1" - command .\CoreApplAdmin.ps1 – Glenda Boja Dec 19 '12 at 00:42
  • Here's what I really wanted to say: I tried the following using OS_Process Sampler: Command: cmd Parameter1: /C Parameter2: powershell.exe Parameter3: -psc Parameter4: "C:\Program Files\VMware\InfrastructurVSphere PowerCLI\vim.psc1" Parameter5: -command Parameter6: .\CoreApplAdmin.ps1. When I run the test, jmeter appears to hung ... I've tried combining ""C:\Program Files\.....\vim.psc1" -command .\CoreApplAdmin.ps1" as one parameter but it also fails (it does not hung but did not run either). Any ideas to try? – Glenda Boja Dec 19 '12 at 01:14