Jump to content
Sign in to follow this  
Counterfitninja

Virtual server control

Recommended Posts

Counterfitninja

I have been trying to convert this simple vbscript :

Set objVS = CreateObject("VirtualServer.Application")

Set objVM = objVS.FindVirtualMachine("sales")

Set objGuestOS = objVM.GuestOS

to autoit, however it fails on the second part. i have been testing with this:

$VS = ObjCreate("VirtualServer.Application")

$ft = $VS.FindVirtualMachine("sales")

but it fails. anythoughts?

Share this post


Link to post
Share on other sites
cartman380

Have you tried putting some error logic in there to see if it's actually an object being returned, in the help file it said to always have error logic because not all machines have the same objects. Which would mean checking for @error or if the object = 0.

$VS = ObjCreate("VirtualServer.Application")
If @error Then ConsoleWrite("Error creating object")
$ft = $VS.FindVirtualMachine("sales")

or

$VS = ObjCreate("VirtualServer.Application")
If ($VS = 0) Then ConsoleWrite("Error creating object")
$ft = $VS.FindVirtualMachine("sales")

Also you might try using virtualserver.application all lowercase instead of VirtualServer.Application. Or some variance likt that. Not really familliar with Virtual Servers but those are some thoughts.

Share this post


Link to post
Share on other sites
Counterfitninja

Yeah i have tried error checking and lowercase but continually get, which suggests to me it fiun

(3) : ==> The requested action with this object has failed.:

$ft = $VS.FindVirtualMachine("sales")

$ft = $VS.FindVirtualMachine("sales")^ ERROR

->13:48:38 AutoIT3.exe ended.rc:1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.