Author Posts

June 7, 2016 at 9:04 pm

Hi,

I'm writing a script to give a site overview of configuration manager. By doing the below script :


$Site = 
    Get-CimInstance -Namespace 'root\SMS\site_***' -ClassName SMS_SCI_SysResUse |
       select -Property NetworkOSPath -ExpandProperty RoleName |
       Group -property NetworkOSPath -AsHashTable -AsString 

$column1 = @{expression="name"; width=25; label="Server"; alignment="left"}
$column2 = @{expression="Value"; width=80; label="Role Types"; alignment="right"}


$site | Format-Table -Wrap $column1, $column2

It works as it should apart from a small display niggle ! Below is a line of output:

\\A_Server {SMS SQL Server, SMS Component Server, SMS Distribution Point, SMS Site
Server...}

As you can see, if the Role Types column has more than 4 roles (Like our primary server does), it stops with ..}

I'm trying to achieve the server name on the left, and on the right all the roles being shown. Then onto the next server and so on.

I've been playing for a while and can't seem to get the desired result. Would anyone have any ideas ? (Thanks !)

June 7, 2016 at 9:11 pm

Maybe try setting your $column2 to this:

$column2 = @{expression={ $_.Value -join ', ' }; width=80; label="Role Types"; alignment="right"}

Doing the -join instead of leaving it as an array might help.

June 8, 2016 at 7:40 am

Dave, you are a genius ! Thank you, worked a treat.