which script will produce the desired list of databases. What script should you use?

You have a server named Contoso with multiple databases.
You have been tasked to write a PowerShell script to determine which databases on the server are larger than 100GB.
You open PowerShell from SQL Server Management Studio. You create two variables as follows:

PS SQLSERVER:SQLContoso> $MultipleOfGB = 1024 * 1024
PS SQLSERVER:SQLContoso> $Server = Get-Item

You need to determine which script will produce the desired list of databases.
What script should you use?

You have a server named Contoso with multiple databases.
You have been tasked to write a PowerShell script to determine which databases on the server are larger than 100GB.
You open PowerShell from SQL Server Management Studio. You create two variables as follows:

PS SQLSERVER:SQLContoso> $MultipleOfGB = 1024 * 1024
PS SQLSERVER:SQLContoso> $Server = Get-Item

You need to determine which script will produce the desired list of databases.
What script should you use?

A.
$Server.Databases | Where-Object{($_.Size * $MultipleOfGB) -gt 100GB} | Select-Object Name, Size

B.
$Server | Where-Object{($_.DatabaseSize * $MultipleOfGB) -match 100GB} | Select-Object Name, DatabaseSize

C.
$Server | Where-Object{($_.DatabaseSize * $MultipleOfGB) -gt 100GB} | Select-Object Name, DatabaseSize

D.
$Server.Databases | Where-Object{($_.Size * $MultipleOfGB) -match 100GB} | Select-Object Name, Size



Leave a Reply 1

Your email address will not be published. Required fields are marked *