I am trying to run a startup task cmd-script on a Windows Azure Role.
This are the two lines of the command file script:
powershell $command = "set-executionpolicy Unrestricted"
powershell $command = ".\setupAgent.ps1" -NonInteractive >; out.txt
Now the problem is, I get an error message from the command shell, that says:
D:\Users\UserAccount>powershell $command = "set-executionpolicy Unrestricted"
'powershell' is not recognized as an internal or external command,
operable program or batch file.
It looks like there are used some kind of different codepages or something linke that, because these special chars are not in my cmd file. The cmd-file was created on Windows 8 via VS 2012 Ultimate.
Do you have an idea, how I can dismiss there special chars at the beginning of the command? If I copy the command from the cmd-file to the console via remote desktop it works fine!
Under Azure drive, type Get-AzCommand to get context-specific Azure commands. Alternatively, you can always use Get-Command *az* -Module Az.* to find out the available Azure commands. You can run Install-Module to install modules from the PowerShell Gallery.
PowerShell Jobs let you run cmdlets in the background or do multiple tasks on Azure at once, from inside a single PowerShell session. This article is a brief overview of how to run Azure PowerShell cmdlets as PowerShell Jobs and check for completion.
Run regular PowerShell commands in the Cloud Shell, such as: You can find all your virtual machines under the current subscription via VirtualMachines directory. Please refer to Troubleshooting remote management of Azure VMs. Assuming you have a VM, MyVM1, let's use Invoke-AzVMCommand to invoke a PowerShell script block on the remote machine.
One of the first steps you should take in troubleshooting a problem with the Azure Az PowerShell module is to enable debug logging. To enable debug logging on a per command basis, specify the Debug parameter. To enable debug logging for an entire PowerShell session, you set the value of the DebugPreference variable to Continue.
Open your whatever.cmd
file with your VS 2012 Ultimate. Click on File
->Save whatever.cmd as
-> on the dialog there is little arrow next to the [save]
button. It will show up a menu that will have the option Save with Encoding
:
Select it. Now choose "US-ASCII Codepage 20127" from the list of available encodings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With