Upgrade of computer virtual guest NIC and other things using PowerCLI

Someone at - it figures out how to do this?  I'm trying to script the following process:

  • Script VM Tools Upgrade to the current version.  <-done, grabbed from somewhere.  Using the cmdlet Update-tools after checking
Function Check-ToolsStatus($vm){
$vmview = get-VM $vm | Get-View
$status = $vmview.Guest.ToolsStatus
if ($status -match "toolsOld"){
$vmTools = "Old"}
elseif($status -match "toolsNotRunning"){
$vmTools = "Not Running"}
else{
$vmTools = "Ok"}
return $vmTools
}
  • Script VM hardware upgrade from 4 to 7.  <-done, grabbed from somewhere.
Function Check-VMHardwareVersion($vm){
     $vmView = get-VM $vm | Get-View
     $vmVersion = $vmView.Config.Version
     $v4 = "vmx-04"
     $v7 = "vmx-07"
     
          if ($vmVersion -eq $v4){
               $vmHardware = "Old"}
          elseif($vmVersion -eq $v7){
               $vmHardware = "Ok"}          
          else{Write-Host "Error!!" -ForegroundColor Red
               $vmHardware = "Error"}
          
          return $vmHardware
}

Function Upgrade-VMHardware($vm){

     $vmview = Get-VM $vm | Get-View
     $vmVersion = $vmView.Config.Version
     $v4 = "vmx-04"
     $v7 = "vmx-07"

          if ($vmVersion -eq $v4){
               Write-Host "Version 4 detected" -ForegroundColor Red
               
               # Update Hardware
               Write-Host "Upgrading Hardware on" $vm -ForegroundColor Yellow
               Get-View ($vmView.UpgradeVM_Task($v7)) | Out-Null
     }     
}
  • Current NIC script copy configurations. <-don't know how to do this.  vbScript? netsh? using invoke-vmscript?
    • Get the full IP address configuration.
    • Need to get the nic associated with network adapter classes.
????
  • Script adds VMXNET 2 | 3 NIC. <-see below for the idea.
#My Thought
New-NetworkAdapter -Type EnhancedVmxnet -NetworkName <from previous script> -vm <targetvm> -confirm:$false
    • Need to remove old nic, once the settings have been transferred.
#Probably a where statement would be better since I only want to remove non enhancedvmxnet and vmxnet3
$nic = Get-NetworkAdapter -VM | Remove-NetworkAdapter -networkadapter $nic[0]
  • Apply script copied configs to new nic NIC (VMXNET2 | 3) <-don't know how to do this. vbScript? netsh? using invoke-vmscript?

????

  • Script vmdisk add, change pvscsi controller, wait 30 seconds for the OS detect.
#My Thought
$tempdisk = $vm | New-Harddisk -CapacityKB 2048 -StorageFormat Thin
Sleep 30
$vm | Shutdown-VMGuest -confirm:$false
Sleep 90
If ($vm.powerstate -eq "PoweredOn"){Stop-VM $vm -Confirm:$false}
$tempdisk | New-ScsiController -Type Paravirtual
Start-VM $vm -confirm:$false
Sleep 90
  • Script to stop, remove added disk and change current pvscsi discs
#My Thought
$vm | Shutdown-VMGuest -confirm:$false
Sleep 90
If ($vm.powerstate -eq "PoweredOn"){Stop-VM $vm -Confirm:$false}
$tempdisk = $vm | get-harddisk | where {$_.CapacityKB -eq "2048"}
$tempdisk | Remove-HardDisk
$vm | get-harddisk | set-scsicontroller -type paravirtual -confirm:$false
Start-VM $vm -confirm:$false

Post edited by: Zsoldier

Hello

It work certenly with the root user, but it is possible to allow the change with the user from the Group of the root. Behind the two cmdlets, there are two perl scripts that you can find in the folder C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\. The scripts are GetVmGuestNetworkInterface_LinuxGuest and SetVMGuestNetworkInterface_LinuxGuest.

The Get script reads the configuration from/etc/sysconfig/network-script / ifcfg * deposits and also run the ifconfig command. A small observation on sharp file permissions shows that the get cmdlet will work with the user to the root group.

The game script written in the configuration in sysconfig files /, so you should give permission to write to the root group if you want to use another user.

The Linux box in our test environment is RedHat Enterprise 5

Vitali

Team PowerCLI

Tags: VMware

Similar Questions

  • I want to activate Acrobat Pro 9 serial key and get message that are 2 active activations. We're old computer with problematic material and other is the same pc that I didn't turn off the license and reformatted. What should do?

    I want to activate Acrobat Pro 9 serial key and get message that are 2 active activations. We're old computer with problematic material and other is the same pc that I didn't turn off the license and reformatted. What should do?

    I didn't know, I had to disable before turning back, but now I don't have this option. Is there a way to disable these two licenses and activate again the good?

    Hi vasilisp36877173 ,

    Please see these items:- Learn how to enable or disable Adobe applications

    Solve the problems of activation and deactivation of Adobe and error messages

    Let me know how it goes.

    Kind regards

    Christian

  • My old homepage of Mozilla like Google with the search in the middle of page bar. He now has info and other things listed.

    I just got my computer fixed and had again to download Mozilla. I used to have a page that was just with the symbol of firefox and a search bar in the middle of page similar to Google. Now, the page has just firefox info on it and other things. No search bar in the middle. How to bring back the old page? Thank you, Olivia Grizzle

    See How to set the home page

  • Is it legal to make spreadsheets and other activities using Word from Microsoft and your website software clip art for commercial use?

    Original title: TeachersPayTeachers.com

    I'll be seller on the web site of teachers pay teachers. Is it legal to make spreadsheets and other activities using Word from Microsoft and your website software clip art for commercial use? Also, is it legal to do PowerPoint presentations to sell on TpT?  Is it legal to use your fonts as free cosmic in my products? Be sure to answer you in simple, all of the legal terms because my head spin.

    Thank you

    Irish

    Original title: TeachersPayTeachers.com

    I'll be seller on the web site of teachers pay teachers. Is it legal to make spreadsheets and other activities using Word from Microsoft and your website software clip art for commercial use? Also, is it legal to do PowerPoint presentations to sell on TpT?  Is it legal to use your fonts as free cosmic in my products? Be sure to answer you in simple, all of the legal terms because my head spin.

    Thank you

    Irish

    When you register as a seller on TPT you can then go to their forum and find all your answers.  Click on your dashboard (you'll see that once you signed) and you will find the forums where the seller go to questions and support.  I hope this helps.

  • Get the computer virtual with "Check and upgrade before each start-up tools" checked.

    Hello

    I want to know if we have machines virtual with the indicator "Check and upgrade before each start-up tools", is activated. It is possible via the current shell?

    Thank you in advance.

    Saludos.

    Xavier

    VCP4 and professional VCP3 certified VMware.

    -


    If upon that esta o any other campaign respuesta ha sido utility, votalas. Gracias.

    If you find this or any other information useful or appropriate, please consider giving points. Thank you.

    The next PowerCLI script will give a list of all virtual machines with the indicator "Check and upgrade before each start-up tools" is activated:

    Get-VM | Get-View | `
    Select-Object -property Name,@{N="ToolsUpgradePolicy";E={$_.Config.Tools.ToolsUpgradePolicy}} | `
    Where-Object { $_.ToolsUpgradePolicy -eq "upgradeAtPowerCycle" }
    

    Robert

  • Are automatically shared Contacts with the members of the family of a device for all devices of the family? One device uses IOS9 and others are using IOS10.

    Members of the family can share Contacts?  A member of the family is on IOS9 and others are on IOS10. Our calendars are sharing but not our contacts?

    No, sharing of family does not share Contacts. He shares:

    Purchases

    (If you are registered) Apple's music

    Family Photo album

    Family calendar

    Location sharing

    Find my iPhone

    Apple - iCloud - family sharing

    See you soon,.

    GB

  • When I try to open firefox, and other things appear the next tex said thatt was not able to load XPCOM

    Since yesterday, I could not access internet firefox, pops up a window with the message unable to load XPCOM

    Loïc Macarena SilviaFigueroa,

    Do a clean reinstall and delete the program folder before Firefox to (re) install a new copy of the current version of Firefox.

    Download a new copy of Firefox and save the file to the desktop.

    Uninstall your current version of Firefox, if possible, the settings in the software security and cleaning of the Windows registry.

    • Do NOT remove the data personal when you uninstall your current version of Firefox, because all profile files will be deleted and you lose personal data such as bookmarks and passwords from other versions of Firefox profiles.

    Delete the program folder Firefox before installing newly downloaded copy of the Firefox installer.

    • (32-bit Windows) "C:\Program Files\Mozilla Firefox\"
    • (Windows 64 bit) "C:\Program Files (x 86) \Mozilla.

    Your bookmarks and other personal data are stored in the Firefox profile folder and will not be affected by a uninstall and (re) install, but make sure that 'delete personal data' is NOT selected when you uninstall Firefox.

    If you keep problems also create a new profile.

  • Windows Vista: I had a bar where I could put programs and other things, it disappeared yesterday

    Windows Vista: yesterday my computer up to date and this bar I have where I could put programs and stuff diapeared. I have no idea where or what it is... pls help. I love him and miss me...

    What is the dock of Dll?

    Go to your Start Menu, all programs. Find the folder "Dell". Open it and click on your Dell Dock.

  • Random resets on the taskbar and other things.

    Well, then this probably won't to come out very well because I don't really know what I'm talking about you, but I will go ahead in any case. I watched an episode of a television show of my hard drive on the VLC Player and it froze and nothing was happening, there just repeat the same section of the episode on a newer, no matter what I did, I closed the lid of my laptop but it continued so I stop the laptop by holding the power button and when I turned it It came with a black screen and plenty of writing emerged as she has been updated or do something tells 1/3 and all a bunch of numbers, and when he finally turned back on correctly, almost everything was the same except that I used to have my taskbar and window colors purple, and now they are back to normal and I don't know how to change it back , and the only other thing I noticed that changed, it was that now when I tap all open programs in the taskbar, it came not with the small windows as it was, if that makes sense, he said only: name of the window. That's all until I've noticed has changes, and I would like to know what the problem is and how to change it back.
    Thanks :) Just FYI, I have little knowledge of computers and so I tend to google everything.

    Hello

    As the issue took place recently, I suggest you to perform system restore to the date it was working fine.

    System restore
    http://Windows.Microsoft.com/en-CA/Windows7/products/features/system-restore

    I hope this helps.

  • upgrade VM NIC drivers for a computer virtual once VMtools and HW version upgrade to version 7

    Hi people,
    I just wanted to know your opinion on the VM NIC driver update once the VMS migrate from ESX3.5 to ESXi4.1 and as I am course upgrade VMware Tools 4 to 7 HW version. Please let me know as
    as the current network adapter is E1000. Need to move the VM NIC as well?

    Thank you
    vmguys

    as the current network adapter is E1000. Need to move the VM NIC as well?

    Hello

    you don't have to

    1. upgrade Vmware tools
    2. upgrade from version HW - don't forget that with version 8 VM can run only on ESXi5
  • Can I use programs purchased on two different computers? A computer is with IOS and other Windows.

    Hello! A purchased plan-program can be used on two computers?

    Cloud license allows 2 activations http://www.adobe.com/legal/licenses-terms.html

    -Install on a 2nd computer http://forums.adobe.com/thread/1452292?tstart=0

    -https://helpx.adobe.com/creative-cloud/help/sign-in-out-activate-apps.html

    -Windows or Mac has no importance... 2 on the same operating system or 1 on each

    -Two activations on one account CAN NOT be used at the same time (to be noted in the link above of the license)

  • Conversion of computer virtual vmware ESX4I and windows product activation server.

    Hello

    I tried to use vmware vmkfstools and convert import vmware server VM to ESX4i, none of them will cause Windows VMs to product activation trigger with no grace period windows so I can't use VMs on ESXi. How you can work around this problem.  I guess that I searched a lot on this subject, but no clear answer found to date.

    Thanks in advance

    MS may have made changes in their software to detect the cloned software and changes to the underlying host.

    http://www.VMware.com/solutions/whitepapers/msoft_licensing_wp.html

  • Games for Windows 7 and other things

    Three questions. I am currently using windows 7 rc and I tried to install a game that has been relased for vista only.  When the final version comes out I will be able to install on windows 7 or should I set up my secondary hard drive with my vista just to be able to play these games? Second element is I have a media player Extender hooked into my TV and with the CR I can't play my movies of the comp at the tv will this problem be resolved?  And finally I run a proccessor QuadCore with technically five gigabytes of ram, four on the motherboard and the other on my video card and Vista, my processor speed was a 5.9, but for some reason any Windows 7, it shows as a 4.4 whats the agreement on that?  other then that like the look and have had no problems with it again and actually think go against my own style and ordering a first edition software which is something I never really have.

    You should not have problems during installation and running the game on Windows 7.  As for other concerns you have, who should be resolved in the finished product and if Intel ever get the of it act together and starts to communicate with the developers of software and hardware.

    I have also included a statement from one of my previous posts just for those who may be reading and the question.

    Windows 7 will the have same backwards compatibility with programs that Vista has.  Which means that if the program or game is old (XP before or at the beginning) the chances are that it will not work.
    Windows 7 includes some versions of virtual XP which will allow you to run old XP programs in a virtual XP machine.
    If you include Virtual XP, Windows 7 will be able to run all XP software without problem.  Don't forget that you will need to have the right hardware to use virtual machines such as Virtual XP very well.

    see you soon
    I have a simple philosophy: just assume everyone is a piece of _ and then be pleasantly surprised if you find someone who is not.

  • How can I set the new version of firefox so that the things that I write in journals and other things are stored in case I accidentally leave the page?

    In Firefov version 3, there is a feature that will remember what I typed in a journal or note the entry before posting. Is not like an auto-complete because test disappears if I browse pages too far from him. The usefulness of this one was that if accidentally, I sailed off the page before sending my message or my journal, I might just press the back button and what I wrote above would still be there. I had to go back to version 3.6.19 because version 5 does not have this option turned on, unless you preform a very specific routine. You will need to reactivate the ability of firefox to save the tabs when you exit. Then, you must close firefox while saving the tab with the page you want to write a journal about pulled up. Then, when you go back to firefox, you can tap on the saved page and if you accidentally leave it, you can press the back button and it is saved. However, it disappears when you refresh the page or try it on any other page. I would like to know if it would be possible for me to activate this feature in firefox 5, or if I should continue to use version 3.

    Try to use this extension.

    https://addons.Mozilla.org/en-us/Firefox/addon/textarea-cache/

  • Satellite Pro A10: Error when loading the drivers and other things

    Hello.
    I just bought a spare A10 to ebay. I already have an A10 and the company. Powering up the new A10, I have a bubble message from microsoft saying that it was unable to load the drivers for the cd burning software, please update the drivers. If I click on the bubble it says to update of real player, roxio or other recording software.

    As I did not immediately and there not there when bought. Its not broken, its all just annoying. Also when I right click anywhere on the desktop, in the coloum that you see, I get a link to an adult site, how can I get rid of this?

    I want to thank you for taking the time to read this and would be grateful if you could help.

    Jack.

    Hi Jack,

    I suggest you to check what is actually underway when you start your new A10 using MSCONFIG. This will then stop these tasks that you do not want to be started up and should prevent your error message displayed.

    I also suggest you download and install a copy of AdAware http://www.lavasoft.com (and perhaps also http://www.spybot.info/en/download/index.html SpyBot) and do a check complete of your new A10 to remove any nasties that may be hiding there.

    It seems that if the previous owner has removed some of the software they had installed, but is not completely cleaned afterwards.

    Finally, I personally use a freeware CCleaner http://www.ccleaner.com/ for utility call which is excellent to remove the pieces left over on my laptop. It must be treated with some caution, because it is a powerful utility, but it is very quick and thorough.

    Kind regards

Maybe you are looking for