VMware

This Question is Not Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
8 Replies Last post: May 29, 2009 1:16 PM by fixitchris  

VProbes in PowerShell posted: May 29, 2009 11:56 AM

Click to view fixitchris's profile Expert 547 posts since
Dec 8, 2006
I am running into the same issue with PS that I ran into with CMD. Any ideas?

vprobeLoad: error: EOF while looking for ')'
vprobeLoad: 0 warnings, 1 errors*
Error: Unknown error

$execBinary = new-object System.String "C:\Program Files\VMware\VMware Server\vmrun.exe"
$connectParams = new-object System.String "-T server -h https://localhost:8333/sdk -u user -p pass "
$commandParam = new-object System.String "vprobeLoad "
$vmxParam = new-object System.String '"[standard] store\Windows Server 2003 Standard Edition.vmx" '
$vpParam = @"
'(vprobe VMM1Hz (printf "hello "))'
"@

$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = $execBinary
$startinfo.Arguments = $connectParams + $commandParam + $vmxParam + $vpParam
$startinfo.UseShellExecute = $false
$startinfo.RedirectStandardOutput = $true 
$process = [http://System.Diagnostics.Process|http://System.Diagnostics.Process]::Start($startinfo)
$process.WaitForExit()
$process.StandardOutput.ReadToEnd()  


vmrun vprobeLoad my.vmx '(vprobe VMM1Hz (printf "hello!\n"))'
The cmd command tool on Windows permits nesting of like‐type quotes only, either single or double quotes
but not both, so the above vmrun command produces the error message “unknown ident windows” and fails.
You probably want to install Cygwin so you can run VP scripts in a standard bash shell.

Re: VProbes in PowerShell

1. Feb 18, 2009 8:14 AM in response to: fixitchris
Click to view c_shanklin's profile Master 754 posts since
Dec 3, 2007
fixitchris wrote:
$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = $execBinary
$startinfo.Arguments = $connectParams + $commandParam + $vmxParam + $vpParam
$startinfo.UseShellExecute = $false
$startinfo.RedirectStandardOutput = $true 
$process = [http://System.Diagnostics.Process|http://System.Diagnostics.Process]::Start($startinfo)
$process.WaitForExit()
$process.StandardOutput.ReadToEnd()  

I'm not sure based on that, but this style of running vmrun seems a bit over the top. You can run it directly like you would from a command prompt. Is there a reason you didn't do that? I assume it's because of the path. Still you could run it sort of like this:
$vmrun = Get-Command "C:\Program Files\VMware\VMware Server\vmrun.exe"
. $vmrun $arg1 $arg2 $arg3

And this might be a bit easier to diagnose.

Developer Social Media

Communities