I am running this PowerShell script to automatically refresh data in Excel file. I got to know that since Excel is not installed in that VDI machine I cannot run the following code. What should I do to "automatically refresh Excel file once a day". Excel file contains just one sheet. I do not use Powershell at all in my work but I got this request. The Powershell version is : 5.1.14409.1027 VDI is using Windows Server 2012 R2 and version is 6.3
$file = 'E:\Excel\filename.xlsx'
$x1 = New-Object -ComObject "Excel.Application"
$x1.Visible = $false
$enddate = (Get-Date).tostring("dd-MM-yy")
$filename = 'E:\Excel\filename.xlsx ' + $enddate + '.xlsx'
$wb = $x1.workbooks.Open($file)
$wb.RefreshAll()
$wb.SaveAs($filename)
$wb.Close()
$x1.Quit()
Remove-Variable wb,x1