Reputation: 193
Its a short question but i have some problems understanding customobjects in powershell.
I tried to create a list but was not able to do make it work i have to less knowledge for this.
$applist = [PSCustomObject]@{
appname = $listitem
}
#somecode
do{
$appname = Read-Host "Which App you want to delete: [OneConnect]"
$listitem += "*$appname*"
#add $listitem to $applist except it is like **
$counterT++
}while($appname -notlike "")
$applist
i want to display $applist all the entries except the clear one
It should look like
*Zune*
*OneConnect*
Upvotes: 0
Views: 42
Reputation: 9163
You are missing the scope. Just declare the custom object within that will result in the display but you have to work on the logic of how you wish to see them (format). Give the below a try and you should be able to see the entries of your
read-host
#somecode
do{
$appname = Read-Host "Which App you want to delete: [OneConnect]"
$listitem += "*$appname*"
#add $listitem to $applist except it is like **
$counterT++
$applist = [PSCustomObject]@{
appname = $listitem
}
}while($appname -notlike "")
$applist
Upvotes: 1