Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Empty Hash Table with PowerShell

$
0
0

Summary: Learn how to easily empty a hash table by using Windows PowerShell.

Hey, Scripting Guy! Question I want to write new values to a hash table, and I want to ensure that it contains none of the original keys or values.
           How can I accomplish this task without deleting and re-creating the hash table?

Hey, Scripting Guy! Answer Use the Clear method from the hash table object, for example:

PS C:\> $a = @{a=1;b=2;c=3} 

PS C:\> $a.Clear()


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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