Was it you searched to which Datastore the error is connected?
Maybe you couldn't create a VM because of lacking free space on a Datastore, and the system got you only some Id or Moref (if you are using vCloud Director) instead of a normal Datastore name.
If you hated these moments, so do I.
Because of that I have made some script that can give us additional info and bound Datastore names to their Id/Moref, etc.
Here it is.
===BEGINNING===
cls
Write-Host "=Datastores IDs=" -BackgroundColor DarkRed -ForegroundColor Yellow
$host.UI.RawUI.WindowTitle = "=Datastores IDs="
Get-Date -Format "dd-MM-yyyy HH:mm"
Write-Host
Write-Host "Defining Configuration:" -BackgroundColor Green -ForegroundColor Blue
$ErrorActionPreference = 'SilentlyContinue'
$WarningActionPreference = 'SilentlyContinue'
$ErrorPreference = 'SilentlyContinue'
$WarningPreference = 'SilentlyContinue'
Import-Module VMware.PowerCLI | Out-Null
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:$false | Out-Null
#$vCenter = "vCenter" ## Change as you need
#$User = "GeniousAdmin" ## Change as you need
#$Pass = "P@ssw0rd" ## Change as you need
Disconnect-VIServer * -Confirm:$false -ErrorAction SilentlyContinue | Out-Null
Connect-VIServer -Server $vCenter -User $User -Password $Pass@ | Out-Null
#####=====#####
$outputfile = "D:\Datastores_Uuid.csv"
$DStores = Get-Datastore | select * | Where-Object { $_.Name -like "Datastore_*" }
$TableArray = @()
foreach($DS in $DStores)
{
$DSName = $DS.Name
$DSUuid = $DS.ExtensionData.Info.Vmfs.Uuid
$DSId = $DS.Id
$DSMoRef =- $DS.ExtensionData.MoRef
$OneLineArray = New-Object "PSCustomObject"
$OneLineArray | Add-Member -MemberType NoteProperty -Name "Datastore" -Value $DSName
$OneLineArray | Add-Member -MemberType NoteProperty -Name "Datastore Uuid" -Value $DSUuid
$OneLineArray | Add-Member -MemberType NoteProperty -Name "Datastore Id" -Value $DSId
$OneLineArray | Add-Member -MemberType NoteProperty -Name "Datastore MoRef" -Value $DSMoRef
$TableArray += $OneLineArray
}
$TableArray | OGV -Title "=Datastores IDs="
$TableArray | Export-Csv -path $outputfile -NoTypeInformation
ii $outputfile
===FINISH===
This the end result:
Комментариев нет:
Отправить комментарий