- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Re: Task PowerShell script - How to use PowerShell...
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 01:49 AM
03-01-2024 01:49 AM
I have a task that runs a cmdlet that requires PowerShell 7. Tasks that have the type PowerShell Script default to Windows PowerShell 5.x. How do I get Morpheus to use PowerShell 7 instead?
Solved! Go to Solution.
- Tags:
- powershell
- Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2024 06:18 AM
03-04-2024 06:18 AM
Re: Task PowerShell script - How to use PowerShell 7.x
Thank you both. I was able to workaround my issue by using pwsh.exe -c parameter. I have submitted an idea as suggested. ![]()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 06:07 AM
03-01-2024 06:07 AM
Solutionyou could look to wrap your powershell script like this in the Morpheus powershell task
pwsh -c {$PSVersionTable}
Also I think this would be a great idea for you to raise in our ideas section. I think there should be a selection on the powershell task to run windows powershell either under powershell.exe or pwsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 05:46 AM
03-01-2024 05:46 AM
Re: Task PowerShell script - How to use PowerShell 7.x
The PowerShell task calls PowerShell.exe (version 5).
Unfortunately, I’m not aware of any method to alter this. However, it might be beneficial to suggest this as an idea for improvement! Feel free to share your idea here. Ideas - Morpheus
One way around this might be to use a file template to place the script onto the VM and start the process from PS 5 using Start-Process.
Start-Process -FilePath “pwsh.exe” -ArgumentList “-File .\PowerShellScript.ps1” -Wait
There could be a better approach out there, this is just what initially came to mind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 05:57 AM
03-01-2024 05:57 AM
Re: Task PowerShell script - How to use PowerShell 7.x
Thanks for the quick reply, I’ll give that a go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 06:00 AM
03-01-2024 06:00 AM
Re: Task PowerShell script - How to use PowerShell 7.x
you could look to wrap your powershell script like this in the Morpheus powershell task
pwsh -c {$PSVersionTable}
Also I think this would be a great idea for you to raise in our ideas section. I think there should be a selection on the powershell task to run windows powershell either under powershell.exe or pwsh