Home Dashboard Directory Help
Search

Add-Member doesn't work on Hashtables until they've been accessed. by Joel Bennett


Status: 

Closed
 as External Help for as External


4
0
Sign in
to vote
Type: Bug
ID: 382818
Opened: 11/18/2008 8:02:52 PM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

You can't Add-Member to a Hashtable until you've accessed a property of the table.
Details
Sign in to post a comment.
Posted by Joel 'Jaykul' Bennett on 3/5/2013 at 6:03 PM
This is fixed in PS3!
Posted by Microsoft Connect on 11/6/2009 at 1:08 PM
Your bug has not been fixed in PowerShell 2.0. However we have kept the bug active for next version
Sign in to post a workaround.
Posted by Dardenne Laurent on 2/18/2009 at 8:32 AM
$table= New-Object HashTable

$table.test="This is a test"
$table.exam="this is an exam"
$table.defense="defend your thesis"
Add-Member -in $table NoteProperty Quiz "Surprise, hope you're ready!"
$table.Quiz # This time it works ...

Add-Member -in $table NoteProperty Quiz "Surprise, hope you're ready!"
#exception
$table.Quiz # This time it works ...