VMware Cloud Community
mikegillow
Contributor
Contributor
Jump to solution

Invoke-VMscript failing after vmtools upgrade

vSphere 6.0

PowerCLI 6.0R3

Guest VMs: Windows 2008R2, Windows Server 2012R2

Initial vmtools version: 9349

I have an Invoke-VMScript command that has been working on these VMs to set a service's startuptype to manual.  I was seeing the message that vmtools was out of date, but my script completed successfully.  I updated vmtools on the VMs to 9541.  The same script now fails with "A specified parameter was not correct" error.  Any ideas?

The script section:

$thisvm = Get-VM -Name $vmname

$script = "Set-Service `"$svcname`" -startuptype `"$startuptype`""

$result = Invoke-VMscript -ScriptText $script -vm $thisvm -GuestCredential $mycreds -ScriptType Powershell

Full error text:

Invoke-VMscript : 2/5/2016 9:09:05 AM    Invoke-VMScript        A specified

parameter was not correct:

At C:\powercli\MAGtest.ps1:58 char:11

+ $result = Invoke-VMscript -ScriptText $script -vm $thisvm -GuestCredential

$mycr ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~

    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], InvalidArgu

   ment

    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViE

   rror,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

Reply
0 Kudos
1 Solution

Accepted Solutions
mikegillow
Contributor
Contributor
Jump to solution

  1. Thanks.  My admin stated that the log was showing an “unable to connect” error.  Ultimately I had to change this:

$guestuser = ".\administrator"

To this:

$guestuser = "administrator"

My VMs are not members of a domain. Earlier this week when I was first trying Copy-VMGuestFile, I tried using "administrator" without the “.\” and I could not connect.  I added the “.\” and it worked.  Odd that a vmtools upgrade would break it, but...

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Are there anymore clues in the vmware.log ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
mikegillow
Contributor
Contributor
Jump to solution

  1. Thanks.  My admin stated that the log was showing an “unable to connect” error.  Ultimately I had to change this:

$guestuser = ".\administrator"

To this:

$guestuser = "administrator"

My VMs are not members of a domain. Earlier this week when I was first trying Copy-VMGuestFile, I tried using "administrator" without the “.\” and I could not connect.  I added the “.\” and it worked.  Odd that a vmtools upgrade would break it, but...

Reply
0 Kudos