Comment

Hi.  I am total neebie to running scripts.  When I try and run your script I get several errors. I do get prompted for the ESX host account and password but which host is it talking about.  Our hosts have several different passwords. Should we be logging in as root?  Can I select specific hosts?  Here are the errors I receive

Connect-VIServer : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:44 char:17
+ Connect-VIServer  <<<< $server -NotDefault -WarningAction SilentlyContinue |
Out-Null
Get-Datastore : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:86 char:37
+   $myDatastore = Get-Datastore -Name  <<<< $datastore -server $server
Get-VM : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:87 char:29
+   $myVMs = Get-VM -Datastore  <<<< $myDatastore -server $server | Where {$_.P
owerState -eq "PoweredOn"}
Connect-VIServer : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:58 char:26
+     connect-viserver -server  <<<< $vmhost -credential $credentials -NotDefau
lt -WarningAction SilentlyContinue | Out-Null
Get-Datastore : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:61 char:34
+     $myDatastoreID = ((Get-Datastore  <<<< $ds -server $vmhost) | Get-View).i
nfo.vmfs.extent[0].diskname
Get-VM : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:64 char:40
+     $rawVMStats = get-stat -entity    (get-vm  <<<< $vm -server $vmhost) -sta
t $stat -maxSamples $samples
You cannot call a method on a null-valued expression.
At C:\scripts\GatherIOPS.ps1:68 char:28
+         if ($stat.instance.Equals( <<<< $myDatastoreID)) {
Attempted to divide by zero.
At C:\scripts\GatherIOPS.ps1:78 char:27
+     return [int] ($totalIOPS/$ <<<< samples/20)
Connect-VIServer : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:58 char:26
+     connect-viserver -server  <<<< $vmhost -credential $credentials -NotDefau
lt -WarningAction SilentlyContinue | Out-Null
Get-Datastore : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:61 char:34
+     $myDatastoreID = ((Get-Datastore  <<<< $ds -server $vmhost) | Get-View).i
nfo.vmfs.extent[0].diskname
Get-VM : The argument cannot be null or empty.
At C:\scripts\GatherIOPS.ps1:64 char:40
+     $rawVMStats = get-stat -entity    (get-vm  <<<< $vm -server $vmhost) -sta
t $stat -maxSamples $samples
You cannot call a method on a null-valued expression.
At C:\scripts\GatherIOPS.ps1:68 char:28
+         if ($stat.instance.Equals( <<<< $myDatastoreID)) {
Attempted to divide by zero.
At C:\scripts\GatherIOPS.ps1:78 char:27
+     return [int] ($totalIOPS/$ <<<< samples/20)