VMware Cloud Community
MircoZ
Contributor
Contributor

Powercli 6.0.0 Unable to connect to the remote server issue

Hi all,

I am fighting with this problem that is already know, I have not found any real solution on that and still I am having the error.

What I am trying to do is to automate a process in order to run a powershell command inside a guest windows os.

I am running the script from a unique specific server with powercli installed against a vcenter server where my guest is installed.

The strange thing is that the command inside the guest is executed and it works, it means that it is able to authenticate to the guest OS, the problem is that the run of the script failed with:

"Invoke-VMScript Unable to connect to the remote server"

So by the fact it failed the automation process stops.

I have tested the same script in a 5.1 environment and it works.

Any help on this topic?

Thanks all

Regards

Mirco

0 Kudos
25 Replies
LucD
Leadership
Leadership

It could help if you showed the script that you are trying to run inside the guest OS


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

0 Kudos
MircoZ
Contributor
Contributor

I want to create a new OU inside the domain server.

As I told you the command works and I can see the new OU created.

this is the ps1 script I am automating running on the server with powercli installed:

Add-PSSnapin VMware.VimAutomation.Core

Connect-VIServer -server <vcenter server> -user <vcenter username> -password <vcenter user password>

$SCRIPT = "NEW-ADOrganizationalUnit -Name ""ABCTEST"" -path ""DC=ABC,DC=local"" -ProtectedFromAccidentalDeletion 0"

invoke-vmscript -scripttext $SCRIPT -VM ABC-S01 -guestuser "<guest domain username" -guestpassword "<guest domain password>"

This is the exact error I got:

invoke-vmscript : 12.09.2016 11:30:46Invoke-VMScript    Unable to connect to the remote server

At C:\oo\113432952_createAD.ps1:9 char:1

+ invoke-vmscript -scripttext $SCRIPT -VM ABC-S01 -guestuser "ABC\Administrator" - ...

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

+ CategoryInfo      : NotSpecified: (:) [Invoke-VMScript], ViError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViC

   ore.Cmdlets.Commands.InvokeVmScript

Thanks

0 Kudos
LucD
Leadership
Leadership

Is there anything in the vmware.log of that VM, at the same time you get this error?

The Invoke-VMScript cmdlet gets the results from the script that ran inside the guest OS via a file download that runs through the GuestFileManager.

And something obviously goes wrong.


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

0 Kudos
MircoZ
Contributor
Contributor

I have not found any vmware.log in the guest vm, where it should be exactly?

I have found some vmware logs in windows\temp but there are no useful information inside.

let me know

Thanks

Mirco

0 Kudos
LucD
Leadership
Leadership

I was referring to the vmware.log files that are located, most of the time, in the same folder where the VM's VMX file is located.

On the datastore.


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

0 Kudos
MircoZ
Contributor
Contributor

Sorry, I have checked the vmware.log, there are no entries at all related to the time I got the error.

0 Kudos
LucD
Leadership
Leadership

Strange, in any case, something seems to fail while transferring the file from the guest.

Can you try copy a file from the guest OS with the Copy-VMGuestFile cmdlet?

Curious to see if that works


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

0 Kudos
MircoZ
Contributor
Contributor

You are right, I have exactly the same problem:

Copy-VMGuestFile : 13.09.2016 09:19:06Copy-VMGuestFile   Unable to connect to the remote server

At C:\oo\test.ps1:6 char:1

+ Copy-VMGuestFile -Source C:\dc-builder-transcript.txt -Destination C:\oo\dc-buil ...

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

+ CategoryInfo     : NotSpecified: (:) [Copy-VMGuestFile], ViError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViC

   ore.Cmdlets.Commands.CopyVMGuestFile

I have also check if the port 902 is open and it is.

Thanks for your help

Mirco

0 Kudos
LucD
Leadership
Leadership

So, the VMware Tools on the guest have an issue transferring files to the station where you launch the cmdlet.

I know you said port 902 is open, but that is afaik in the other direction.

Can you try with no FW running at all on your station?

Is there any FW active in the guest OS?
Can we switch that one off for a quick test?


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

0 Kudos
MircoZ
Contributor
Contributor

No firewall open in any vms, I have tried to reinstall the full version of vmware tool inside the Guest OS without success.

Thanks

0 Kudos
LucD
Leadership
Leadership

Strange.

Is there anything in the eventlogs inside the guest OS?


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

0 Kudos
MircoZ
Contributor
Contributor

NO events related to vmware, just to be sure I have tested the same process into another server, same result.

0 Kudos
LucD
Leadership
Leadership

Final, wild guess, can you connect to a share on that machine, and copy a file over to your machine?


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

0 Kudos
MircoZ
Contributor
Contributor

Good point!

it is not working!! and it seems related to the UAC configuration.

I am trying all the solutions I have found without any success, including changing registry, security level disable UAC, no way.

The server is a windows 2012 R2 server in domain.

0 Kudos
LucD
Leadership
Leadership

Did you already try with msconfig?


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

0 Kudos
MircoZ
Contributor
Contributor

Ok, now I am able to copy from a shared connection, from a mapped drive and not from or to the root directory.

But ... still the copy-VMGuestfile does not work ... Smiley Sad

In any case yes, I have done also with msconfig

0 Kudos
LucD
Leadership
Leadership

I vaguely remember that the temp file might be located under the %windir% folder (i'll have to check).

Do you have access on that system folder?


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

0 Kudos
MircoZ
Contributor
Contributor

Yes, I have access, I have disabled also the warning when you copy manually a file from one server to another, the security local internet is now low.

No way ... :smileyangry:

I have tried also to run the ps1 script inside the server from where I need and copy a file inside the same server and it does not work!!!

0 Kudos
MircoZ
Contributor
Contributor

Some more information:

I have checked the permission for the GuestOperations and they are ok:

PS C:\oo> Get-VIPrivilege -Id VirtualMachine.guestOperations*

Name                                Description                                        Server

----                                -----------                                        ------

Guest Operation Queries             Queries in a virtual machine guest operating sy... xxxxxxxxxxxxxxxx

Guest Operation Modifications       Modifications in a virtual machine guest operat... xxxxxxxxxxxxxxxx

Guest Operation Program Execution   Running processes in a virtual machine guest op... xxxxxxxxxxxxxxxx

Guest Operation Alias query         Querying the Alias store in a virtual machine g... xxxxxxxxxxxxxxxx

Guest Operation Alias modification  Modifying the Alias store in a virtual machine ... xxxxxxxxxxxxxxxx

Guest Operations                    Operations in a virtual machine guest operating... xxxxxxxxxxxxxxxx

I have set the log level of the vmware tools to debug in the tools.conf file like:

[logging]

log = true

# Enable VMware Tools service logging to a file.

vmtoolsd.level = debug

vmtoolsd.handler = file

vmtoolsd.data = c:/temp/vmtoold.log

# Enable "vmsvc" service logging to a file.

vmsvc.level = debug

vmsvc.handler = file

vmsvc.data = c:/temp/vmsvc.log

# Enable new "vmusr" service logging to a file.

vmusr.level = debug

vmusr.handler = file

vmusr.data = c:/temp/vmusr.${USER}.log

# Enable the "vmvss" snapshot service logging to a file.

vmvss.level = debug

vmvss.handler = file

vmvss.data = c:/temp/vmvss.log

It looks like the process is not able to call the vmware tools ... the log does not change and there are not evidences of the command inside.

I suppose there are some other things around.

Thanks

0 Kudos