我用PowerShell v5.0编写了一个PowerShell脚本,并且我能够在批处理文件中毫无问题地执行该脚本。然而,当我在Windows2008中使用PowerShell v1.0执行批处理文件时,我得到了一个错误“一元运算符后缺少表达式”-“。
有人能告诉我是什么导致了这个错误吗?
这是我的批处理文件中的代码
@ECHO OFF
SET ThisScriptsDirectory=%~dp0
SET PowerShellScriptPath=%ThisScriptsDirectory%SAP_Shell_Script.ps1
PowerShell -NoProfile -Executio
我想为powershell启用脚本块日志记录。我已经在windows服务器2016 VM中安装了这个新特性。现在我想用Windows server 2012和Windows server 2008来测试这一点。首先,我安装了PowerShell 5.0。
现在,我想使用组策略aktivate日志记录。但我在:组策略编辑器:管理模板、Windows组件、PowerShell、→、打开PowerShell脚本块日志中找不到策略
如何添加此策略?或者如何启用脚本块日志记录?
我编写了一个非常简单的powershell脚本将一个json字符串发布到服务器。我在执行脚本时遇到了一个奇怪的问题。
服务器在我们的intranet中,防火墙对所有intranet服务器都是禁用的。
我尝试在不同的地方执行脚本:
- Powershell window in my own computer **(windows 7, powershel 5)**
- Powershell ISE in my computer
- start powershell.exe in a command prompt in my own computer
- start powersh