Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251313

Re: PowerCLi Script loops

$
0
0

I have to admit I'm running out of ideas on what goes wrong here.

I tested the same script with the data you provided earlier, and it works perfectly.

 

One more shot, can you also try the following?

 

$CMDBInfo=Import-CSV.\DS-Tag.csv-Delimiter';'|

    Sort-Object-PropertyName,Location-Unique

 

Write-Host"There are $($CMDBInfo.Count) entries"

 

$TagCatNames=$cmdbinfo|Get-Member|Where {$_.MemberType -eq"NoteProperty"} |Select-ExpandName

Foreach ($Namein ($TagCatNames|Where {$_-ne"Name"})){

    Write-Host"Category : $Name"

    $UniqueTags=$cmdbinfo|Select-expand$Name|Get-Unique

    Foreach ($Tagin$UniqueTags){

        $cmdbinfo|Where {$_.($Name) -eq$Tag} |Foreach {

            Write-Host"Category: $Name - Tag : $Tag - Entity: $($_.Name)"

        }

    }

}

 

 


Viewing all articles
Browse latest Browse all 251313

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>