-
mikaeln
- Influencer
- Posts: 18
- Liked: never
- Joined: Aug 15, 2022 9:26 am
- Full Name: Mikael Norman
- Contact:
Run scripts with Powershell 7
Hi,
we have some scripts to perform post-processing of reports.
We utilize some features that give large execution time reductions in never versions of Powershell 7 (Array addition).
Right now we are running a script that first start with PS5 and then start other scripts as PS7.
It would be great to have the option to specify that the script should run directly with Powershell 7 (pwsh.exe) instead of Powershell 5 (powershell.exe).
Best regards,
Mikael
we have some scripts to perform post-processing of reports.
We utilize some features that give large execution time reductions in never versions of Powershell 7 (Array addition).
Right now we are running a script that first start with PS5 and then start other scripts as PS7.
It would be great to have the option to specify that the script should run directly with Powershell 7 (pwsh.exe) instead of Powershell 5 (powershell.exe).
Best regards,
Mikael
-
vnikiforov
- Product Manager
- Posts: 81
- Liked: 22 times
- Joined: Aug 17, 2022 5:03 am
- Full Name: Vladimir Nikiforov
- Location: Romania
- Contact:
Re: Run scripts with Powershell 7
Hello, Mikael,
Please confirm if I understood you correctly - we are talking about Veeam ONE Reporter and post-delivery scripts?
Windows powershell association stays on powershell.exe (Windows PowerShell 5.1) even after you install PowerShell 7.
You may use something like that to run the script (just a rough example):
File associations are deliberately kept at the default PowerShell 5.1 at the system level on Microsoft Windows servers to avoid breaking legacy scripts.
Please confirm if I understood you correctly - we are talking about Veeam ONE Reporter and post-delivery scripts?
Windows powershell association stays on powershell.exe (Windows PowerShell 5.1) even after you install PowerShell 7.
You may use something like that to run the script (just a rough example):
Code: Select all
Start-Process -FilePath 'C:\Program Files\PowerShell\7\pwsh.exe' -ArgumentList '-NoProfile','-File','C:\reports\post.ps1' -Wait -NoNewWindow---
BR,
Vladimir
Veeam Software
BR,
Vladimir
Veeam Software
-
jorgedlcruz
- Veeam Software
- Posts: 1866
- Liked: 811 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Run scripts with Powershell 7
Hello Mikael,
We are not binding or forcing any type of PowerShell version, as we support more types than just PowerShell. I think the safest scenario for you will be to use a .cmd really, like:
VONE
Or
VONE
Let us know if this works for you.
We are not binding or forcing any type of PowerShell version, as we support more types than just PowerShell. I think the safest scenario for you will be to use a .cmd really, like:
Code: Select all
@echo off
set REPORT_NAME=%~1
set REPORT_FOLDER=%~2
set JOB_NAME=%~3
"C:\Program Files\PowerShell\7\pwsh.exe" ^
-NoLogo ^
-NoProfile ^
-ExecutionPolicy Bypass ^
-File "C:\Scripts\VONE\PostReport-PS7.ps1" ^
-ReportName "%REPORT_NAME%" ^
-ReportFolder "%REPORT_FOLDER%" ^
-JobName "%JOB_NAME%"
exit /b %ERRORLEVEL%Code: Select all
C:\Scripts\VONE\Run-PostReport-PS7.cmd "%ReportName%" "%ReportFolder%" "%JobName%"Code: Select all
@echo off
set REPORT_NAME=%~1
set REPORT_FOLDER=%~2
set JOB_NAME=%~3
"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" ^
-NoLogo ^
-NoProfile ^
-ExecutionPolicy Bypass ^
-File "C:\Scripts\VONE\PostReport-PS51.ps1" ^
-ReportName "%REPORT_NAME%" ^
-ReportFolder "%REPORT_FOLDER%" ^
-JobName "%JOB_NAME%"
exit /b %ERRORLEVEL%Code: Select all
C:\Scripts\VONE\Run-PostReport-PS51.cmd "%ReportName%" "%ReportFolder%" "%JobName%"Jorge de la Cruz
Senior Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Senior Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
-
mikaeln
- Influencer
- Posts: 18
- Liked: never
- Joined: Aug 15, 2022 9:26 am
- Full Name: Mikael Norman
- Contact:
Re: Run scripts with Powershell 7
Hi,
Yes, we are talking about VO Reporter post scripts.
I'm already using a "starter script" which starts with PS5 that then calls other scripts with PS7.
It would be cleaner to have the option in Veeam One Reporter to specify that it should run the script with PS7 instead of what's default in Windows.
PS5 is legacy and PS7 is the future.
Best regards,
Mikael
Yes, we are talking about VO Reporter post scripts.
I'm already using a "starter script" which starts with PS5 that then calls other scripts with PS7.
It would be cleaner to have the option in Veeam One Reporter to specify that it should run the script with PS7 instead of what's default in Windows.
PS5 is legacy and PS7 is the future.
Best regards,
Mikael
-
jorgedlcruz
- Veeam Software
- Posts: 1866
- Liked: 811 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: Run scripts with Powershell 7
I see,
It is a nice feature request for the future, I will add it for future releases.
Thank you
It is a nice feature request for the future, I will add it for future releases.
Thank you
Jorge de la Cruz
Senior Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Senior Director Observability & AI Product Management | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2025 / InfluxAce / Grafana Champion
Who is online
Users browsing this forum: No registered users and 3 guests