I'm trying to figure out a way to view the creation date/time of a variable in Powershell. For example if I create the variable:
PS C:\> $name = 'alice'
PS C:\> $name
alice
When I look at the available properties I only get:
PS C:\> Get-Variable name | Format-List
Name : name
Description :
Value : alice
Visibility : Public
Module :
ModuleName :
Options : None
Attributes : {}
Is there another method that would show me the creation date/time of a variable?
Short answer: no.
Long answer: no without using workarounds logging the events.
Easiest case scenario would require creating all variables like this:
$ThisIsAVariable = 'But a String' | Add-Member -MemberType NoteProperty -Name Creationtime -Value (Get-date) -PassThru