Hello,
I have the following script that will look up the computer model (based on a folder structures with computer models) and copy the executable from the folder to the script directory.
Old Dell computers have a different name for the BIOS executable comparing to newer Dell computers, therefore I'm copying the name of the file from the executable.
New-PSDrive -Name "A" -Root $scriptDirectory -Persist -PSProvider "FileSystem"
#Create Model Variable
$ComputerModel = Get-WmiObject -Class Win32_computersystem | Select-Object -ExpandProperty Model
#Copy Bios Installer to the root of the package
Copy-Item -Path "$scriptDirectory\Files\$ComputerModel\*.exe" -Destination "$Scriptdirectory\Files"
#Get Bios File Name (Uses the Bios EXE file in the same folder)
$BiosFileName = Get-ChildItem -Path "$scriptDirectory\Files\$ComputerModel\" -Filter *.exe -Recurse -Verbose | Select -ExpandProperty Name
#Get Bios File Name
$BiosLogFileName = Get-ChildItem -Path "$scriptDirectory\Files\$ComputerModel\" -Filter *.exe -Verbose | Select -ExpandProperty BaseName
#Set Command Arguments for Bios Update
$cmds = "/s /l=$LogPath\$BiosLogFileName"
$Process = Start-Process "$scriptDirectory\Files\$BiosFileName" "$cmds" -Wait -PassThru
When the scripts run I can see from the script directory it has succeeded with the copying, but it fails to start the process. I tried with a numerous ways to execute this, like:
Execute-Process "$scriptDirectory\Files\$BiosFileName" "$cmds" -Wait
$Process = Start-Process "$scriptDirectory\Files\$BiosFileName.exe" "$cmds" -Wait -PassThru
Execute-Process -Path "$scriptDirectory\Files\$BiosFileName" "$cmds" -Wait -PassThru
Execute-Process -Path "$scriptDirectory\Files\$BiosFileName.exe" "$cmds" -Wait -PassThru
$Process = Start-Process -FilePath "$scriptDirectory\Files\$BiosFileName" "$cmds" -Wait -PassThru
$Process = Start-Process "$scriptDirectory\Files\$BiosFileName" -Filter *.exe "$cmds" -Wait -PassThru
The BDD.log tells me "returned an unexpected return code: 60002 (and continues with the rest of the things)
Or an error pops up with "FullyQualifiedErrorId : InvalidOperatonException,Microsoft.Powershell.Commands,StartProcessCommand and points me to $Process = Start-Process
How shall I type this?
Thaaank you!