[Azure]ARM模式下使用Powershell找出订阅中没有被使用的vhd
来源:互联网 发布:2017大数据概念股龙头 编辑:程序博客网 时间:2024/05/18 03:51
此脚本通过Powershell来找到ARM订阅中没有被使用的VHD,脚本如下:
$storages= Get-AzureRmStorageAccount;
foreach ($storagein $storages)
{
# get storage context
$context = $storage.Context;
#get page blobs under container vhds (vhds are pageblobs)
$blobs =Get-AzureStorageBlob -Context$context-Container"vhds"-ErrorActionIgnore|where {$_.BlobType-eq"PageBlob"};
foreach ($blobin$blobs)
{
# check if VHD is not in use
if ($blob.Name.EndsWith(".vhd")-and$blob.ICloudBlob.Properties.LeaseState-eq"Available"-and$blob.ICloudBlob.Properties.LeaseStatus-eq"Unlocked")
{
# out put unused vhd information
Write-Host "StorageAccount Name : "$storage.StorageAccountName;
Write-Host "ContainerName : vhds"
Write-Host "BlobName : "$blob.Name;
}
}
}
脚本测试结果:
- [Azure]ARM模式下使用Powershell找出订阅中没有被使用的vhd
- [Azure]使用Azure Powershell查看ARM模式下Azure存储中的vhd文件对应的虚拟机
- [Azure]使用Azure Powershell输出ARM模式下某个账号中所有订阅下的虚拟网络拓扑
- [Azure]使用Powershell获取Azure ARM模式订阅下的一些常用信息
- [Azure]使用Azure Powershell查看ASM模式下Azure存储中的vhd文件对应的虚拟机
- [Azure]使用Azure Powershell清理ASM模式下未使用的Disk和vhd
- [Azure]使用Azure Powershell输出ASM模式下某个账号中所有订阅下的虚拟网络拓扑
- [Azure][ARM]使用Azure powershell复制正在运行VM的VHD并新建虚拟机时可能遇到的HostName异常
- [Azure]使用Powershell统计ARM存储账号下容器中Blob的使用情况
- [Azure]使用Powershell获取ARM模式下可用的虚拟机平台映像信息
- [Azure]使用Powershell输出Azure订阅下所有虚拟机的ACL信息
- [Azure]ARM中使用Azure Powershell批量规划虚拟网络
- [Azure]使用Powershell输出某台ARM虚拟机的NSG
- [Azure] 使用Azure Powershell脚本查看账号下所有订阅中的云服务公网IP地址绑定情况
- [Azure]使用Powershell统计经典存储账号下容器中Blob的使用情况
- [Azure]使用Powershell输出经典模式下全部云服务的VIP
- [Azure]使用Powershell删除ARM模式下单台虚拟机及相关资源(非托管磁盘)
- [Azure]使用Powershell删除ARM模式下单台虚拟机及相关资源(托管磁盘)
- 当前标识(NT AUTHORITY\NETWORK SERVICE)没有对“C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp
- ES新特性学习
- A+B
- C++概述(二)
- HDU 1257 最少拦截系统
- [Azure]ARM模式下使用Powershell找出订阅中没有被使用的vhd
- Google Cloud Speech API 调用注意事项及调用方式__.Net版2
- 在MS SQL中去掉getdate()的时间部分,只要日期部分
- Byte[]与图片互相转换,保存到本地
- HDU_1257 最少拦截系统
- cocos2dx 多人小游戏时间同步问题(简单版)
- jquery用法--jquery盒子模型
- Zookeeper 入门
- apache-hive-1.2.1和hbase-1.2.2的整合(伪分布式)