Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure emulator-启动任务-Powershell脚本的内容似乎被忽略_Powershell_Azure_Emulation_Task_Startup - Fatal编程技术网

Azure emulator-启动任务-Powershell脚本的内容似乎被忽略

Azure emulator-启动任务-Powershell脚本的内容似乎被忽略,powershell,azure,emulation,task,startup,Powershell,Azure,Emulation,Task,Startup,我有一个带有WorkerRole的Azure项目,我有一个启动任务。启动任务是一个简单的.cmd文件(startup.cmd),它调用powershell脚本(PerformanceCounterInstaller.ps1)。似乎.cmd文件执行得很好,它可以找到.ps1文件(如果.ps1文件的路径或名称不正确,我会在err.out文件中看到提到它)。但是,.ps1文件的实际内容似乎被完全忽略(写入输出命令、开始转录、创建性能计数器等)。我没有收到任何反馈或任何数据显示任何尝试的操作都已执行 e

我有一个带有WorkerRole的Azure项目,我有一个启动任务。启动任务是一个简单的.cmd文件(startup.cmd),它调用powershell脚本(PerformanceCounterInstaller.ps1)。似乎.cmd文件执行得很好,它可以找到.ps1文件(如果.ps1文件的路径或名称不正确,我会在err.out文件中看到提到它)。但是,.ps1文件的实际内容似乎被完全忽略(写入输出命令、开始转录、创建性能计数器等)。我没有收到任何反馈或任何数据显示任何尝试的操作都已执行

err.out和std.out中唯一的数据来自.cmd文件,我找不到任何成绩单文件

问候,, 马里奥

相关文件的内容见下文。 ------ServiceDefinition.csdef的内容:------

------PerformanceCounterInstaller.ps1的内容:------


我认为问题是因为您正在将PowerShell的输出重定向到std.out。我记得这是PowerShell v2.0中的一个常见错误。试着换掉这条线

powershell -ExecutionPolicy Unrestricted './PerformanceCounterInstaller.ps1'  >>std.out   2>> err.out
用这条线

powershell -ExecutionPolicy Unrestricted './PerformanceCounterInstaller.ps1'  >>std.out   2>> err.out
powershell-执行策略不受限制 “./PerformanceCounterInstaller.ps1”


问题似乎是在.cmd文件中的ps1文件名和路径周围使用了单引号(即“.”)。使用双引号(即“)使其行为正常

$serviceName = "Test Service"

# Write-Output "This is a test of the broadcasting system..."

Start-Transcript -Path startup_transcript.txt 
Stop-Transcript
[more stuff]
powershell -ExecutionPolicy Unrestricted './PerformanceCounterInstaller.ps1'  >>std.out   2>> err.out