Showing posts from September, 2011

Save PowerCLI Login Credentials to XML Securely (Mostly)

PowerCLI has a cmdlet that allows you to save your logins to vCenter and ESX(i) hosts to a XML file so you can use those as reference in your PowerCLI scripts when calling the Connect-VIServer cmdlet.
How to use it:
#This stores your credentials into an xml file. You can open the xml file, but the password is hashed.New-VICredentialStoreItem -Host ESXorvCenterHostname -User root -Password "Super$ecretPassword" -File C:\Whateveryouwanttonameit.xml #To use the data stored in the XML file, we will call the Get-VICredentialStoreItem and place the data into a variable for use. $Creds = Get-VICredentialStoreItem -Host ESXorvCenterHostName -File C:\Whateveryouwanttonameit.xml
#Now you can use the $Cred variable for the username and password switches in the connect-viserver cmdletConnect-VIServer ESXorvCenterHostName -User $Creds.User -Password $Creds.Password

XML files can only be referenced from the computer they were created on.Powershell Remoting or Running PowerCLI …

Disable Delayed Acknowledgement Setting in iSCSI Software Adapter using PowerCLI

Summary:Somebody posed this question in the vmware communities forum.  I figured out how to do it cheating w/ Onyx.  Not sure why this is needed (since I don’t use iSCSI much), but figure it’s best I post this for reference if I or anyone needs to do this particular task.Script:#This section will get host information needed$HostView = Get-VMHost NameofESXServer | Get-View$HostStorageSystemID = $HostView.configmanager.StorageSystem$HostiSCSISoftwareAdapterHBAID = ($HostView.config.storagedevice.HostBusAdapter | where {$_.Model -match"iSCSI Software"}).device#This section sets the option you want.$options = New-Object VMWare.Vim.HostInternetScsiHbaParamValue[] (1)$options[0] = New-Object VMware.Vim.HostInternetScsiHbaParamValue$options[0].key = "DelayedAck"$options[0].value = $false#This section applies the options above to the host you got the information from.$HostStorageSystem = Get-View -ID $HostStorageSystemID$HostStorageSystem.UpdateInternetScsiAdvancedOptions(…