EDIT: RESOLVED. Support got back to me in an e-mail and informed you cannot copy files from the script debugger, and you need to actually run a session. I was busy developing and testing the script in the editor, not trying live sessions on a script that was seemingly broken. Hope this helps someone else, I couldn’t find that documented anywhere.
I’ve been banging my head against the wall for the better portion of my Friday…
I’ve created a Custom Task with the following parameter:
Name:
$solarInstallerUpdate
Data Type:
File
Requires User Input: No
Hidden: No
Default Value: “solar-installer-bundle-9.2.4.04-winx64.pre”
Now that should be usable in my script as “$solarInstallerUpdate”
$solarInstallerBundle = "C:\Program Files\Epicor\SolarEclipse\preinstall\solar-installer-bundle-9.2.4.04-winx64.pre"
$solarInstallerBundlePath = "C:\Program Files\Epicor\SolarEclipse\preinstall\"
Write-Host "[!] 'C:\Program Files\Epicor\SolarEclipse\preinstall\solar-installer-bundle-9.2.4.04-winx64.pre' not found, it will be downloaded. "
Copy-Item $solarInstallerUpdate -Destination $solarInstallerBundlePath -Force
When this script runs, it does not even attempt to copy the file from the repo. I can see the parameter is loaded when I go into the script debugger as:
Parameters
solarInstallerUpdate
Default value is: solar-installer-bundle-9.2.4.04-winx64.pre
On the script details side
Type
Task
Execution Context
System
Language
Powershell
Timeout
No override
Access Level
All
What else do I need to do? I have another very basic script that copies a shortcut file to the desktop in exactly the same manner. I uploaeded the .lnk file to the media library, and just did
Copy-Item $myShortcutFile -Destination C:\Users\Public\Desktop -Force
No issues there (same script details/contexct).
I did also reference the docs, and tried a Metascript using the example
$ConfigFile | FileShould-Be -in "C:\ProgramData\MySoftware"
Not only did it not work as show below, but it also through an error that “-in” was ambiguous so I changed the parameter to “-InPath” as suggested by the error output.
$solarInstallerUpdate | FileShould-Be -in $solarInstallerBundlePath
$solarInstallerUpdate | FileShould-Be -InPath $solarInstallerBundlePath
At this point I’m feeling pretty defated, any advice would be very welcome. If there is a way to just turn the file into a URL that can be directly referenced I can just as easily pull the file with an Invoke-WebRequest and save the headache.