# Help with Start-Process arguments for Office2019 install

**URL:** <https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429>\
**Category:** PowerShell Help\
**Created:** [May 26, 2022, 4:00pm UTC](https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429 "2022-05-26T16:00:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![john3j](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@john3j](https://forums.powershell.org/u/john3j)\
**Post date:** [May 26, 2022, 4:00pm UTC](https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429/1 "2022-05-26T16:00:52Z")

</div>

Hello,

I wrote the following code, but when I run the script, I get a prompt from setup.exe that states the configuration file could not be found. I currently have a folder where I have a batch file that calls powershell scripts while bypassing the execution policy. The folder structure is as follows:

Updates (directory)  
-office2019 (directory)  
–Office (directory)  
–office2019.ps1  
–setup.exe  
–SYS-2019-Configuration.xml

Here is the code from office2019.ps1:

```auto
$officePath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration\"
$currentVersion = Get-ItemPropertyValue -Path $officePath -Name ClientVersionToReport
$targetVersion = $targetVersion = (Get-ChildItem -Path $PSScriptRoot\Office\Data -Directory).Name

If (Test-Path $officePath) {
    Write-Host "Office 2019 was found."
    Write-Host "Current Version: $currentVersion"
    Write-Host "Target Version: $targetVersion"
    If ($currentVersion -lt $targetVersion) {
        Write-Host "Office 2019 installation will be updated to $targetVersion"
        Start-Process -Wait -FilePath $PSScriptRoot\setup.exe -ArgumentList "/configure $PSScriptRoot\SYS-2019-Configuration.xml" -PassThru
        Write-Host "Office 2019 has been updated to version $targetVersion"
        }
    }
Else {
    Write-Host "Installation not found. Skipping."
    }

```

The exact error that I receive is:  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/9/94de53669872ec28b989ed422058f9cd626ef7c4.png)

If anyone can help me figure out what I am doing wrong I would greatly appreciate it!

Thanks!

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [May 26, 2022, 5:13pm UTC](https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429/2 "2022-05-26T17:13:30Z")

</div>

Have you tried to set the directory of the script to the working directory with `Push-Location` or `Set-Location` and run the setup without the path in the command line?

```auto
Push-Location -Path $PSScriptRoot
Start-Process -FilePath 'setup.exe' -ArgumentList '/configure SYS-2019-Configuration.xml' -Wait -PassThru
Pop-Location

```

---

<div class="post-metadata">

**Author:** ![john3j](https://avatars.discourse-cdn.com/v4/letter/j/43a26b/32.png) [@john3j](https://forums.powershell.org/u/john3j)\
**Post date:** [May 26, 2022, 6:11pm UTC](https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429/3 "2022-05-26T18:11:58Z")

</div>

@Olaf - That worked! Thank you so much for the tip!

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:17pm UTC](https://forums.powershell.org/t/help-with-start-process-arguments-for-office2019-install/19429/4 "2024-05-16T20:17:56Z")

</div>

Closed on May 16, 2024, 8:17pm UTC


