VMware Cloud Community
GabCava
Enthusiast
Enthusiast
Jump to solution

[vCheck] Single storage VMs plugin script and exclusions of DS

Hello, in the Single storage VMs plugin script I need to exclude certain datastores which contain characters "ucs". So I modified the line:

$unSharedDatastore = $storageviews | Where-Object {-Not $_.summary.multiplehostaccess} | Select-Object -Expand Name

with

$unSharedDatastore = $storageviews | Where-Object {-Not $_.summary.multiplehostaccess -and $_.Name -notmatch "ucs"} | Select-Object -Expand Name

or

$unSharedDatastore = $storageviews | Where-Object {-Not $_.summary.multiplehostaccess} | Where-Object {$_.Name -notmatch "ucs"} | Select-Object -Expand Name

and that works but it removes also lines that do not contain those characters. What am I doing wrong? I´ve checked and the  sequence ucs is not  contained in the lines that are removed too

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The datastorename "S-001-DC3-PDC-DEVCLUSTER" does not match "ucs", there must be something else going wrong.

Are these missing datastores present in $storageviews?

Try showing the content of $storageviews before the Where-clause is executed.

Perhaps these datastores are "shared" and the first test doesn't pass?


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

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

That should work.

Can you give us some examples of these datastore names that are removed but shouldn't have been?


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

Reply
0 Kudos
GabCava
Enthusiast
Enthusiast
Jump to solution

Hi Luc

here it is

[S-001-DC3-PDC-DEVCLUSTER] F5-UNITT-SDC-LAB/F5-UNITT-SDC-LAB.vmx

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

The datastorename "S-001-DC3-PDC-DEVCLUSTER" does not match "ucs", there must be something else going wrong.

Are these missing datastores present in $storageviews?

Try showing the content of $storageviews before the Where-clause is executed.

Perhaps these datastores are "shared" and the first test doesn't pass?


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

Reply
0 Kudos
GabCava
Enthusiast
Enthusiast
Jump to solution

many thanks Luc,, in fact a temporary storage issue made that DS single hosted!! Fixing the issue it fixed the script output... sorry for wasting time

Reply
0 Kudos