Hi,
Sorry I wrote that up in a hurry...
What I have is several remote workstations (XP SP2) running a vmware image.
The images are started by the users during the day and should shut them down
at night. What I did is created a script that will run through all the
workstations at night and kill the vmware-vmx.exe process which kills the
session. I was thinking a better way to do this is to use "<vmrun stop
<image file>", which stops virtual server, and then kill the process to kill
VMWare player so the workstation goes back to it's startup menu.
Now in order to call the vmrun.exe and make it work properly using WMI I
have to supply the path to vmrun.exe as well as the path to the vm image
file that is running and the complete path to it. (fyi, there are several
image files on each workstation and the one running depends on what the user
selects so I will have no idea.) The command would have to be pass remotely
to the workstation using the following code. The $command will need to
contain a string like this "C:\Program Files\VMware\VMware Workstation\vmrun
stop c:\images\calif\ua.vmx"
$ProcessClass = get-wmiobject -query "SELECT * FROM Meta_Class WHERE
__Class = 'Win32_Process'" -namespace "root\cimv2" -computername $computer
$results = $ProcessClass.Create($command)
The path to the vmrun.exe file will always be the same which is no problem.
The path and image file will always be different. By using "vmrun list" on
the remote machine the command spits out the path and filename of the image
running. If somehow I could get that output back from the remote machine I
could strip out that path and image file name and pass it to the command for
the "vmrun stop" command.
I noticed you supplied a URL to look at and said WMI will not pass output
back. I will go check out that URL. If you have any other ideas to
accomplish this task please share. The kill process works great just
doesn't seem like a clean way to shutdown a vmware player that is running a
image. I know there is VMToolkit that looks like what I want but company
won't spend money on VMWare server which I believe the toolkit requires.
Thanks,
Ripp
Post by Marco Shaw [MVP]Post by RippHi all,
I have vmware player running on a few workstations. Right now to kill
vmware player i kill the process with powershell. Is there a way to
issue a shutdown and poweroff to vmware player without the toolkit? I
don't have a vmware server.
I'm a bit new to vmware and powershell so any advice is great.
Thanks,
Ripp
You're trying to kill these remotely or locally? Do the VMs have their
own public IP? You could use WMI to talk directly to the VM to ask it to
shutdown.
Maybe I'm missing the point though...
Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com