Browse Community
Help
Log In
Responses(6)
Solutions(1)
Habibalby_083114
68 Posts
0
January 12th, 2016 04:00
Hi All,
I think I have to live with this script since it does the job.
$VMs = Get-Content C:\Scripts\VMs.txt
Foreach ($VM In $VMs)
{
Get-VM -Name $VMs | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Write-Host $VMS "Network Interface Has been disconnected"
Get-VM -Name $VMs | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
Write-Host $VMs "Network Interface has been reconnected"
}
Hope it helps someone else...
lwhitelock
11 Posts
January 12th, 2016 02:00
What version of vWorkspace are you running?
Hi,
I'm running version 8.5..
This method on the Hyper-V will do, but I'm afraid that when the VMs disconnected and connected back, they will be connected with the old IP and they won't obtain IP from the new vLAN...
Get-VM "v-Win10-Template" | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Get-VM -Name "v-Win10-Template" | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
I'm thinking of a way to renew the VMs IP without disconnecting the session from the end user..
Regards,
Hilbert_nl
17 Posts
You're looking for a situation to refresh the DHCP lease for those VM's ?
Don't you have to loose the 's' from $VMs in the loop? Like this:
Get-VM -Name $VM | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Write-Host $VM "Network Interface Has been disconnected"
Get-VM -Name $VM | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
Write-Host $VM "Network Interface has been reconnected"
January 12th, 2016 05:00
yes, that's right.. I'm looking for a way to refresh the DHCP lease for those VMs.
Dell Support Resources
View All
Top
Habibalby_083114
68 Posts
0
January 12th, 2016 04:00
Hi All,
I think I have to live with this script since it does the job.
$VMs = Get-Content C:\Scripts\VMs.txt
Foreach ($VM In $VMs)
{
Get-VM -Name $VMs | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Write-Host $VMS "Network Interface Has been disconnected"
Get-VM -Name $VMs | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
Write-Host $VMs "Network Interface has been reconnected"
}
Hope it helps someone else...
lwhitelock
11 Posts
0
January 12th, 2016 02:00
What version of vWorkspace are you running?
Habibalby_083114
68 Posts
0
January 12th, 2016 02:00
Hi,
I'm running version 8.5..
This method on the Hyper-V will do, but I'm afraid that when the VMs disconnected and connected back, they will be connected with the old IP and they won't obtain IP from the new vLAN...
Get-VM "v-Win10-Template" | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Get-VM -Name "v-Win10-Template" | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
I'm thinking of a way to renew the VMs IP without disconnecting the session from the end user..
Regards,
Hilbert_nl
17 Posts
0
January 12th, 2016 04:00
You're looking for a situation to refresh the DHCP lease for those VM's ?
Hilbert_nl
17 Posts
0
January 12th, 2016 04:00
Don't you have to loose the 's' from $VMs in the loop? Like this:
$VMs = Get-Content C:\Scripts\VMs.txt
Foreach ($VM In $VMs)
{
Get-VM -Name $VM | Get-VMNetworkAdapter | Disconnect-VMNetworkAdapter
Write-Host $VM "Network Interface Has been disconnected"
Get-VM -Name $VM | Get-VMNetworkAdapter | Connect-VMNetworkAdapter -SwitchName "VDI Networks"
Write-Host $VM "Network Interface has been reconnected"
}
Habibalby_083114
68 Posts
0
January 12th, 2016 05:00
Hi,
yes, that's right.. I'm looking for a way to refresh the DHCP lease for those VMs.
Regards,