2013-04-06 118 views

回答

-1

沒有辦法通過我意識到的Windows Azure API來獲取它。你試圖遠程獲取這個值,或者獲取它用於實例嗎?

如果你是在實例上,你可能會嘗試基於WMI獲取它。這裏在PowerShell中,但是你可以適應C#,VB.NET或其他可以獲取WMI信息的腳本語言。

[reflection.Assembly]::LoadWithPartialName("system.management") 
$wmiSearch = new-object -type System.Management.ManagementObjectSearcher -Arg "Select * from Win32_OperatingSystem" 
$data = $wmiSearch.Get() 
[System.Management.ManagementDateTimeConverter]::ToDateTime($data.InstallDate) 

我在Azure虛擬機上試過這個,它基本上爲我創建了虛擬機。儘管如此,你可能想要測試這個結果。而且,這隻會讓你看到虛擬機實際上已經啓動的時間。因此,如果您有一個運行良好的實例A,那麼硬盤驅動器會發生故障,並且Fabric Controller將該實例移動到DC中的另一個位置並將其重新啓動,然後安裝日期可能就是它的時間移動。這可能正是你正在尋找的東西,或者可能不取決於你的要求。

2
  1. 你可以看到創建日期被列入信息中心上的磁盤名稱。 enter image description here

  2. 你也可以使用Azure的PowerShell命令檢索此:

    Get-AzureVM -ServiceName myubuntu1 | Get-AzureOSDisk | select MediaLink 
    
1

2016更新:仍然沒有辦法快速得到可靠的方式VM創建日期(不,磁盤名稱的日期部分不可靠)。