- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个Node.js我试图调用的应用程序 PowerShell :
var app = require('express')(),
child_process = require('child_process');
app.post('/deploy', function(req, res) {
var errors = '';
var child = child_process.spawn('powershell.exe', ['deploy.ps1']);
child.stderr.on('data', function(data) {
errors += data;
});
child.stderr.on('end', function() {
if (errors) {
console.log('Error:');
console.log(errors);
}
})
child.on('exit', function(code) {
console.log('Powershell Script finished');
if (!!code)
console.log('I think it failed');
else
console.log('I think it worked.')
});
child.stdin.end();
res.end('');
});
app.listen(3000);
console.log('Listening on port 3000');
当我运行它时(无论 .ps1 文件是否存在),我得到以下信息:
File C:\Users\jkodroff.INTERNAL.000\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 cannot be loaded because
the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:2
+ . <<<< 'C:\Users\jkodroff.INTERNAL.000\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
File C:\Users\jkodroff.INTERNAL.000\Code\gitpulldeploy.js\deploy.ps1 cannot be loaded because the execution of scripts is
disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:13
+ .\deploy.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
我已经验证 get-executionpolicy
返回 unrestricted
,那么什么给出了?
奖励问题一旦我在IIS中托管此流程,我将如何解决同样的问题?
更新这不起作用:var child = child_process.spawn('powershell.exe', ['-ExecutionPolicybypass', '.\\deploy.ps1']);
这也不是:将 C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
中的执行策略设置为 unrestricted
,然后执行var child = child_process.spawn('powershell.exe', ['.\\deploy.ps1']);
但是这确实在命令行上有效:powershell -ExecutionPolicy 绕过 .\deploy.ps1
最佳答案
听起来您正尝试在与将执行策略设置为无限制的环境不同的执行环境 (x86/x64) 中运行 PowerShell 脚本。
简单的修复方法是将-ExecutionPolicy Bypass
添加到PowerShell 命令行。这将绕过执行策略并执行脚本。
关于node.js - 为什么 Node.js 忽略我的 PowerShell ExecutionPolicy 设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19966086/
我从 https://www.powershellgallery.com/packages/ImportExcel/7.1.0 安装了这个模块在我们的 Windows Power shell 中:-
我有一个 Powershell 脚本,它存储在我域中一台机器上的共享文件夹中。现在我想在 DMZ 中的服务器上运行此脚本。什么 ExecutionPolicy 必须 de 域服务器和 dmz 服务器必
向客户提供脚本时,除非他们设置了执行策略,否则脚本不会执行。 向客户提供脚本时的常见做法是什么? set-executionpolicy 是否将作为脚本中的第一个命令运行,以便它可以毫无错误地执行,或
我正在编写脚本以在使用前准备我们的笔记本电脑。它实质上是安装证书并将执行策略设置为 AllSigned。 它通过鼠标右键单击和“使用 Powershell 运行”来执行。这是 windows 10 标
使用 Get-ExecutionPolicy -list 时在 VSCode for PowerShell v5 x64 & x86 中,它返回以下内容: Scope Executio
C++17 通过使用可选的 ExecutionPolicy 参数(作为第一个参数)升级了 69 个 STL 算法以支持并行性。例如。 std::sort(std::execution::par, be
我正在构建一些服务器,需要在它们上运行一些 powershell 脚本。但是,我需要运行命令 Set-ExecutionPolicy -ExecutionPolicy remotesigned -Fo
根据我用来获取 PowerShell 执行策略设置的方法,我得到了两个不同的值。 如果我在 PowerShell 提示符下运行 Get-ExecutionPolicy,我会得到“Unrestricte
我在运行任何 powershell 脚本时遇到以下错误。它只发生在一个客户的服务器上。我不确定是什么触发了这个命令。 如果我将此注册表项从 RemoteSignedto 更改为 ByPass,错误就会
我正在关注 Chocolately Install步骤(Windows 7),但遇到了一些问题。 首先,我开通了命令提示符 (用 以管理员身份运行 打开),但是当试图执行时 Set-Execution
我正在尝试在 VS2005 项目上运行作为预构建的一部分的 powershell 脚本。我跑了 $> powershell Set-ExecutionPolicy UnRestricted 从构建之前
我喜欢在 Windows 10 上的 PowerShell 中使用几个别名。 我希望它们在 session 之间保持不变,因此我将它们放在 C:\Users{username}\Documents\W
PowerShell的Set-ExecutionPolicy命令被禁止了,所以不能这样运行: PS> .\script.ps1 (enter) 除了从“Windows PowerShell ISE”之
“Set-ExecutionPolicy”未被识别为内部或外部命令, 可运行的程序或批处理文件。尝试通过 cmd 安装巧克力时出现此错误 最佳答案 Set-ExecutionPolicy是一个 Pow
我已经在一台特定的 PC 上使用 NuGet 有一段时间了。现在,我在 VS2010 中创建了一个新项目(如果重要的话,它是使用单页应用程序模板的 MVC 4 Beta 项目)。当我选择 工具/库包管
我有一个Node.js我试图调用的应用程序 PowerShell : var app = require('express')(), child_process = require('chil
这对于 Windows 大师来说应该是微不足道的,但对于 *nix 历史学家来说似乎相当令人生畏。 我想仅打印表中的Scope和ExecutionPolicy值,通过以下方式获得: # Actual
我想以普通用户身份在 Windows 7 上运行 PowerShell 脚本。每当我尝试时,都会收到以下错误: File C:\Users\danv\Documents\WindowsPowerShe
在 C++17 中引入了并行标准算法(使用 ExecutionPolicy 参数重载),其中定义了执行顺序、交错和并行化的严格规则,例如([algorithm.parallel.exec/3]): T
我有一个将在 Bamboo 中运行的 powershell 脚本,它将更新 Bamboo 构建的状态。这在 Github 中调用,然后状态将更新调用脚本的任何构建。这目前在 Windows 机器上运行
我是一名优秀的程序员,十分优秀!