So im trying to change the IOPS value to "1" it seems im on the right track by looking at some other scripts that had somethin similar, but mine doesnt seem to loop the entire cluster , look like it does but only the last host gets the updated values, so what am I missing here?
Is there a good practive snippet of code to connect to a VC, get hosts on a Cluster / Datacenter and then execute agaisnt them? Id like to be able to keep a good working code and then re using it on all my scripts? Now that I see this error Im curious if I was fooled into thinking my other scripts were working on all hosts in a Cluster not just, what's a good way to verify that?
Thx!
Do you get the same behaviour (blank screen) when you run the script directly from the PowerCLI prompt ?
This might be a PowerGui phenomena
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It looks as if you are not running PowerCLI in "multiple" mode but in "single" mode.
In that case any cmdlet you execute will only be against the last connection you made.
Use the Set-PowerCLIConfiguration cmdlet to change to "multiple" mode.
Btw, in the latest PowerCLI build you do not need to connect to the ESXi anymore.
A connection to the vCenter will suffice.
Just add the VMHost parameter on the Get-EsxCli cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'll give that a try, I do get the hostname's on the loop though? would that be a good indication that the script is running right?
Yes, the script is running.
But since you are in "single" mode, the Get-EsxCli will only return an object for the last ESXi you connected to.
Think of it as a kind of stack.
Each Connect places an object on the stack.
In "single" mode you get the element at the top of the stack, in "multiple" mode you get all the elements on the stack.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm It seems Im set to multiple , when I do a get config my values are
Proxypolicy -- use system policy
Default Server Mode -- Mutiple
Invalid Certificate action -- Unset
I'll have to double check the script and the devices im trying to modify, must be missing something right?
You can check by displaying the variable $global:defaultviservers to which servers you are connected.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
All right so I changed some things around and this one seems to work fine, I SSH'ed to all hosts in a cluster and ran the script, prior to running I had 10-12 values of IOPS=1000 and once I ran it I only had the ones that are part of the controller so I think Im good. I am running / veryfing on all the other clusters
here's the modded one, I took out the direct connection the the hosts as you mentioned. My only question is that the commented piece on the for loop $esxcli.system.hostname.get() doesnt seem to work right for me. if I add it the rest of the script comes out blank on the console. How should commands be separated? Must buy and read a good CLI book
I suspect you are not using PowerCLI 5.* in vSphere 5.*.
Do a
Get-PowerCLIVersion
to check.
The commands available have changed between 4.* and 5.*.
That commented line is syntax for version 5.*
The other is for version 4.*
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here's what Im using , also I use Powergui version 3.2.0.2237 as my editor, My VC and Hosts are the Latest 5 version with patches.
So I should make sure that I dont mix commands version wise?
That's the latest version.
Are you sure that the ESXi that gave the error on that line is on ESXi 5.* ?
Because that line should work with PowerCLI 5.0.1 and against an ESXi 5.* server.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yeah everything is 5.x latest on our enviroment, it's odd though I reran it and it works fine , I get the hostname followed by a bunch of "true" in between each host. So that's good it seems, now If I take the exact same script and do this on the foor loop
Do you get the same behaviour (blank screen) when you run the script directly from the PowerCLI prompt ?
This might be a PowerGui phenomena
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You Sir are a genius , so it turns out it's an issue with the powergui console Hah, I never would have thought that, I'll start running my scripts through the actual powercli console and just use powergui as my editor
Thx!