I am having trouble getting a ps1 file to execute.
All the powershell.exe does is go to the next prompt without executing anything.
powershell.exe -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -file C:\Users\Administrator\Documents\Powershell\Excel.ps1' -verb RunAs}"Excel.ps1
$strPath="c:\path.xlfile.xls"
$objExcel=New-Object -ComObject Excel.Application
$objExcel.Visible=$true
$Workbook=$objExcel.Workbooks.Add()
$Workbook=$objExcel.Workbook.Add()
$sheet=$Workbook.worksheet.item(1)
$sheet.Cells.item(1,1)=("Title")
$sheet.Cells.item(3,1)=("col1Title")
$sheet.Cells.item(3,2)=("col2Title")
$sheet.Cells.item(3,3)=("col3Title")
$x=100
$y=200
$z=300
$sheet.Cells.item(3,1)=($x)
$sheet.Cells.item(3,1)=($y")
$sheet.Cells.item(3,1)=($z)6
$range=$sheet.UsedRange
$range.EntireColumn.AutoFit()
IF(Test-Path $strPath)
{
Remove-Item $strPath
$objExcel.ActiveWorkbook.SaveAs($strPath)
}
ELSE
{
$objExcel.ActiveWorkbook.SaveAs($strPath)
}