VMware Cloud Community
Marius2
Contributor
Contributor

Get-Datastore returns just... nothing!

Hi everybody,

currently I'm working on a little script, that exports our virtual machine inventory into a html file. That works fine.

Now we had the problem, that our datastores runs full: no more empty space left on the volume (its a NetApp fileserver).

The solution was to set the volume to autogrow. But the next problem is, that vSphere does not recognise this.

So my idea was to start the command "Get-DataStore -refresh" through the VMware PowerCLI, but the command "Get-DataStore" does not return any output. If I start the command with the "-Verbose"-Argument, I'm getting this:

[vSphere PowerCLI] C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> Get-Datastore -Verbose
VERBOSE: 05.04.2011 13:36:12 Get-Datastore Started execution
VERBOSE: 05.04.2011 13:36:12 Get-Datastore Finished execution

Does anyone have an idea why this does not work?!

Any suggestions are welcome.

Thanks in advance,

Marius

0 Kudos
18 Replies
Marius2
Contributor
Contributor

Oh, additionaly I want to say, that I am succesfully connected to a vSphere-server with the command Connect-VIServer! Smiley Happy

0 Kudos
LucD
Leadership
Leadership

Do any of the other cmdlets return anything ?

Like Get-VMHost and Get-VM.


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

0 Kudos
Marius2
Contributor
Contributor

Yep:

[vSphere PowerCLI] D:\VMware-Scripts> Get-VM

Name                 PowerState Num CPUs Memory (MB)
----                 ---------- -------- -----------
EEVS01-Druckserver   PoweredOn  2        2048
EEVS02-Leer          PoweredOff 1        1024
EEVS03-ADMS2009      PoweredOn  2        2048
EEVS04-McAfee-ePO    PoweredOn  1        2048
EEVS06-APP-V Serv... PoweredOn  1        2048
EEVS07-INVENTORAD... PoweredOn  1        2048
EEVS08-PRTG-Monit... PoweredOn  4        6144
EEVS09-Imtech-AEOS   PoweredOn  1        1024

...

...

...

[vSphere PowerCLI] D:\VMware-Scripts> Get-VMHost

Name            ConnectionState PowerState      Id CpuUsage CpuTotal  Memory  Memory
                                                        Mhz      Mhz UsageMB TotalMB
----            --------------- ----------      -- -------- -------- ------- -------
eews28.xxx-i... Connected       PoweredOn  ...t-12     2485    18128   27680   36854
eews26.xxx-i... Connected       PoweredOn  ...t-71     1947    15952   25960   32766
eews24.xxx-i... Connected       PoweredOn  ...st-9      624    15952   10154   16382

And so on....

0 Kudos
LucD
Leadership
Leadership

And do you see datastores in the vSphere client (Home-Inventory-Datastores) ?

Could you also try a

Get-Datastore | Select Name


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

0 Kudos
Marius2
Contributor
Contributor

Hello,

nothing happens 😞

0 Kudos
LucD
Leadership
Leadership

And what about the vSphere client ? Do you see datastores in there ?


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

0 Kudos
Marius2
Contributor
Contributor

Yes, in the vSphere-Client everything is fine.

I see alls NFS-Datastores, all local datastores and all of our vmfs3-datastores.

NFS and vmfs3 are connected through iSCSI-Softwareadapter

0 Kudos
LucD
Leadership
Leadership

Do you get any output when you specify a specific datastore name ?

Get-Datastore -Name <MyDS>

And does produce any output

Get-Datastore *

Do you perhaps have PowerCLI installed on another client ?

Could you try it from there.


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

0 Kudos
Marius2
Contributor
Contributor

Hi,

if I specify a datastore-name, I'm getting the following error:

[vSphere PowerCLI] D:\VMware-Scripts> Get-Datastore -name "NFS-DS01-WinOS"
Get-Datastore : 05.04.2011 16:02:46    Get-Datastore        Datastore with name 'NFS-DS01-WinOS' was not found, using the specified fil
ter(s).
At line:1 char:14
+ Get-Datastore <<<<  -name "NFS-DS01-WinOS"
    + CategoryInfo          : ObjectNotFound: (:) [Get-Datastore], VimException
    + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetDatastore

Get-Datastore * = Nothing Smiley Sad

I've installed the PowerCLI at the vSphere-Server. Currently I am not able to start it from another computer, but I could give it a try and install it somewhere else. But could this be the reason, that one cmdlet is not working?

Oh, forgot to mention, that I've already reinstalled the PowerCLI (at the same computer).

0 Kudos
LucD
Leadership
Leadership

Very strange.

Let's try one more thing, let's use the ESX(i) hosts to list the datastore.

I'm curious if that returns anything

Get-VMHost | %{
    $_.Name
    $_.Extensiondata.Datastore | %{
        $ds = Get-View $_
       
$ds.Name     } }


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

0 Kudos
Marius2
Contributor
Contributor

Hi,

your code snippet only returns the dns-names of our three ESXi-Hosts.

I think, that this is not what the code should do..?!

0 Kudos
LucD
Leadership
Leadership

Correct, it should display the ESX hosts with for each host the connected datastores.

It looks as if your datastores are not connected to these ESX servers.

In the vSphere client, when you select one of the ESX hosts, do you see on the Summary tab anything in the Datastore table on the right side ?

As an alternative, in the vSphere client, select Home-Inventory-Datastores, select 1 of the datastores on the left and then select the Hosts tab.

Do you see your ESX servers in the list ?


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

0 Kudos
Marius2
Contributor
Contributor

Hi LucD,

for sure I see in the vSphere client the datastores. We are running our ESX(i)-cluster for round about 3 years without any big problems.

We've got 45 virtual machines on 36 datastores (it's because we are migrating from vmfs3 with one datastore per vm to bigger NFS-partitions with serveral VMs per datastore).

So the ESXi-hosts are definitely seeing the datestores. 😕

0 Kudos
Marius2
Contributor
Contributor

In addition: I recently tried PowerCLI on my workstation pc, same effects 😕

One more thing: First time I start Get-DataStores it takes a long time (about 60seconds) till the command prompt is avaibalble again. Every next command-start is executed immediately...

0 Kudos
LucD
Leadership
Leadership

I'm at my wits' end here. I'm afraid  😞

Perhaps it would be better to raise a SR


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

0 Kudos
Marius2
Contributor
Contributor

Hey,

no problem. Thank you for your tips.

The problem is, that we did not bought our licenses directly trough VMware, we bought it at a VMware-partner.

So I can't open a support case - it says I should open a support request at our VMware-partner. But I dont think, that they know how to solve a problem with PowerCLI 😞

Is there any other way to give our vSphere server the command to refresh his datastore-list?

0 Kudos
LucD
Leadership
Leadership

You could try the Get-VMHostStorage cmdlet with the RescanAllHba and the RescanVmfs parameters.


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

0 Kudos
JohnnyLi
Contributor
Contributor

I had a similar problem at one point...

I'm not sure if this will help you, but can you check if you have all the necessary permissions? Is your account a full admin account?

0 Kudos