2

I tried searching for same on net but was not able to find anything useful. I went through this and this link but they both talk about only PowerShell and not Azure PowerShell.

I still tried it and got following error

C:\Windows\SysWOW64\WindowsPowerShell\v1.0>powershell.exe Get-AzureVM Get-AzureVM : The term 'Get-AzureVM' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-AzureVM + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-AzureVM:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Any help would be appreciated. Thank you in advance.

2 Answers 2

3

That's because the module for Windows Azure wasn't loaded. Try creating a script file (vm.ps1) with the following:

Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1"
Get-AzureVM

And then run it like this (assuming you saved it on your C: drive):

powershell.exe C:\vm.ps1 
Sign up to request clarification or add additional context in comments.

1 Comment

Hi Sandrino. Thanks you for pointing that out. It is working properly now. Just need to find a way to execute it using Java now.
-1

If your ultimate goal is to manage/automate Azure resources by using Java code or to build Java apps with Azure services, you may wish to review the Microsoft Azure SDK for Java.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.