I have to run some scripts inside VM after start-VM , I need to login to VM.
One way is i can store my remote desktop credentials details as rdp file and invoke the .rdp file.
Is there any cmdlet available to login to Vm ?
Hi,
do you know the invoke-vmscript cmdlet? http://www.vmware.com/support/developer/PowerCLI/PowerCLI55/html/Invoke-VMScript.html
Regards
In PowerCLI 5.5 there is a new cmdlet Open-VMConsoleWindow that you can use to open the console of a virtual machine.
you can store your credentials in a variable and use invoke-vmscript command to run it into multiple VMs, like
(This will prompt the username/password dialog)
Invoke-VMScript -VM VM01 -ScriptText { commands } -GuestCredential (Get-Credential)
if you want to use it on multiple servers, create some txt file with all vm names and use something like this:
$cred = Get-Credential
gc text.txt | % { Invoke-VMScript -VM $_ -ScriptText { commands } -GuestCredential $cred }
EDIT: all machines must have VMWare tools installed for this to work