Assert-DirectoryExists

Asserts that a directory exists.

Syntax

Assert-DirectoryExists [[-Path] <String>] [[-Message] <String>] [<CommonParameters>]

Description

Uses PowerShell's Test-Path cmdlet to check if a directory exists.

Parameters

Name Type Description Required? Pipeline Input Default Value
Path String

The path to the directory to check.

false false
Message String

A description of why the assertion might fail.

false false

EXAMPLE 1

Assert-DirectoryExists 'C:\Windows'

Demonstrates how to assert that a directory exists.

EXAMPLE 2

Assert-DirectoryExists 'C:\Foobar' 'Foobar wasn''t created.'

Demonstrates how to describe why an assertion might fail.