Categories: Uncategorized

Fetch NIC details from Azure – Powershell Script

Here is a very useful script to fetch Azure NIC details . Most of the time we forgot to delete NIC card associated with VM . and within time 100+ un-used and unattached NIC left in subscription . Use this script and fetch NIC details and delete all un=necessary NIC card . 

# This script will help you to fetch NIC details in Azure along with coneccted VM name
$NICDetails = `
Get-AzureRmNetworkInterface `
| Select-Object @{ label = "AdapterName"; Expression = { $_.Name }},
@{ label = "VMname"; Expression = { $_.VirtualMachine.Id.Split(‘/’)[8] }},
@{ label = "PrivateIpAddress"; Expression = { $_.IpConfigurations.PrivateIpAddress }},
@{ label = "PrivateIpAllocMethod"; Expression = { $_.IpConfigurations.PrivateIpAllocationMethod }};
# fetch NIC details in variable and then export . Build by Subhendu . Thanks for using .
$NICDetails | export-csv -path \\adminclient\C\subhendu\NIC02december2019V3.csv
king

Recent Posts

Create Complex NSG – PowerShell

Creating NSG in azure is easy unless you want to create multiple NSG with multiple…

4 years ago

Restore VM from Recovery Service Vault – PowerShell

# Mention your VM here $VMName = "SubhenduTestVM" # Mention your Stage Storage here $stagestorageaccountname…

4 years ago

Power Of Powershell 2

Hope you are doing great . Current Time is very critical for us . I…

4 years ago

Power of Powershell

Being a part of Microsoft Education I have explored powershell long time back . But…

4 years ago

New Azure Exam is Ready to Launch

Sorry !! But Yes .  Microsoft is about to release new exam in Azure Segment…

4 years ago

DFSR to Azure File Sync | DFS cross domain Migration | Azure File Sync Agent issue and Solution

Migration is always a part of our life and part of this fantastic IT world…

4 years ago