VMware Cloud Community
FM19999999
Enthusiast
Enthusiast

Using plink.exe in Powershell script returns "Unable to create scratch directory"

Hello,

I wrote this powercli script in order to update the HP Smart array P840 firmware and driver of my HP DL380 G9s. I am currently running ESXi 65U1 and vSAN 661.

I staged the files with another script so assume they are already on the hosts chomod'd and unzipped.

The VIB installation works just fine but when this part of the code runs I get an error stating: "unable to create scratch directory"

$cmd1 = @'

'/tmp/CP032780.vmexe --rewrite --force --silent --log-dir=/tmp'

'@

I also tried to stage the files in a datastore as opposed to root with the same message being returned:

$cmd1 = @'

'/vmfs/volumes/datastore1 (5)/files/CP032780/CP032780.vmexe' --inventory --log-dir=/tmp

'@

This is the command output. The ./_hp_scexe_info does not exist anywhere. I'm presuming the command can't write to either /tmp or /vmfs/...

Capture.PNG

Here is a detailed ls of both directories.

post 2.PNG

permissions for the exe

-rwxr-xr-x    1 root     root         27408 Jan 30 19:25 CP032780.vmexe

-rw-r--r--    1 root     root      12460831 Jan 30 19:25 CP032780.vmfile

-rw-r--r--    1 root     root        370802 Jan 30 19:25 CP032780.xml

I forgot to mention that either command works in an SSH session.

You can see the entire script here, in my github page.

https://github.com/Coolguydoesnotlookatexplosions/vmware-utils/blob/master/Executeremotecommands.ps1

LucD tagging as i have seen him post some on plink.

0 Kudos
3 Replies
LucD
Leadership
Leadership

For me your plink.exe calls look ok.

I suspect there might be an issue with this CP032780.vmexe

Do you get the same error when you run that from a SSH session to the ESXi node?

Another idea, leave of the -silent switch when passing the line to plink.exe.

Perhaps that will give more clues on what goes wrong.


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

0 Kudos
FM19999999
Enthusiast
Enthusiast

No, I don't get the same issue in an SSH session, it works. I'm wondering if it's a linux thing or how the shell runs it.

Have you tried using screen or how about doing an echo <command> instead of executing the command?

0 Kudos
LucD
Leadership
Leadership

Did you try with leaving out the -silent option on the command via plink.exe?
It might prompt, but we would see what the command is looking for.


Not sure I get what you mean with the 'echo'?

Unfortunately I don't have any HP hardware where I could test myself.


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

0 Kudos