VMware Cloud Community
ozwil
Contributor
Contributor
Jump to solution

Searchdatastore Error

Hi

I have come across the following error when using both EcoShell and PowerGUI when trying to list Files from either a vSphere Host or vCenter server.

ERROR: Exception Calling "SearchDatastore" with "2" argument(s): "Not initialised: boolean fileOwner"

I am sure that this worked fine with ESX 3.5 and Virtual Centre 2.5, listing all files related to VMs hosted by that Virtual Centre server.

Any ideas?

Thanks

Ossie

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can try the solution Yasen provided earlier today in .

That way the script will work in VI and vSphere.


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

View solution in original post

0 Kudos
9 Replies
LucD
Leadership
Leadership
Jump to solution

You're right, this worked in VC 2.5.

The reason is that a new property was added to one of the objects in vSphere.

See also my last reply in .

Unfortunately I don't have access to a vSphere test environment right now, will try it out later today.


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

0 Kudos
scott_herold
Enthusiast
Enthusiast
Jump to solution

I've also answered this in the VESI forums for you, but here is what I posted so others can see this as well:

It appears as if the vSphere SDK introduced a new property to the FileQueryFlags SearchSpec, and that it is also required. To fix this directly in the script, it will likely break file search against VI3. If you are only vSphere, this will work for you.

After BOTH lines 28 and 34 in the "Files" node in the main tree, add the following lines:

After 28:

$folderSearchSpecification.details.fileOwner = $true

After 34:

$fileSearchSpecification.details.fileOwner = $true

In order to properly determine the difference between VI3 and vSphere, there would be additional logic, and I will submit a bugfix for a future release. If you do still manage VI3 and vSphere environments, you could copy the code in the node and simply create a new node labled "Files - vSphere" that has the proper modifications. Not optimal, but will work while Dev provides additional logic for the required flag.

Scott

LucD
Leadership
Leadership
Jump to solution

Scott, it's not only the missing property that is causing the problem in vSphere.

Even when the property is initialised the method still fails with the same error.

There are several other threads that report the same problem Smiley Sad

Perhaps Carter should have a look and give some feedback.


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

0 Kudos
LucD
Leadership
Leadership
Jump to solution

See for a vSphere bypass.


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

0 Kudos
ozwil
Contributor
Contributor
Jump to solution

Thanks Scott and LucD. I will give your suggestions a try this evening and see how it goes. Much appreciated.

Ossie

0 Kudos
ozwil
Contributor
Contributor
Jump to solution

Hi Scott

As mentioned by LucD the addition of these two flags did not resolve the issue.... sadly.

Thanks

Ossie

0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can try the solution Yasen provided earlier today in .

That way the script will work in VI and vSphere.


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

0 Kudos
ozwil
Contributor
Contributor
Jump to solution

Hi LucD

Thanks, tried the suggestion at that post and this worked fine, at least for vCentre Server

Cheers

Ossie.

0 Kudos
ctrople
Enthusiast
Enthusiast
Jump to solution

I have tried the workaround proposed and it doesn't seem to pick up any files.

**Disreguard, think I figured this out.

======================================

Chyna Trople, VCP Monitor. Correlate. Act. | vWire.com
0 Kudos