VMware Cloud Community
JohnGibson
Hot Shot
Hot Shot

Upload SSL Certo to ESXi with PowerCLI - possible?

Hi

Ive pretty much moved all of my admin and ESXi 4.1 scripting ver to PowerCLI, one thing ive not been able to figure out is how to upload Signed CA SSL Certificates to he ESXi hosts.

Ive been using vifs.pl to upload them, but id rather just use PowerCLI and drop the vSphere CLI totally.

Has anyone managed to do this, or is it not possible at this time?

Cheers

John

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

Can't you use the pscsp.exe command from the PuTTY Suite ?

See my sample script in

____________

Blog: LucD notes

Twitter: lucd22


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

Reply
0 Kudos
Dave_Mishchenko
Immortal
Immortal

You could use something like this and it does not require TSM.

$file = "c:\tmp\delete\rui.crt"
$url  = "https://esx01/host/ssl_cert"  
$user = "root"
$pass = ""
$objADOStream = New-Object -ComObject ADODB.Stream
$objADOStream.Open()
$objADOStream.Type = 1
$objADOStream.LoadFromFile("$file")
$arrbuffer = $objADOStream.Read()
$objXMLHTTP = New-Object -ComObject MSXML2.ServerXMLHTTP.6.0
$objXMLHTTP.Open("PUT", $url, $False, $user, $pass)
$objXMLHTTP.SetOption(2, 13056)  
$objXMLHTTP.send($arrbuffer)

Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

Reply
0 Kudos
aevrov
VMware Employee
VMware Employee

Hi John,

You can copy files in/out of datastores with the VimDatastore provider.When you start PowerCLI you have the "vmstores:" powershell drive that can be used to browse all the datastores on the servers you are currently connected to. After you connectec to a server, you can "cd" into the ESXi datastore and use the Copy-DatastoreItem cmdlet to copy some local files or files from other datastores. Here's a simple script that browses in a datastore, creates a folder and copies a file from the local file sistem to the datastore folder:

cd 'vmstores:\vc41-ga.pc@443\New Datacenter\datastore1\'

mkdir test

cd .\test

Copy-DatastoreItem -Item C:\some_file.ext

You can use the TAB key to autocomplete the path to the datastore folder. Great, isn't it? Smiley Happy

Regards,

-Angel

Reply
0 Kudos
JohnGibson
Hot Shot
Hot Shot

Reply
0 Kudos