Hello all!,
Im not able to populate the “User” data column with users who are running processes on remote servers. The cmdlets seem to work in powershell by outputting the expected usernames but dont seem to populate those names within my table when rendered in PowerShell Universal. Any help would be greatly appreciated!
New-UDDashboard -Title "RPS App Server Dashboard" -Content {
$Data = @(
$Servers = 'gs-app-uw2c009P', 'gs-app-uw2c004p', 'gs-app-uw2b009p', 'gs-app-uw2b006p', 'gs-app-uw2c008p', 'gs-app-uw2c010P', 'gs-app-uw2b012p'
foreach ($Server in $Servers)
{
@{Server = $Server;
RpsStatus = Invoke-Command -ComputerName $Server -ScriptBlock {
$ProcessCheck = Get-Process -Name RAMVMain -ErrorAction SilentlyContinue -ErrorVariable ProcessError
if ($null -eq $ProcessCheck) {
Write-output "Server is available"
}
else {
Write-output "Server is unavailable"
}
};
User = Invoke-Command -ComputerName $Server -ScriptBlock {
Get-Process -Name RAMVMain -IncludeUserName -ErrorAction SilentlyContinue -ErrorVariable ProcessError | Select-Object UserName | Out-String -Stream | Select-String -Pattern ".*-Admin" | Out-String | Write-output
}
}
}
)
$Columns = @(
New-UDTableColumn -Property Server -Title "Server"
New-UDTableColumn -Property RpsStatus -Title "RPS Status"
New-UDTableColumn -Property User -Title "User"
)
New-UDTable -Id 'customColumnsTable' -Data $Data -Columns $Columns
}
Product: PowerShell Universal
Version: 1.4.6