< Back

Assert-Null

Sun Jan 12, 2020 5:50 pm

NAME Assert-Null



SYNOPSIS

Asserts that an object/value is `$null`.





SYNTAX

Assert-Null [[-Value] <Object>] [[-Message] <String>] [<CommonParameters>]





DESCRIPTION

`Value` is literally compared with `$null`.





PARAMETERS

-Value <Object>

The value to check.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Message <String>

The message to show when `Value` if not null.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Assert-Null $null



Demonstrates how to assert a value is equal to `$null`.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Assert-Null '' 'Uh-oh. Empty string is null.'



Demonstrates how to assert a value is equal to `$null` and show a custom error message.











RELATED LINKS