Hi LucD ,
Am using below command to copy file from local to guest machine.
Username is in format domain\user
C:\Users\Administrator> Copy-VMGuestFile -Force -Source "C:\somefile.bat" -Destination "C:\" -VM $vm -LocalToGuest -GuestUser "domain\\user" -GuestPassword <xxxxxxxx>
Keep getting below error . Any suggestions to escape backslash in username ?
y-VMGuestFile : 10/5/2018 2:38:32 AM Copy-VMGuestFile Failed to authenticate with the guest operating
tem using
supplied credentials.
line:1 char:1
opy-VMGuestFile -Force -Source "C:\<somefile.bat>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-VMGuestFile], InvalidGuestLogin
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DirectoryExistsInGuest_ViError,VMware.VimAutomation.ViCore.C
mdlets.Commands.CopyVMGuestFile
Regards,
Arvind S
Found the issue. Since its a domain user couldnt directly copy into C:\ Was able to create a folder and copy it though.
The correct command is as you said
Copy-VMGuestFile -Force -Source "C:\somefile.bat" -Destination "C:\" -VM $vm -LocalToGuest -GuestUser 'domain\user' -GuestPassword <xxxxxxxx>
Thanks for the response LucD
Try using single quotes
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Tried that as well. Doesnt work. -User 'domain\\user'
Arvind S
With a single back-slash
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
used this
C:\Users\Administrator> Copy-VMGuestFile -Force -Source "C:\somefile.bat" -Destination "C:\" -VM $vm -LocalToGuest -GuestUser 'domain\user' -GuestPassword <xxxxxxxx>
Getting 500 internal server error. but am able to login manually into that windows machine with same credentials.
Copy-VMGuestFile : 10/5/2018 3:11:26 AM Copy-VMGuestFile Response status code does not indicate success:
500
(Internal Server Error).
At line:1 char:1
Found the issue. Since its a domain user couldnt directly copy into C:\ Was able to create a folder and copy it though.
The correct command is as you said
Copy-VMGuestFile -Force -Source "C:\somefile.bat" -Destination "C:\" -VM $vm -LocalToGuest -GuestUser 'domain\user' -GuestPassword <xxxxxxxx>
Thanks for the response LucD
Strange that you mark your own answer as the correct answer in a question about the back-slash.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Even after escaping it (Copy) was throwing error. it solved one part of the problem.hence credited you for first half of problem.
Other users might face the same , don't want them to be stuck there.
The second half was able to overcome by creating and copying to fresh folder.
So we need to do both these for copy to work with domain users. Hence gave the full solution and marked that as correct answer.
May be my title was incomplete . will change that now.
thanks for pointing that.