< Back

Test-Database

Sat Jan 11, 2020 3:48 am

NAME Test-Database



SYNOPSIS

Determines whether the database exist.





SYNTAX

Test-Database [-ConnectionString] <Object> [-DatabaseName] <Object> [<CommonParameters>]





DESCRIPTION

The Test-Database function determines whether the specified database exist.





PARAMETERS

-ConnectionString <Object>

SQL Connection String pointing to the master database



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DatabaseName <Object>

The name of the database to check



Required? true

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

System.Boolean, true when database exist otherwise false





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



PS C:\\>Test-Database -ConnectionString "servername='server'" -DatabaseName "MyDb"



Test whether the database MyDb exist











RELATED LINKS

Questions about this script: rick@chroomsoft.nl