Formatting Assistance

Welcome Forums General PowerShell Q&A Formatting Assistance

This topic contains 2 replies, has 2 voices, and was last updated by

2 years ago.

  • Author
  • #63652

    Points: -17
    Rank: Member

    Hi Community,

    I am trying to get the below to output into a more readable format – perhaps to Out-gridview

    $services = Get-Service

    $services | Where-Object {$_.requiredservices} | Select-Object -Property name, @{n='requiredservices'; e={$}}, @{n='Status';e={$_.requiredservices.status}}

    I would like to try and get requiredservices and status to 'ungroup' and be on a separate line each so AppIDSvc would have 3 x lines with each required service and status? Any ideas appreciated

    Name requiredservices Status
    —- —————- ——
    AppIDSvc {RpcSs, CryptSvc, AppID} {Running, Running, Stopped}
    Appinfo {RpcSs, ProfSvc} {Running, Running}
    AudioEndpointBuilder PlugPlay Running
    AudioSrv {MMCSS, RpcSs, AudioEndpointBuilder} {Stopped, Running, Running}
    AxInstSV rpcss Running
    BFE RpcSs Running
    BITS {RpcSs, EventSystem} {Running, Running}
    Browser {LanmanServer, LanmanWorkstation} {Running, Running}

  • #63658

    Points: 24
    Team Member
    Rank: Member

    Below works for me. Let me know what you think.

    Get-Service | ForEach-Object {
        if ($_.RequiredServices) {
            foreach ($service in $_.RequiredServices) {
                [PSCustomObject] @{
                    'Name' = $_.Name
                    'RequiredService' = $service.Name
                    'Status' = $service.Status
    • #63708

      Points: -17
      Rank: Member

      Hey Daniel,

      works for me as well – thanks so much

The topic ‘Formatting Assistance’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort