Hyper-V & Win10 #2

Page 1 of 2 12 LastLast

  1. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
       #1

    Hyper-V & Win10 #2


    Is there a way to create a Desktop shortcut to the Hyper-V Windows 10 Client so when I double click it I launch Windows 10 under Hyper-V?

    I've seen suggestions for Powershell and VB scripts, none of which I could get to work.
      My Computers


  2. Posts : 803
    10 Pro Preview x64
       #2

    I use this - change the name of the VM and save it somewhere as something.ps1

    Code:
    $vmToStart="CentOS_7_minimal"
     
    if ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -ne "OK") 
    {
     Write-Host "Starting server..." -foregroundcolor "blue"
     start-vm $vmToStart
     do {Start-Sleep -milliseconds 100} 
     until ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -eq "OK")
     Write-Host "Server started." -foregroundcolor "yellow"
    }
    Then you need to make a shortcut with the target like this (but change the path) - the important bit is in bold or it will fail unless you enable all Powershell scripts which you do not want to do.

    Code:
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -File"C:\Users\adam\OneDrive\Windows Software\Powershell\Something.ps1"
    Like this your Powershell window will stay open and wait until the VM is responding.

    Otherwise start-vm whatever_the_name would be sufficient as long as your shortcut is OK.
    Last edited by adamf; 08 Oct 2014 at 19:25.
      My Computer


  3. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
    Thread Starter
       #3

    Doesn't work. I created "D:\tools\Windows 10 TP.ps1" as follows:

    Code:
    $vmToStart="Windows 10"
     
    if ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -ne "OK") 
    {
     Write-Host "Starting server..." -foregroundcolor "blue"
     start-vm $vmToStart
     do {Start-Sleep -milliseconds 100} 
     until ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -eq "OK")
     Write-Host "Server started." -foregroundcolor "yellow"
    }
    Created a shortcut as follows:

    Code:
    %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -File "D:\tools\Windows 10 TP.ps1"
    When I double click the shortcut, a windows opens for about a second:

    Hyper-V & Win10 #2-hypvwin.jpg

    No Windows 10 Hyper-V client starts.

    This is the Hyper-V manager window:

    Hyper-V & Win10 #2-hypvwindow.jpg
    Last edited by Ztruker; 08 Oct 2014 at 20:28.
      My Computers


  4. Posts : 803
    10 Pro Preview x64
       #4

    I'll have to test it tomorrow Rich unless someone else can help out - I'm going to bed.

    EDIT - if you put the -noexit switch in the shortcut you'll see the error

    The exact code that works for me is this - in case I left out a bracket before as I left out some extra bits as I then wait for a service to start and show a web page.

    I also forgot to say you have to run as administrator - I know you don't use UAC but it might be worth changing the shortcut anyway just in case.
    Code:
    $vmToStart="CentOS_7_minimal"
    $url="http://"+$vmToStart+":9091/" 
     
    if ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -ne "OK") 
    {
     Write-Host "Starting Transmission server..." -foregroundcolor "blue"
     start-vm $vmToStart
     do {Start-Sleep -milliseconds 100} 
      until ((Get-VMIntegrationService $vmToStart | ?{$_.name -eq "Heartbeat"}).PrimaryStatusDescription -eq "OK")
     
     Write-Host "Transmission server started." -foregroundcolor "yellow"
      Write-Host "Starting Transmission service..." -foregroundcolor "blue"
     $webClient = New-Object System.Net.WebClient
    
     Do 
     {
      Start-Sleep -Seconds 1
      try { $content = $webClient.DownloadString($url) }
      catch { Write-Host "Page not yet retrieved . . ."}
     } While ( $content -eq $null)
    }
    Start-Process $url

    Shortcut:

    Target: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -noprofile -executionpolicy bypass -File "C:\Users\adam\OneDrive\Windows Software\Powershell\StartTransmission.ps1"

    Start in: %windir%
    Last edited by adamf; 08 Oct 2014 at 20:42.
      My Computer


  5. Posts : 21
    Windows 10
       #5

    Go into program files\Hyper-v
    Go into the 6.3 folder and find the vmconnect.exe and right click and send to desktop. It will create a short cut on your desktop.
    Right click the shortcut on your desktop.
    at the end of the target path line add the servername and the vmname

    "C:\Program Files\Hyper-V\6.3\vmconnect6.3.exe" hvserver vmmachinename

    save your short cut and you should be good to go.

    If you need more help let me know.
      My Computer


  6. Posts : 17,661
    Windows 10 Pro
       #6

    EvilJenius said:
    Go into program files\Hyper-v
    Go into the 6.3 folder and find the vmconnect.exe and right click and send to desktop. It will create a short cut on your desktop.
    Right click the shortcut on your desktop.
    at the end of the target path line add the servername and the vmname

    "C:\Program Files\Hyper-V\6.3\vmconnect6.3.exe" hvserver vmmachinename

    save your short cut and you should be good to go.

    If you need more help let me know.
    To clarify this, talking about native Hyper-V in Windows 10 Technical Preview:

    1. By default the standalone Virtual Machine Connection (VMC) has to be run elevated (if user's role is not changed in authorization management), so from shortcut's Advanced Properties, enable Run as administrator
    2. The correct address for the standalone VMC in Windows 10 Tech Preview is %windir%\system32\vmconnect6.3.exe. The executable in C:\Program Files\Hyper-V\6.3 does not run in Win 10 Tech preview


    Elevated VMC run from C:\Program Files\Hyper-V\6.3:

    Hyper-V & Win10 #2-2014-10-09_20h13_54.png

    Elevated VMC run from C:\Windows\system32\:

    Hyper-V & Win10 #2-2014-10-09_20h12_52.png

    Kari
    Last edited by Kari; 09 Oct 2014 at 13:16.
      My Computer


  7. Posts : 17,661
    Windows 10 Pro
       #7

    The above made me think that we might need a tutorial for this, so here it is: https://www.tenforums.com/tutorials/2...t-windows.html
      My Computer


  8. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
    Thread Starter
       #8

    Worked perfectly Kari, thanks, and thanks to all of you for your assistance and ideas.
      My Computers


  9. Posts : 17,661
    Windows 10 Pro
       #9

    You are welcome :).
      My Computer


  10. Posts : 21
    Windows 10
       #10

    Kari said:
    To clarify this, talking about native Hyper-V in Windows 10 Technical Preview:

    1. By default the standalone Virtual Machine Connection (VMC) has to be run elevated (if user's role is not changed in authorization management), so from shortcut's Advanced Properties, enable Run as administrator
    2. The correct address for the standalone VMC in Windows 10 Tech Preview is %windir%\system32\vmconnect6.3.exe. The executable in C:\Program Files\Hyper-V\6.3 does not run in Win 10 Tech preview


    Elevated VMC run from C:\Program Files\Hyper-V\6.3:

    Hyper-V & Win10 #2-2014-10-09_20h13_54.png

    Elevated VMC run from C:\Windows\system32\:

    Hyper-V & Win10 #2-2014-10-09_20h12_52.png

    Kari
    I get what your saying. True I am running it from a Server vs. Local.

    He still should be able to flag it and launch directly into the VM with out having to select from the drop down.
    Last edited by EvilJenius; 10 Oct 2014 at 12:41.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:59.
Find Us




Windows 10 Forums