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?
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)
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.
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\'
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?