Hello Gurus
I am new to powershell and trying to create an script to install one application with default parameters silently so that manual intervention on GUI can be avoided and when machine is built I can run this script and install application without user intervention.
below script is not installing application, can someone help me please
#applcation1 App1
$app1name = “App1”
$app1skip = “no”
$app1path = "C:\Users"
$app1runcommand = “W7W10_Install”
$app1arguments = “”
$datetime = Get-Date -format “yyyy.MM.dd-HH.mm.ss”
$logpath = “C:\Users$datetime”
New-Item -Path $logpath -ItemType Directory -ErrorAction SilentlyContinue
#Transcript Start
Start-Transcript -Path $logpath
$startlogtime = Get-Date -format “HH:mm:ss”
write-host “Script Start Time - $startlogtime”
#Install Applications
#Application 1
if ($app1skip -eq “no”) {
if ($app1arguments) { #Arguments Variable Populated
Write-Host Installing Applcation 1 ($app1name
)
$app1 = Start-Process -Wait C:\Users\Desktop\ALM102640\Install\W7W10i_HP_ALM_PATCH_1250_R102_Install C:\Program Files\W7W10_Install -ErrorAction Continue -ArgumentList -WindowStyle Normal
if ($app1.ExitCode -eq “0”) {
Write-Host $app1name Installed ok
} Else {
Write-host $app1name install exited with code $app1.ExitCode
}
}
}Else { #Argurments Variable Empty
Write-Host Installing Applcation 1 ($app1name
)
$app1 = Start-Process -Wait -FilePath $app1path$app1runcommand -ErrorAction Continue -WindowStyle Normal
if ($app1.ExitCode -eq “0”) {
Write-Host $app1name Installed ok
} Else {
Write-host $app1name install exited with code $app1.ExitCode
}
}
#Transcript End
Stop-Transcript