Hi All,
I have created a script to rename the network adapter in windows virtual machine based its mac address. Below is my script.
$vmname = "w12-core"
$vmacaddress = "00:50:56:9C:63:8A"
$script =
{
$wmi = Get-wmiobject -Class win32_Networkadapter | where { $_.Macaddress -eq $vmacaddress }
$wmi.NetconnectionID = 'Newcard'
$wmi.put()
}
Invoke-Vmscript - VM $vmname -ScriptText = $script -Guestuser="Administrator" -GuestPassword = "VMware1!"
Am getting some error while passing macaddress via variable $vmacaddress. Script is getting executed If i mentioned the macaddress directly. ($wmi = Get-wmiobject -Class win32_Networkadapter | where { $_.Macaddress -eq "00:50:56:9C:63:8A" }
Need a help in passing local variable to remote.