我是Nutanix的新手,有一个问题。
有人知道是否有一种方法可以通过脚本列出所有当前快照?
我想找出是否有任何挥之不去的快照。
感谢您可能提供的任何建议。
最好的答案Andymlloyd
@nfrederickx<\/user-mention> Hi,
\n
\nYou can get a very simple output of VM Name, VM Snapshot Name and Date\/Time taken using the Powershell Cmdlets. Script below should sort you out:
\n
\n## Simple Nutanix All Last Snapshot info Script ##
\n## Andy Lloyd ##
\n
\n$nutsnaps=Get-NTNXSnapshot
\n$allnutvms=Get-NTNXVM | select uuid,vmName
\nforeach ($snap in $nutsnaps)
\n{
\n$vmname= ($allnutvms | where {$_.Uuid -eq $snap.vmUuid}).vmName
\n$snaptime=$snap.createdtime\/1000
\n$snapdt=(Get-Date '1\/1\/1970').AddMilliseconds($snaptime)
\n$actualsnapdt=$snapdt.ToLocalTime()
\n##Write-host $actualsnapdt
\n#Write-host $snap.snapshotname
\nWrite-host \"VM: \" -nonewline; write-host $vmname -foregroundcolor yellow -nonewline; Write-Host \" Last Snapshot Name: \" -nonewline; `
\nwrite-host $snap.snapshotname -foregroundcolor Yellow -nonewline; Write-Host \" Taken: \" -nonewline; Write-host $actualsnapdt -foregroundcolor Yellow
\n}
\n
\nIf this helps you out please mark as Best Answer and Like 🙂
\nMany thanks
\nAndy","className":"post__content__best_answer"}">
查看原件
\n
\nYou can get a very simple output of VM Name, VM Snapshot Name and Date\/Time taken using the Powershell Cmdlets. Script below should sort you out:
\n
\n## Simple Nutanix All Last Snapshot info Script ##
\n## Andy Lloyd ##
\n
\n$nutsnaps=Get-NTNXSnapshot
\n$allnutvms=Get-NTNXVM | select uuid,vmName
\nforeach ($snap in $nutsnaps)
\n{
\n$vmname= ($allnutvms | where {$_.Uuid -eq $snap.vmUuid}).vmName
\n$snaptime=$snap.createdtime\/1000
\n$snapdt=(Get-Date '1\/1\/1970').AddMilliseconds($snaptime)
\n$actualsnapdt=$snapdt.ToLocalTime()
\n##Write-host $actualsnapdt
\n#Write-host $snap.snapshotname
\nWrite-host \"VM: \" -nonewline; write-host $vmname -foregroundcolor yellow -nonewline; Write-Host \" Last Snapshot Name: \" -nonewline; `
\nwrite-host $snap.snapshotname -foregroundcolor Yellow -nonewline; Write-Host \" Taken: \" -nonewline; Write-host $actualsnapdt -foregroundcolor Yellow
\n}
\n
\nIf this helps you out please mark as Best Answer and Like 🙂
\nMany thanks
\nAndy","className":"post__content__best_answer"}">