Azure Powershell脚本:分析错误
正在尝试通过PowerShell设置新VM。当我一步一步地将命令复制粘贴到PowerShell ISE时效果很好,但当我尝试在一次匆忙中运行命令时失败 我已经删除了脚本的其他部分,但也只有以下几行失败:Azure Powershell脚本:分析错误,powershell,azure,azure-virtual-machine,powershell-ise,azure-powershell,Powershell,Azure,Azure Virtual Machine,Powershell Ise,Azure Powershell,正在尝试通过PowerShell设置新VM。当我一步一步地将命令复制粘贴到PowerShell ISE时效果很好,但当我尝试在一次匆忙中运行命令时失败 我已经删除了脚本的其他部分,但也只有以下几行失败: $VM_NAME = "VMNAME" $VM_SIZE = "Small" $VM_IMAGE = "5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-71-20150605" $LOCATION
$VM_NAME = "VMNAME"
$VM_SIZE = "Small"
$VM_IMAGE = "5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-71-20150605"
$LOCATION = "West Europe"
$STORAGE_ACCOUNT = "disktest"
$CLOUD_SERVICE = "disktest"
$SSH_USER = "azureuser"
$SSH_PASSWORD = "324w##eANC"
$VIRTUAL_NETWORK = "Playground"
$SUBNET = "P"
$BOOTSTRAP_CHEF = $FALSE
$PATH_PUBLIC_CONFIG = "publicconfig.json"
$PATH_PRIVATE_CONFIG = "privateconfig.json"
$DISK_CREATE = $TRUE
$DISK_SIZE = 500
$DISK_COUNT = 2
$DISK_LABEL = "datadisk"
$DISK_LUN = 0
$REMOVE_SSH_ENDPOINT = $FALSE
$HTTP_ENDPOINT = $FALSE
$SHUTDOWN = $FALSE
Select-AzureSubscription -SubscriptionName "SUB" -Current;
if (!(Test-AzureName -Storage $STORAGE_ACCOUNT)) {
New-AzureStorageAccount -StorageAccountName $STORAGE_ACCOUNT -Location $LOCATION
}
if (!(Test-AzureName -Service $CLOUD_SERVICE)) {
New-AzureService -ServiceName $CLOUD_SERVICE -Location $LOCATION
}
Set-AzureSubscription -SubscriptionName "SUB" -CurrentStorageAccountName $STORAGE_ACCOUNT
$existing = Get-AzureVM -ServiceName $CLOUD_SERVICE -Name $VM_NAME
错误消息:
In Zeile:36 Zeichen:1
+ $existing = Get-AzureVM -ServiceName $CLOUD_SERVICE -Name $VM_NAME
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ausführbarer Skriptcode wurde im Signaturblock gefunden.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : TokenAfterEndOfValidScriptText
如果我首先设置变量,将它们从脚本窗口中删除,然后再次运行,它会非常有效。与Microsoft交谈数小时后,问题已“解决”:这是PowerShell 3.0与Windows 7结合的一个缺陷
要解决此问题,请安装PowerShell 4.0,重新安装Azure PowerShell并重新启动工作站。在PowerShell 3.0中找到大量关于此缺陷的引用。。。基于类似错误,您的个人资料是否已签名?Get ExecutionPolicy返回什么?