I have an Azure project with a WorkerRole for which I have a StartUp task. The startup task is a simple .cmd file (startup.cmd), which calls a powershell script (PerformanceCounterInstaller.ps1). It appears the .cmd file gets executed just fine and it can find the .ps1 file (if the path or name of the .ps1 file is incorrect, I see mentions of it in the err.out file). However, the actual content of the .ps1 file seems to be ignored completely (Write-Output commands, Start-Transcript, Creation of performance counter, ...). I don't get any feedback or any data showing any of the attempted operations were performed.
The only data I have in err.out and std.out is coming from the .cmd file and I can't locate any transcript file.
Regards, Mario.
The content of the relevant files can be found below.
------Content of ServiceDefinition.csdef : ------
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="WindowsAzure2" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
<WorkerRole name="MBAzureTestServiceWorkerRole" vmsize="Small">
<Startup>
<Task commandLine="StartupTasks\startuptasks.cmd" executionContext="elevated" taskType="simple" />
</Startup>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WorkerRole>
</ServiceDefinition>
------Content of startuptasks.cmd : ------
cd %~dp0
echo %date% %time% >>std.out
echo %date% %time% >>err.out
powershell -ExecutionPolicy Unrestricted './PerformanceCounterInstaller.ps1' >>std.out 2>> err.out
EXIT /B 0
------Content of PerformanceCounterInstaller.ps1 : ------
$serviceName = "Test Service"
# Write-Output "This is a test of the broadcasting system..."
Start-Transcript -Path startup_transcript.txt
Stop-Transcript
[more stuff]