【发布时间】:2014-05-29 17:37:20
【问题描述】:
Windows Azure Powershell 控制台的配置似乎与 ISE 不同。
例如,打开控制台窗口后,以下 cmdlet 可以工作:Get-AzureVMImage
现在,当我进入 ISE 打开 ISE 应用程序时,找不到相同的 cmdlet。
Get-AzureVMImage : The term 'Get-AzureVMImage' 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.
我可以看到控制台窗口包含以下模块:
ModuleType Name ExportedCommands
---------- ---- ----------------
Binary Azure {Add-AzureAccount, Add-AzureCacheWorkerRole, Add-AzureCertificate, Ad...
Manifest Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-Authe...
Manifest Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
ISE 显示缺少 Azure 模块。
ModuleType Name ExportedCommands
---------- ---- ----------------
Script ISE {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}
Manifest Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest Microsoft.PowerShell.Security {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}
Manifest Microsoft.PowerShell.Utility {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Binary Microsoft.WindowsAzure.Commands {Get-AzureAutomationAccount, Get-AzureAutomationJob, Get-AzureAutomationJobOutput, Get-AzureAutomationRunbook...}
Manifest Microsoft.WSMan.Management {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}
所以我得到了 Azure 模块的路径并像这样导入它:
Import-Module "C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\ServiceManagement\Azure\Microsoft.WindowsAzure.Commands.dll"
但是 Get-AzureVMImage 仍然不起作用。如何让 shell 和 ISE 的行为完全相同?
谢谢
【问题讨论】:
-
很抱歉,我没有意识到您正在比较 Azure 管理控制台和 ISE。我将删除我的答案,因为考虑到您实际上并没有使用标准控制台,这是一个糟糕的答案。我的建议是运行 Azure 管理控制台运行的脚本来加载模块,而不仅仅是在 ISE 中手动加载。
标签: powershell azure