我有一个Powershell脚本,它调用一个构建脚本批处理文件来设置一个项目。构建脚本依次调用另一个批处理文件。
setup-Environment.ps1
FullRebuild.cmd
GetSource.cmd
Powershell脚本
Invoke-Expression -command FullRebuild.cmd
FullRebuld.cmd脚本使用版本号参数调用GetSource
GetSource 10.1.0
在powershell中我得到了以下错误:
FullRebuild.cmd : 'GetSource' is not recognized as a
因此,当我使用dirs、%userprofile%\Desktop\Out和%userprofile%\Desktop\Out\test进行复制时,.txt将被复制,但是我得到了错误The file cannot be copied onto itself.
当我使用%userprofile%\Desktop\Out和%userprofile%\Desktop\New Folder运行脚本时,它运行得很顺利。
所以我的问题是,为什么当您从一个公共根文件夹复制到另一个子文件夹时,脚本会感到困惑呢?
@ECHO ON
FOR /r "%userprofile%\Desktop\Out
我想为powershell启用脚本块日志记录。我已经在windows服务器2016 VM中安装了这个新特性。现在我想用Windows server 2012和Windows server 2008来测试这一点。首先,我安装了PowerShell 5.0。
现在,我想使用组策略aktivate日志记录。但我在:组策略编辑器:管理模板、Windows组件、PowerShell、→、打开PowerShell脚本块日志中找不到策略
如何添加此策略?或者如何启用脚本块日志记录?
假设我有一个剧本:
write-host "Message.Status: Test Message Status";
通过执行以下操作,我设法在一个单独的进程中运行了它:
powershell.exe -Command
{ write-host "Message.Status: Test Message Status"; }
问题是,我希望将参数传递给脚本,这样我就可以实现这样的目标:
write-host "I am in main process"
powershell.exe -Command -ArgumentList "I
我的脚本使用Powershell 模块来带来并行进程和队列功能。
脚本和模块存储在共享服务器上,比如\ server \c$,这种想法可以在任何计算机上运行。
试图开始脚本import-module \\server\c$\SplitPipeline,但我收到了错误:
import-module : Could not load file or assembly 'file://\\server\c$\SplitPipeline\SplitPipeline.dll' or one of its dependencies.
Operation is not supported.
我正在尝试在Windows Server 2016 TP4上设置Windows Server容器。我正在跟随微软的,但它不工作。它总是失败,并显示以下错误:
Getting Container OS image (WindowsServerCore) version 10.0.10586.0 from OneGet (this may take a few minutes)...
C:\Install-ContainerHost.ps1 : Unable to download.
In Zeile:1 Zeichen:1
+ C:\Install-ContainerHost.ps1
+ ~~~