tauri-apps / tauri-apps/plugins-workspace

[Shell] Issue encountered in Windows PowerShell on Windows

Open
#2,112 3 comments 0 reactions 0 assignees View on GitHub
platform: windows plugin: shell status: help wanted type: question
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

Hello, I am using a shell plugin to run commands, but I am currently facing a troublesome issue.

```ts
await Command.create('exec-sh', `powershell -ExecutionPolicy ByPass -c "irm ${url} | iex"`).execute()
```

The code above results in the following error upon execution:

```
The 'Get-ExecutionPolicy' command was found in the module 'Microsoft.PowerShell.Security', but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Security'.
```

How should I resolve this?

I apologize for the interruption, but I have not been able to resolve this issue despite my attempts to search for a solution.

Thank you for your attention, and I hope to receive guidance on this matter.


Additional Information

Permissions Configuration:
```
"permissions": [
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "exec-sh",
"cmd": "powershell",
"args": true
}
]
}
]
```

Tauri Info
```
[✔] Environment
- OS: Windows 10.0.22631 x86_64 (X64)
✔ WebView2: 131.0.2903.70
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.85.0-nightly (6b6a867ae 2024-11-27)
✔ cargo: 1.85.0-nightly (4c39aaff6 2024-11-25)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: nightly-x86_64-pc-windows-msvc (default)
- node: 22.11.0
- npm: 10.9.0
- bun: 1.1.36
- deno: deno 2.0.6

[-] Packages
- tauri 🦀: 2.1.1
- tauri-build 🦀: 2.0.3
- wry 🦀: 0.47.2
- tao 🦀: 0.30.8
- @tauri-apps/api : 2.1.1
- @tauri-apps/cli : 2.1.0

[-] Plugins
- tauri-plugin-shell 🦀: 2.0.2
- @tauri-apps/plugin-shell : 2.0.1
- tauri-plugin-fs 🦀: 2.0.3
- @tauri-apps/plugin-fs : 2.0.2
- tauri-plugin-dialog 🦀: 2.0.3
- @tauri-apps/plugin-dialog : 2.0.1
- tauri-plugin-log 🦀: 2.0.2
- @tauri-apps/plugin-log : 2.0.0
- tauri-plugin-updater 🦀: 2.0.2
- @tauri-apps/plugin-updater : 2.0.0
- tauri-plugin-process 🦀: 2.0.1
- @tauri-apps/plugin-process : 2.0.0
- tauri-plugin-os 🦀: 2.0.1
- @tauri-apps/plugin-os : 2.0.0

[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Vue.js
- bundler: Vite
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.