cost 288 ms
部署新的 Azure VM 时,如何从自定义 PS 模块运行 PowerShell cmdlet? - How to run PowerShell cmdlets from custom PS modules when deploying a new Azure VM?

是否可以在 Azure VM 部署后任务中安装自定义 PowerShell 模块并在此任务中从该模块运行 PS cmdlet? 我有一个部署新 Windows Azure VM 的 Bicep 模板。 该模板有一个Microsoft.Compute/virtualMachines/extensio ...

在 C# 中检查 PowerShell 执行策略的最佳方法是什么? - What is the best way to check PowerShell Execution Policy in C#?

当您在 PowerShell 中运行Get-ExecutionPolicy时,它会获取有效的执行策略。 我需要知道在 C# 中获取该信息的最佳方式。 我不需要像许多其他关于 PowerShell 执行策略的问题一样知道如何更改它,我只需要知道如何在 C# 中获取它。 ...

从 NodeJS 执行 PowerShell 脚本会导致“在此系统上禁用运行脚本” - Execute PowerShell script from NodeJS results in "running scripts is disabled on this system"

我正在尝试从节点运行 powershell 脚本。 这是我当前的代码: 代码基于这个问题。 当我运行它时,我收到以下错误: 我尝试设置执行策略Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope LocalMachine并且我也尝试在调用脚本时 ...

由于执行策略,Visual Studio 无法执行 Powershell 脚本 - Visual Studio can't execute a Powershell script due to execution policy

我正在尝试在 c# 应用程序中运行基本的 powershell 脚本,但我似乎无法运行它。 我已经尝试过这段代码,无论是否在管道创建中添加了执行策略代码,都得到了相同的结果。 我收到的错误是这样的: System.Management.Automation.PSSecurityException: ...

运行 Powershell 脚本时 ExecutionPolicy 出现问题 - Trouble with ExecutionPolicy when running Powershell scripts

我正在尝试编写一个 Powershell 脚本来自动执行新计算机上的一般任务,包括安装软件。 当阻止我运行我一直在编写的自动化脚本时,ExecutionPolicy 一直是我存在的祸根。 我的一个 PS 脚本需要提升的管理员权限,所以我有一个批处理文件,我在其中调用以管理员身份启动 PS,但由于 E ...

每次运行 powershell 脚本时都会询问 ExecutionPolicy - ExecutionPolicy is being asked everytime for running powershell script

由于执行政策而面临小而忙碌的问题。 编写了一个 Powershell 脚本以使用“sharepointclientcomponents”下载 SharePoint 个文件。 但每次我们执行它时,都会抛出一个错误,提示“未进行数字签名”。 为此,每次都必须先运行“Set -ExecutionPoli ...

以管理员身份从 cmd 批处理运行 PowerShell 脚本 - Run a PowerShell script from a cmd batch as admin

我有一个 PowerShell 设置,我想在执行策略可能受到限制并且需要管理员权限的计算机上执行它。 理想情况下,我可以将它包装在 cmd 批次中,如下所示: 问题是当C:\path\setup.ps1包含空格时,我无法使其工作,并且如果相对路径也不起作用(使用cd C:\path )。 有什么帮助 ...

为什么删除 powershell.exe -executionpolicy unrestricted 突然起作用但以前没有 - Why removing powershell.exe -executionpolicy unrestricted suddenly working but wasn't before

我有一个调用 python 脚本的批处理文件 run.bat(如果它是 ps1 而不是 py 脚本,则同样的问题) run.bat 的内容 直到今天批处理文件没有调用 python 脚本,这一直运行良好。 命令窗口显示以下消息:“尝试新的跨平台 PowerShell https://aka/ ...

尽管更新了 ExecutionPolicy,但无法在 VSCode 中激活虚拟环境 - Cannot activate virtual environment in VSCode, despite updated ExecutionPolicy

我正在尝试在 VSCode 中设置虚拟环境。 为此,我在 GitBash 中使用-m venv newproject创建了一个文件夹“newproject”。 问题是我无法激活虚拟环境,因为在此系统上禁用了运行脚本(以下代码来自 VSCode 终端): 我觉得这很令人困惑,因为我尝试将执行策略设置为 ...

Powershell 脚本在文件资源管理器的控制台 window 中报告执行策略错误 - Powershell script reports execution-policy error when in a console window from File Explorer

我的脚本在 ISE 中运行良好,但在 PowerShell 控制台 window 中运行不正常。 我试图用'替换任何" (以防万一这是一个编码错误,但我不确定)。 编辑:脚本在复制并粘贴到控制台时有效,但在使用控制台打开时无效。 这是脚本ZAOCC.ps1 : 这是错误消息: ...

如何在 PowerShell 中无提示强制 session 级别执行策略? - How to force session level execution policy without prompt in PowerShell?

如有必要,我使用以下代码重新运行具有管理员权限的脚本。 但是,在某些系统上,当我右键单击脚本并选择使用 powershell 运行时,它会提示我输入yes、no、all、cancel... 等。 我不知道这会发生在什么时候。 如果没有上述提示,如何强制执行策略更改? 我检查了文档,似乎没有powe ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM