Powershell invoke-command on IIS server does not list all the column values
<p>I'm relatively new to PowerShell and probably did not word the question properly. So, please forgive me for that.</p>

<p>Here's the problem I'm having</p>

<p>I want to display full list of Application <strong>and/or</strong> Virtual Directory data when I list them using Get-... commands.
Here's the piece of the script that's responsible for the output:</p>

<pre><code>............................Rest of the script


Import-Csv "$CSV" | ForEach-Object {
if     ($_.Type -eq "Application"){        
        invoke-command -ComputerName $_.Server -ScriptBlock { param($VirtualPath, $PhysicalPath) Import-Module WebAdministration; New-Item -Path $VirtualPath -physicalPath $PhysicalPath -type Application } -Args $vPath, $pPath
        invoke-command -ComputerName $_.Server -ScriptBlock { param($VirtualPath, $ApplicationPool) Import-Module WebAdministration; Set-ItemProperty $VirtualPath -Name ApplicationPool -Value $ApplicationPool } -Args $vPath, $AppPool
     }
ElseIf ($_.Type -eq "VirtualDirectory"){            
        invoke-command -ComputerName $_.Server -ScriptBlock { param($VirtualPath, $PhysicalPath) Import-Module WebAdministration; New-Item -Path $VirtualPath -physicalPath $PhysicalPath -type VirtualDirectory } -Args $vPath, $pPath
     }    
else {
        Write-Host "Wrong type for" $_.Server"!
     }
}
    .......... rest of the script
</code></pre>

<p>OUTPUT</p>

<pre><code>Name             Application pool   Protocols    Physical Path                                                          PSComputerName
----             ----------------   ---------    -------------                                                          --------------   
                                                 D:\sites\homedir                          Server1.domain.com                                               
TestS            DefaultAppPool     http         D:\sites\homedir                          Server2.domain.com 
</code></pre>

<p>First of all, there is a problem here with output of the first line. Secondly, when it comes to Applications, it generates this output prior to setting AppPool, which is completely useless to me, since my objective is to get full output and copy/paste it into the case ticket.
Therefore, I added following loop at the end of the script to show me all the records related to specified Alias:</p>

<pre><code>Import-Csv "$CSV" | ForEach-Object {
    invoke-command -ComputerName $_.Server -ScriptBlock { param($IIS_Alias) Import-Module WebAdministration; Get-WebApplication -Site iDoxs -Name $IIS_Alias } -Args $Alias
    invoke-command -ComputerName $_.Server -ScriptBlock { param($IIS_Alias) Import-Module WebAdministration; Get-WebVirtualDirectory -Site iDoxs -Name $IIS_Alias } -Args $Alias
}
</code></pre>

<p>Output for Applications:</p>

<pre><code>Name             Application pool   Protocols    Physical Path                            PSComputerName                                                        
----             ----------------   ---------    -------------                            --------------                                                        
TestS            ASP.NET v4.0       http         D:\sites\homedir                          server1.domain.com                                           
TestS            ASP.NET v4.0       http         D:\sites\homedir                          server2.domain.com
</code></pre>

<p>Output for Virtual Directories:</p>

<pre><code>                                                        D:\sites\homedir                   server1.domain.com                                   
                                                        D:\sites\homedir                   server2.domain.com
</code></pre>

<p>Not as pretty as Applications show up, but at least something</p>

<p>Finally the question:</p>

<ol>
<li><p>How can I disable the output when item is created?</p></li>
<li><p>How can I make Virtual Directories to show up as nice as Applications do? (with labels and Alias for the virtual folder, which seems to be missing from this display but present if they are displayed individually)</p></li>
</ol>