Closed jo-xxx closed 4 years ago
In the start of the script I'm now changing the working directory to the script location. Does this work?
What is your ReportRoot set to? Can you try a relative path? ../../../../inetpub/wwwroot as well? Either should work.
My ReportRoot is set as:
<ReportRoot>C:/inetpub/wwwroot/</ReportRoot>
and it works fine now:
{"severity":"VERBOSE","datetime":"2020-09-24 11:24:56","message":"Copying underlay/* to C:/inetpub/wwwroot/"}
I tried the relative path
<ReportRoot>../../../../inetpub/wwwroot</ReportRoot>
and it gives me
{"severity":"ERROR","datetime":"2020-09-24 11:17:05","message":"Can't access the site root ../../../../inetpub/wwwroot/"}
I tried
Copy-Item -Recurse -Force -Path 'underlay/*' -Destination '../../../../inetpub/wwwroot/'
and it works:
{"severity":"VERBOSE","datetime":"2020-09-24 11:24:56","message":"Copying underlay/* to C:/inetpub/wwwroot/"}
I'm running PS version 7.0.3 and OS Windows Server 2016
I noticed I was recopying in each spawned process. I fixed that.
I'm running in production in C:\Users\<username>\BigIPReport.timriker\
with:
<ReportRoot>../../../inetpub/wwwroot/</ReportRoot>
and that's working for me both in windows powershell and in Ubuntu/WSL1 pwsh
Oh, yes, it works for me too when I add a couple of "../". And it's only copied once now.
I'm not sure how the file structure is supposed to look like. My setup is -- C:\Users\myuser\Documents\bigipreport\ ---- bigipreport-5.4.2.ps1 ---- bigipreportconfig.xml ---- underlay\ ------ ****
-- C:\inetpub\wwwroot\ ---- default.htm ---- css\ ---- images\ ---- js\ ---- json\
if ('underlay/' -ne $Global:bigipreportconfig.Settings.ReportRoot) {
fails because PowerShell searches path %userprofile%/underlay/.This worked for me but may not work for everyone: