Automation

 View Only
  • 1.  Problem with $_.ID

    Posted Mar 27, 2008 03:30 PM

    Any ideas why this doesn't work:

    PS C:\Documents and Settings\plyons\Desktop> get-vm | %{(Get-View $_.ID).Guest.T

    oolsStatus}

    Get-View : A parameter cannot be found that matches parameter name 'VirtualMach

    ine-vm-3120'.

    At line:1 char:21

    + get-vm | %{(Get-View <<<< $_.ID).Guest.ToolsStatus}

    Get-View : A parameter cannot be found that matches parameter name 'VirtualMach

    ine-vm-4020'.

    At line:1 char:21

    + get-vm | %{(Get-View <<<< $_.ID).Guest.ToolsStatus}

    Get-View : A parameter cannot be found that matches parameter name 'VirtualMach

    ine-vm-3112'.

    PS C:\Documents and Settings\plyons\Desktop> get-vm | ft name,ID

    Name ID

    -


    --

    vm-img-win VirtualMachine-vm-3120

    vm-oes-serv1 VirtualMachine-vm-4020

    vm-clark VirtualMachine-vm-3112

    Any insight would be greatly appreciated.

    Thanks,

    Paul



  • 2.  RE: Problem with $_.ID
    Best Answer

    Posted Mar 27, 2008 03:43 PM

    Are you sure you're running the Beta build? Do you have a cmdlet called Get-VIToolkitVersion?

    FWIW, the script works for me:

    PS> get-vm | %{(Get-View $_.ID).Guest.ToolsStatus}

    toolsNotRunning

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsNotInstalled

    toolsOk



  • 3.  RE: Problem with $_.ID

    Posted Mar 27, 2008 03:52 PM

    I thought I was, but now I'm not so sure:

    PS C:\Documents and Settings\plyons\Desktop> Get-VIToolkitVersion

    The term 'Get-VIToolkitVersion' is not recognized as a cmdlet, function, operable program, or script file. Verify the t

    erm and try again.

    At line:1 char:20

    + Get-VIToolkitVersion <<<<



  • 4.  RE: Problem with $_.ID

    Posted Mar 27, 2008 04:38 PM

    I thought I was, but now I'm not so sure:

    PS C:\Documents and Settings\plyons\Desktop> Get-VIToolkitVersion

    The term 'Get-VIToolkitVersion' is not recognized as a cmdlet, function, operable program, or script file. Verify the t

    erm and try again.

    At line:1 char:20

    + Get-VIToolkitVersion <<<<

    You definately have our earlier tech preview then. If you install the Beta your script will work.



  • 5.  RE: Problem with $_.ID

    Posted Mar 27, 2008 04:49 PM

    My bad, was running older version.

    Thanks for the help!

    Paul