Repository navigation
Test Variable
github-actions edited this page Jul 4, 2026
·
2 revisions
external help file: ModernConveniences-help.xml Module Name: ModernConveniences online version: schema: 2.0.0
Indicates whether a variable has been defined.
Test-Variable [-Name] <String> [-SessionState <SessionState>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
{{ Fill in the Description }}
Test-Variable true
True
Test-Variable ''
False
A variable can't have an empty string for a name.
Test-Variable $null
False
A variable can't have a null name.
Test-Variable null
True
'PSVersionTable','false' |Test-Variable
True True
'PWD','PID' |Test-Variable -Scope Global
True True
A variable name to test the existence of.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThe SessionState object to use to access the variables.
Type: SessionState
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: $ExecutionContext.SessionState.Module.GetVariableFromCallersModule('PSCmdlet')?.Value?.SessionState
Accept pipeline input: False
Accept wildcard characters: False{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.