Not really sure how it went this way but all other write-host was able to show output as i expected but not from these lines
#Create report
#Write-Host "Creating Report" -ForegroundColor Red
Export-Csv -Path $reportName -NoTypeInformation -UseCulture
#Send results via email
#Write-Host "email the report" -ForegroundColor Cyan
Send-MailMessage -SmtpServer $smtpServer -Subject "$smtpSubject $(Get-Date -f dd_MM_yyyy)" -To $to -From $from -Attachments $reportName
#delete the old snapshot report
#Write-Host "delete report in the folder" -ForegroundColor Yellow
Get-ChildItem -Path $att -Filter .csv* | Remove-Item
Disconnect-VIServer -Server * -Confirm:$false -Force
i have to bracket it with # since it doesnt work like it should,
but here are errors i received
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=SYMC-INC..._Service_IEDC1}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=SYMC-FUL..._Service_IEDC1}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=ASAUpgra...eGB=2.3; User=}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=ASAUpgra...eGB=2.3; User=}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=pre-upgr...eGB=7.4; User=}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=PFSense2...AU\~RKrawiecki}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=PFSense2...AU\~RKrawiecki}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=about to...U\~KSutherland}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand
Write-Host : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not
match any of the parameters that take pipeline input.
At C:\Batch\Scripts\snapshots\VM_snapshot.ps1:82 char:1
+ Write-Host "Creating Report" -ForegroundColor Red
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=pre cert...GB=10.7; User=}:PSObject) [Write-Host], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.WriteHostCommand