Sometimes when I code Powershell I find small trinkets I wish too remember, so I’m gonna save them here.
This is a well, small PS variable list for me, with links to articles about them.
Variable | Description |
---|---|
$PSVersionTable.PSVersion | Powershell version,if it is missing, then PS = 1.0 |
$PSCmdlet.ParameterSetName | If using parameterSets with function, this will have which set was used. |
$MyInvocation.MyCommand.Name | Returns the current functions name. |
$PSBoundParameters['Verbose'] | Will be true if function is called with -Verbose |
$PSBoundParameters['Debug'] | Will be true if function is called with -Debug |
Useful functions from .NET
Function | Description |
---|---|
[io.path]::GetTempFileName() | Returns a temporaryfile name in the tempdirectory of the current user |