Skip to content

[Shell] Issue encountered in Windows PowerShell on Windows #2112

Open
@A-kirami

Description

@A-kirami

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions