So, something like this?
Import-Csv c:\junk\wt.csv |
ForEach-Object{
Write-Host "Do something with " $_.NAME " and " $_.NIC
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a powershell set of commands listed below. This works great for one nic and it's associatedone public IP. I need to make it work for a set from csv, shown below.
I'm new to this and am not sure how to loop through, with foreach I would imagine.
$vnet = Get-AzVirtualNetwork -Name WestUS2vnet -ResourceGroupName WestUS
$subnet = Get-AzVirtualNetworkSubnetConfig -Name Desktops -VirtualNetwork $vnet
$publicIP = Get-AzPublicIpAddress -name WT1 -ResourceGroupName WVDARM
$nic = Get-AzNetworkInterface -Name WVD-1-nic -ResourceGroupName WVDARM
$nic | Set-AzNetworkInterfaceIpConfig -Name ipconfig -Subnet $subnet -Primary -PublicIpAddress $publicIP
$nic | Set-AzNetworkInterface
This associates the pip WT1 to the nic WVD-1-nic. Below is a CSV for 27 pips and 27 nics. I need to assign the pips to the corresponding nics.
Your help is greatly appreciated
So, something like this?
Import-Csv c:\junk\wt.csv |
ForEach-Object{
Write-Host "Do something with " $_.NAME " and " $_.NIC
}