Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 178776

Unable to get output from remote VMs

$
0
0

Hi,

 

I am unable to get output from remote VMs using below script. There is no errors.

 

Please help

 

Script

$reportlocation2 = "D:\reports\Shared_OS_Info1.csv"

$reportlocation = "D:\reports\Shared_Patching_Info.xlsx"

 

$Today = (Get-Date)

$StartDate = $Today.Date.AddDays(-10)

$EndDate = $Today.Date.AddDays(1)

 

Import-Csv -Path $reportlocation2 -UseCulture -PipelineVariable row |

ForEach-Object -Process {

    try{

        $patchcount = Invoke-Command -ComputerName $_.Name -ScriptBlock {(Get-HotFix | Where {$_.InstalledOn -gt $using:StartDate -AND $_.InstalledOn -lt $using:EndDate }).count}

    }

        catch

    {

        $patchcount = 'NA'

    }

        $row | Add-Member -MemberType NoteProperty -Name 'Patch_Count' -Value $patchcount -PassThru

} | Export-Excel -Path $reportlocation


Viewing all articles
Browse latest Browse all 178776


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>