VMware Cloud Community
mgraveney
Contributor
Contributor

Invoke-VMScript command on Server 2008 R2

Have been using the Invoke-VMScript command on server 2003 happily but running the same commands against a Server 2008 R2 server isn't failing, it just isn't running on the host.

UAC is disabled via setting EnableLUA to DWORD 0x00000000 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System so i'm hoping it's nothing to do with that.

We are on vSphere 4 and i've tried it against the esx hosts and the VC but get the same issues.

I'm running the invoke as local administrator and calling powershell scripts directly

here's some of the code

$admpwd = "password" | ConvertTo-SecureString -asPlainText -Force
$admincreds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "Administrator",$admpwd

# Set CD-Rom to Z
write-host "Set CD-Rom to Z, the powershell oneliner must go into a string in single quotes first"
$runline = "(gwmi Win32_cdromdrive).drive | %{$a = mountvol $_ /l;mountvol $_ /d;$a = $a.Trim();mountvol z: $a}"
Invoke-VMScript -VM BBAMCRDPRD11_PREPROD -ScriptText $runline -GuestCredential $admincreds

I'm getting the message

'Authentication failure or insufficient permissions in guest operating system'

But this isn't the case as the administrator password is the same on the 2003 servers as the 2008 ones.

Can anyone offer any assistance?

0 Kudos
0 Replies