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:\SQL\Contoso> $MultipleOfGB = 1024 * 1024
PS SQLSERVER:\SQL\Contoso> $Server = GetItem
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:\SQL\Contoso> $MultipleOfGB = 1024 * 1024
PS SQLSERVER:\SQL\Contoso> $Server = GetItem
You need to determine which script will produce the desired list of databases.
What script should you use?

A.
$Server.Databases | WhereObject{($_.
Size * $MultipleOfGB) gt
100GB\} |
SelectObject
Name, Size

B.
$Server | WhereObject{($_.
DatabaseSize * $MultipleOfGB) match
100GB\} |
SelectObject
Name, DatabaseSize

C.
$Server | WhereObject{($_.
DatabaseSize * $MultipleOfGB) gt
100GB\} |
SelectObject
Name, DatabaseSize

D.
$Server.Databases | WhereObject{($_.
Size * $MultipleOfGB) match
100GB\} |
SelectObject
Name, Size



Leave a Reply 0

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