Get-ASServer with Get-ASDatabase

Nov 16, 2011 at 9:12 AM

What I'd like to do is the following.

Get-ASServer Server\Instance | Get-ASDatabase | Select ConnectionString, Parent, Name, EstimatedSize, State

Connectionstring is a property of Get-ASServer though. How can I include it in the list anyway?

Coordinator
Nov 16, 2011 at 7:00 PM

That could be tricky to do in a single one liner, but if you do it in two lines you can store the server in a variable and then create a script column in the select.

eg.

$svr = get-asserver Server\Instance 
$svr | get-asdatabase | select name, state, @{Name="Server",Expression={$svr.name}}

Nov 23, 2011 at 8:19 AM

Thanks Darren, that worked.

I changed the comma into a semicolon and it worked like a charm. It's exactly what I was looking for.

$svr = get-asserver Server\Instance 
$svr | get-asdatabase | select name, state, @{Name="Server";Expression={$svr.name}}