EDIT: wrong forum. New here...Shoudl have been in C# code repository - sorry, Please move it fellows...
This is a very sloppy contribution, I guess I could have given you more exact info on the
sdks - but I am so busy coding these days...
not sure if this is "too" basic for this rather impressive forum either but here I go
I have VMWare server setup - one one of those virtual boxes I run Tor/Privoxy. On the host I have a few apps running at occasions. However, automation is king, so I want those apps to check if that VMWare virtual
machine isn't running I need the app to start it up automagically.
1. I use C#
2. There is a
SDKAPI for VMWare. Active X controls. To be honest I am not sure (was a month ago or so) if I did download something from
or of files are always there after installing VMWare server:
Crogram filesVMwareVMware VmCOM Scripting APIVmCOM.dll is the file you should reference
3. I have created a VM called TorPrivoxy which is what we want to check if running - and if not, then fire it up
4. Now for the code
public class EnsureProxy
public static void Ensure()
VmConnectParams vmConn = new VmConnectParams();
vmConn.Hostname = "localhost";
vmConn.Username = "administrator";
vmConn.Password = "foobaradminpassword";
vmSrvCtl = new VmServerCtl();
foreach (string s in vmSrvCtl.RegisteredVmNames)
if (s.IndexOf("TorPrivoxy">= 0 )
VmCtl vm = new VmCtl();
if (vm.ExecutionState != VmExecutionState.vmExecutionState_On)
System.Threading.Thread.Sleep(60 * 1000);
I am not sure if it's possible to check when it's up - I guess one single way is just check if the proxy is indeed available , but this one is easy - waiting 60 seconds IS enough and I have no hurry in these cases.
You need to change the admin name and password of course.
For non C#ers - there ARE
PerlAPI:s as well.
The main reason for me needing this is I have found myself - when disturbed by a customer on phone etc - I sometimes (without knowing it) click around my open windows - and it has happened I closed the whole virtual
|Best of The Cache Home|
|Search The Cache|
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Linux Related
- Mac, iPhone & OS-X Stuff
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads