Calling a ps script while executing another script

So I have an installation script (softwareinstall.ps1) that is installing all of our default software onto a workstation, before I sysprep the workstation for major deployment. In my script I need to call another PowerShell script (automation.ps1) to install specialized software that was already automated. Every time that I run the softwareinstall.ps1 script it errors out when trying to run the automation.ps1.

Softwareinstall.ps1 is ran in the administrator PowerShell window, I have tried calling the script by using the following commands: “Start-Process” and “Invoke-Expression.” Also the softwareinstall.ps1 command sits inside a <Grand Parent Folder> that calls to the <Parent Folders> (See folder structure below). When calling the automation.ps1 script, I am using the full folder path as shown in my except of my script below.

<Grand Parent Folder> (softwareinstall.ps1 resides here)

<Parent Folder> (All of the software that gets installed in folders)

<Child Folder> (Automation Software having issues with)

I have looked at google and most of the results have been to run a single script.

Except from my softwareinstall.ps1 script

Write-Host "Installation of automation Software. `r`n" -BackgroundColor DarkGreen Start-Process “C:<Grandparent Folder><Parent Folder><Child folder>automation.ps1” -Wait Write-Host "Installed all automation Software. `r`n" -BackgroundColor Yellow -ForegroundColor Black 

Thanks

submitted by /u/mecoastie
[link] [comments]

Leave a Reply