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
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
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
Hi Luc
here it is
[S-001-DC3-PDC-DEVCLUSTER] F5-UNITT-SDC-LAB/F5-UNITT-SDC-LAB.vmx
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
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