Author Archives: Alan

About Alan

Alan Renouf has a role of Automation Frameworks Product Manager at VMware responsible for providing the architects and operators of the cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/vipowershell and has a personal blog at http://virtu-al.net. You can follow Alan on twitter as @alanrenouf.

Monitoring processes inside a vm with PowerCLI

As part of a large scale data analysis project I was working on recently I used Horizon View and Instant clones to allow me to deploy hundreds of VMs based on my original templated VM which had my app I wanted to use to take in the data, transform it and then return a result. Its important to note that this app was never written to work in a batch mode, it literally took one input and gave an output based on a number of factors.

Whilst this post is not about the benefits of Instant Clones, let me tell you, once I had the original template VM working correctly and optimized for performance it worked like a charm, there is something to be said for the simplicity and efficiency of instant clones and the memory sharing techniques it uses to be able to run hundreds of essentially the same VM.

Once I had these VMs deployed via Horizon I could easily send a job to each VM and tell it to run the job, as these jobs however took an indeterminate amount of time to crunch the data, I needed a way to monitor them and let me know when all the jobs had finished on all the VMs so I could pull the data to analyze it.

First I went down the route of using Invoke-VMScript to hook inside the VM’s and see if the process was running, this however took a long time to complete on 100’s of virtual machines and the monitoring job often took over 20 minutes to monitor the VMs and tell me if the job was completed… far too long for what I needed. So after some googling I learned from my good friend William Lam that there was a new API available that through VMtools would update the GuestInfo with the processes running inside the VM on a configurable timely basis (see his post here), this allowed me to essentially push the information externally to the VM Guest Operating system and grab the info when I needed it to see if my process was running.

William had also written a handy function which I adjusted to work with an array of VMs and tell me if the process was running.

Using these new found skills I was easily able to write a function that allowed me to pull the running processes from the VMs and remove them from the list as that process finished inside the VM, for the icing on the cake I even got it to update me in slack on how it was doing šŸ˜‰

So i thought I would share this script and encourage you to think about using this way which is much easier and a more performant way to pull the results of the running processes..

Monitoring Script

Function Send-SlackMessage ($Channel = "#MyProjectChannel", $Message) {
        
    $payload = @{
        "channel"    = $Channel
        "icon_emoji" = ":datacenter:"
        "text"       = $Message
        "username"   = "DC Script"
    }

    Invoke-WebRequest `
        -UseBasicParsing `
        -Body (ConvertTo-Json -Compress -InputObject $payload) `
        -Method Post `
        -Uri "https://myslackhookurl" | Out-Null
}

Function Get-VMApplicationInfo {
<#
    .DESCRIPTION Retrieves discovered applications running inside of a VM
    .NOTES  Author:  William Lam
    .NOTES  Site:    www.virtuallyghetto.com
    .NOTES  Reference: http://www.virtuallyghetto.com/2019/12/application-discovery-in-vsphere-with-vmware-tools-11.html
    .PARAMETER VM
        VM Object
    .PARAMETER Output
        CSV or JSON output file
    .EXAMPLE
        Get-VMApplicationInfo -VM (Get-VM "DC-01")
    .EXAMPLE
        Get-VMApplicationInfo -VM (Get-VM "DC-01") -UniqueOnly
    .EXAMPLE
        Get-VMApplicationInfo -VM (Get-VM "DC-01") -Output CSV
    .EXAMPLE
        Get-VMApplicationInfo -VM (Get-VM "DC-01") -Output JSON
#>
    param(
        [Parameter(Mandatory=$true)]$VM,
        [Parameter(Mandatory=$false)][ValidateSet("CSV","JSON")][String]$Output,
        [Parameter(Mandatory=$false)][Switch]$UniqueOnly
    )

    $appInfoValue = (Get-AdvancedSetting -Entity $VM -Name "guestinfo.appInfo").Value

    if($appInfoValue -eq $null) {
        Write-Host "Application Discovery has not been enabled for this VM"
    } else {
        $appInfo = $appInfoValue | ConvertFrom-Json
        $appUpdateVersion = $appInfo.updateCounter

        if($UniqueOnly) {
            $results = $appInfo.applications | Sort-Object -Property a -Unique| Select-Object @{Name="Application";e={$_.a}},@{Name="Version";e={$_.v}}
        } else {
            $results = $appInfo.applications | Sort-Object -Property a | Select-Object @{Name="Application";e={$_.a}},@{Name="Version";e={$_.v}}
        }

        Write-verbose "Application Discovery Time: $($appInfo.publishTime)"
        if($Output -eq "CSV") {
            $fileOutputName = "$($VM.name)-version-$($appUpdateVersion)-apps.csv"

            Write-Host "`tSaving output to $fileOutputName"
            ($appInfo.applications) | ConvertTo-Csv | Out-File -FilePath "$fileOutputName"
        } elseif ($Output -eq "JSON") {
            $fileOutputName = "$($VM.name)-version-$($appUpdateVersion)-apps.json"

            Write-Host "`tSaving output to $fileOutputName"
            ($appInfo.applications) | ConvertTo-Json | Out-File -FilePath "$fileOutputName"
        } else {
            $results
        }
    }
}


Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ErrorAction SilentlyContinue -Confirm:$false -DisplayDeprecationWarnings $false | out-null
$ProgressPreference = 'SilentlyContinue'


Connect-viserver vcsa-01a.myenv.local -username Administrator@vsphere.local -password VMware1! | Out-Null
$vms = get-vm InstantCloneVM* | Where-Object {$_.PowerState -eq "PoweredOn"} | Sort-Object Name
Send-Slackmessage -message "Monitor Job Started" 
do {
    foreach ($vm in $vms) {
        Write-Host "Checking $VM status..."
        $result = Get-VMApplicationInfo -VM $VM| Where { $_.Application -eq "MyAppProcess.exe" }
        if (!$result){
            Write-Host "Removing $vm as it has completed"
            $vms = $vms | where { $_.Name -ne $vm.name}
        } else {
            Write-Host "$vm still running"
        }
        if (($vms.count -lt 10) -and (! $sentmail)){
            Send-Slackmessage -message "Less than 10 Sigma VMs left"
            $sentmail = $true
        }
    }
    if (! ($oldnumvms -eq ($vms.count))){
        Send-Slackmessage -message "$($vms.count) VMs still running"
    }
    start-sleep -s 30
    $oldnumvms = $vms.count
}
while ($vms)
Send-Slackmessage -message  "All Jobs Completed"

Talking Virtual Reality with today’s teens

Recently I was honored to be asked to talk about Virtual Reality with a good friend of mine, Andrew Boose. He has been a keen follower of VR and whenever we met he would always have a keen interest in what was going on in the VR space and what was coming next.

His awesome parents of course encouraged this hobby and purchased him his first VR headset, the Quest 2… A great choice if you ask me.

Unlike most kids his age Andrew understands that these devices are more valuable than just playing games and recently asked me to jump on a podcast with him to record some of our thoughts on how these devices are being used outside of the gaming circles,

In this 20 minute podcast we discuss a variety of topics like:

  • How I use VR in my job
  • How I see VR being used in enterprise companies
  • Some of the ways we are using VR at VMware
  • What we think the future holds for VMware

TalkingVirtual Podcast – Andrew Boose (age 16) – 20 minutes 09 seconds

I want to thank Andrew for the interesting discussion and for being interested in such an awesome technology at such a young age. Andrew has a bright future ahead of him!

Building an Arcade Cabinet

After my house burnt down recently I needed something to relax me and remove some of the stress of day to day work, filling out endless insurance documents or thinking about what needed to be done to build our next house was getting to me, this kind of stress is common place at the moment, something I see a lot of people can relate to in these pandemic times!

For a while now I have been looking into building an Arcade Cabinet but never really found time to do it.

Given my unique point in life where I literally own nothing, and as something fun to do I set about watching YouTube videos, talking to friends and searching the web for how to put one together and what I would need.  I found my stress relief project!

The idea in this blog post is not to claim I am now an expert at building Arcade cabinets, far from it, its more to share my experience as I cam from knowing nothing and there were questions I had that I had to look in multiple places to answer, this will hopefully provide someone some useful information and help them.

Continue reading

Screen Sharing and Recording a Oculus Quest 2 with a Windows or Mac Computer

With the Oculus Quest 2 coming out recently and having a new better screen resolution, the previous command line options for Oculus Quest 1Ā  screen sharing I blogged don’t quite work for a good sharing mechanism.

I have played around a little and have come up with some numbers that work quite well with scrcpy, follow the below details to install the packages needed and get up and running with screen sharing of the Oculus Quest 2.

Initial Install and Setup

  1. Enable developer mode on your Oculus Quest 2 (https://www.youtube.com/watch?v=1PTFkLnJRLs)
  2. Plug the USB-C cable into your computer and the Quest, this also works with USB to USB-C
  3. If its your first time plugging into this computer you will need to accept the prompt within the device that allows you to access the device from the computer as per below and check the box to always allow if you want to skip this section in the future
  4. For Windows download and unzip the latest build of scrcpy fromĀ https://github.com/Genymobile/scrcpy/releasesĀ a direct link for the current version when writing this is here:Ā https://github.com/Genymobile/scrcpy/releases/download/v1.10/scrcpy-win64-v1.10.zip
  5. For Mac the application is available inĀ Homebrew. Install it using the following from a terminal window:
    brew install scrcpy
  6. You will also needĀ adb. you can install this by running the following from a terminal window:
    brew cask install android-platform-tools

Sharing the Screen connected via cable

  1. Open a command prompt (cmd.exe) or and CD into the extracted folder from above
  2. Run the following command:
    scrcpy--crop 1632:1220:100:320 -m 1600 -b 25M

Sharing the Screen connected wirelessly

You will still need a cable to make an initial connection and start the client on the Quest and then you can disconnect and use wirelessly, use the following steps to connect wirelessly:

  1. Follow steps 1-4 above in the setup section
  2. Open a command prompt (cmd.exe) and CD into the extracted folder from above
  3. While the device is connected via a cable run the following to find out what your Quests IP address is in the src section:
    adb shell ip route
    192.168.1.0/24Ā dev wlan0Ā  proto kernelĀ  scope linkĀ  srcĀ 192.168.1.198
  4. Now run the following replacing the IP address below (192.168.1.198) as yours:
    adb tcpip 5555
    adb connect 192.168.1.198:5555
  5. Disconnect the cable from the PC and with the device disconnected run the command to connect to the device as below
scrcpy --crop 1632:1220:100:320 -m 1600 -b 25M

Sharing Window

If everything worked above a new window should appear showing the device screen, you can then maximize this for a better demo window.

Testing was done with variations of the scrcpy command but the above was found to be the best viewing size to enable a good demo.

Recording the screen

There is also a great way to capture the screen while mirroring, add the following command options to the end of the scrcpy command above to do this:

Ā --record file.mp4

To disable mirroring while recording:

Ā --no-display --record file.mp4

Troubleshooting

Connection Issues

If you get a blank window or are unable to connect when device is plugged in you should be able to run the following command from the same folder above:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 device

The device should show above rather than:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 unauthorized

If you get the latter then make sure you have enabled developer mode and authorized the device as per step 1-3 above.

Target Machine refused connection when in wireless

If you receive a message like the following:Ā “cannot connect to 192.168.1.198:5555: No connection could be made because the target machine actively refused it. (10061)”

Reconnect the Quest to the computer and go from Step 3 in the wireless connection steps above, this is caused because the client on the quest stopped, normally as you reset the device.

Thank You Everyone!

“Thank You”…. words that just really do not convey the magnitude of what I am feeling right now for friends, family, my VMware colleagues and the vCommunity.

I have always prided myself on being the person who helps others, whether its through my blog, my scripts, being a PM and pointing my products in the right direction or just in general life, I have enjoyed being the one who supports others…. recently the shoe has been on the other foot.  As I’m sure most of you know by now, my family home was completely obliterated by the CZU Lightning Complex Fire along with 100’s of other houses.  We were evacuated at 3AM in the morning and were able to grab the basics like passports, a change of clothes and most importantly the family were able to escape safely to a nearby town and a friends house.

We had the bad news a few days after, everything we have ever owned was destroyed šŸ™

We are completely overwhelmed and thankful for the incredible response to the Go Fund Me account and Venmo account that was set up for us by friends and contributed to by 100’s of people.

We canā€™t describe how we are feeling very well as every hour brings a roller coaster of emotions, we have such highs when we see how much everyone wants to help us and how much we are loved and then we have such lows when we remember the little things that we have lost, the kids yearbooks, cheer and softball trophies, all my youngest sons toys and books, My wife’s Tupperware collection, My clown picture that terrified me as a child, so when my Nan passed away of course that was what I wanted from her house!!

This incredible amount of money will make such a difference, there is so much that we have to organize and pay out for even before we can get up to our land and find out where we even begin to start.

Again we thank each and everyone of you that has so generously donated to us, no money canā€™t buy you happiness, but it can buy peace of mind and at the moment thatā€™s priceless, without this fund we would have no peace of mind and I canā€™t imagine how much harder that would make this horrendous situation.

I hope people reading this never have to go through this kind of experience, especially with children, my biggest worry is making sure I provide a stable environment for them.

I have no doubt we will rebuild a better, bigger house once everything is all sorted out and I work through the insurance mine field! My family arrived in America 8 years ago with 8 suitcases and now we are starting again, we know we can do this as the amount of friends we have made is clearly visible through the support we are getting at the moment!

During the bad times there were definitely things that brightened our spirits, far too many to mention here as the help and comments and messages were literally hundreds a day, here are a few that my family found touching, inspiring and funny…

  • The Matlocks, you are amazing! Everything you do for us is fantastic, we are so lucky to have you
  • Pat Gelsinger and the entire C level team at VMware for helping me in every way possible they could
  • Matt Coppinger for being there for me when I melted down in the midst of all the stress!
  • Duncan, Cormac, William, Frank, we have been together since the start and I don’t know what I would do without you guys.
  • Tina & Rick Walsworth, you are amazing, enabling us to get back on our feet in the darkest of our times and have a fresh mind while we worked on insurance and next steps.
  • Andy Banta for making me laugh when my wife couldn’t understand why the donated amount was $256 – Anyone in IT will get the joke!
  • Michael Dell for reaching out to me and making sure we were ok
  • Chris Wolf (You know what you did! WOW!)
  • Tisa Murdock – You really touched our hearts, thank you!
  • My team for picking up the slack while I wasn’t around and we still had deadlines to meet
  • The Rolen Clan, the Adams Family, the Boose Family, all our other friends who were there for us, what ever we needed!
  • Bess and her team at Studio 3 Design for helping us move forward and thing about the memories we want to make in our new home!
  • The vCommunity, I have known the VMware community has been special since I joined it but it astounds me just how fantastic it really is and how much people help and care for each other!
  • The comments on the Go Fund Me page kept us going, my family read every one of them and loved them.

Again, if I didn’t mention you its not that I don’t appreciate you its just that my brain is still fried from working things out! Thank you.

THANK YOU ALL!

And finally a few more pics from the rubble which I will one day print out…

 

Screen sharing and recording a Pico Neo2 with Windows or Mac

Recently I have been using the Pico Neo2, a 6DOF device with is comparable to the Oculus Quest and works pretty well for enterprise use cases.

Compared to other headsets it is a lot more open when it comes to working with and managing the operating system, in developing for the headset there were occasions when I needed to share or record the screen to show others what I was seeing.

As with sharing the Quest, previously written about here, Screen Copy (scrcpy) came in very handy with the right configuration for the headsets display.

One thing that is rather annoying about the Pico is that it loves to change screen resolution when you are using it, mainly when accessing what was previously a 2D android based app or settings dialog etc.Ā  In VR you wont really notice the difference as they do a great job of handling the 2D apps and giving you an immersive space to work with them but when using scrcpy you often see the output completely change.Ā  The only workaround I have found for this is that when a 2D screen appears and messes up the screen display, just run scrcpy with no parameters.Ā  This will default to the resolution of the screen and show you the 2D dialog, as soon as you go back into VR mode though you will need to relaunch scrcpy in the below way otherwise you will get a 2 Eye output.

But for most experiences in VR you can use the below instructions to display and record the screen.

Initial Install and Setup

  1. Plug the USB-C cable into your computer and the Pico Neo2.
  2. If its your first time plugging into this computer you will need to accept the prompt within the device that allows you to access the device from the computer and check the box to always allow if you want to skip this section in the future
  3. For Windows download and unzip the latest build of scrcpy fromĀ https://github.com/Genymobile/scrcpy/releasesĀ a direct link for the current version when writing this is here:Ā https://github.com/Genymobile/scrcpy/releases/download/v1.10/scrcpy-win64-v1.10.zip
  4. For Mac the application is available inĀ Homebrew. Install it using the following from a terminal window:
  5. brew install scrcpy
  6. You will also needĀ adb. you can install this by running the following from a terminal window:
  7. brew cask install android-platform-tools

Sharing the Screen connected via cable

  1. Open a command prompt (cmd.exe) or and CD into the extracted folder from above
  2. Run the following command:
  3. scrcpy --cropĀ 1280:1776:400:60 -mĀ 1600Ā -bĀ 25M

Sharing the Screen connected wirelessly

You will still need a cable to make an initial connection and start the client on the Neo2 and then you can disconnect and use wirelessly, use the following steps to connect wirelessly:

  1. Follow steps 1-4 above in the setup section
  2. Open a command prompt (cmd.exe) and CD into the extracted folder from above
  3. While the device is connected via a cable run the following to find out what your Quests IP address is in the src section:
  4. adb shell ip route
    192.168.1.0/24Ā dev wlan0Ā  proto kernelĀ  scope linkĀ  srcĀ 192.168.1.198
  5. Now run the following replacing the IP address below (192.168.1.198) as yours:
  6. adb tcpip 5555
    adb connect 192.168.1.198:5555
  7. Disconnect the cable from the PC and with the device disconnected run the command to connect to the device as below
scrcpy --crop 1280:1776:400:60Ā -b 25M

Sharing Window

If everything worked above a new window should appear showing the device screen, you can then maximize this for a better demo window.

Testing was done with variations of the scrcpy command but the above was found to be the best viewing size to enable a good demo.

Recording the screen

There is also a great way to capture the screen while mirroring, add the following command options to the end of the scrcpy command above to do this:

Ā --record file.mp4

To disable mirroring while recording:

Ā --no-display --record file.mp4

Troubleshooting

Connection Issues

If you get a blank window or are unable to connect when device is plugged in you should be able to run the following command from the same folder above:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 device

The device should show above rather than:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 unauthorized

If you get the latter then make sure you have enabled developer mode and authorized the device as per step 1-3 above.

Target Machine refused connection when in wireless

If you receive a message like the following:Ā “cannot connect to 192.168.1.198:5555: No connection could be made because the target machine actively refused it. (10061)”

Reconnect the Pico to the computer and go from Step 3 in the wireless connection steps above, this is caused because the client on the Pico stopped, normally as you reset the device.

Immersive Education in Virtual Reality – Your chance to join in

Education, its one of those subjects that’s front of mind for me at the moment, anyone who has children will know that recently and under current circumstances with the pandemic, the kids and teachers are finding it hard to provide an alternative learning experience, one that allows the teacher to give great content and engage the children, but at the same time give the children the interaction and social aspects they need for a good learning experience.

For a long time now it bugs me that the way we teach has not been modernized for decades, the classrooms and content may have changed but the way we teach is still fundamentally the same.

The team I work on did some early prototyping on some of the key use case subjects we saw in XR and one of these was education, since then I have been sold that this medium allows for a much more enriched learning experience and with COVID-19 more recently it has only reinforced my thoughts on this subject.

I have seen lots of great articles on VR in Education (one of my favorites here) and they are normally aimed at college students.Ā  Having a child myself who is just about to enter high school I felt like she should also be able to take advantage of this medium and new way of learning, then when browsing LinkedIn recently I found a great offer which I wanted to share so that others could take advantage of it.

No alternative text description for this image

Wendy Martin, who was a national finalist for teacher of the year is teaching a four week class about Biological Form and Function in Virtual Reality usingĀ  VictoryXR and it is aimed at high school or smart middle school students as is a group collaborative experience.

This also hits on another great reason to use VR, no frogs will be harmed during this lesson! (only virtual frogs).

VictoryXR is a VR Educational Platform and is being used to provide this learning experience, it is available for $165 per year for the Academy or VicrotyXR.Direct is $10 per month per headset.

The additional cost of this training from Wendy is $40, but they are providing a coupon code for 50% off: VXRWM50

The course will be four sessions, with independent activities during the week and the following dates/times are available:

Tue, July 14th @ 11:00 Anatomical Form & Function
Tue, July 21st @ 11:00 Evolutionary Form & Function
Tue, July 28th @ 11:00 Genetic Form & Function
Tue, Aug 4th @ 11:00 Viral Form & Function

Can’t make it? No problem, they will be recorded and you will haveĀ  access to the classes after the event.

What you need:

  • A VR headset
  • A license from VictoryXR.

SIGN UP HERE: https://lnkd.in/ez5MYHU

This sounds like a great way to bring the best education to you wherever you live and set your child up with an immersive experience with a nationally recognized teacher.

SCREEN SHARING AND RECORDING A PICO G2 4K WITH A WINDOWS OR MAC COMPUTER

Recently I have been using the Pico G2 4K, a 3DOF device with one controller which works pretty well for enterprise use cases such as 360 video or simple training use cases.

Compared to other headsets it is a lot more open when it comes to working with and managing the operating system, in developing for the headset there were occasions when I needed to share or record the screen to show others what I was seeing.

As with sharing the Quest, previously written about here, Screen Copy (scrcpy) came in very handy with the right configuration for the headsets display.

One thing that is rather annoying about the Pico is that it loves to change screen resolution when you are using it, mainly when accessing what was previously a 2D android based app or settings dialog etc.Ā  In VR you wont really notice the difference as they do a great job of handling the 2D apps and giving you an immersive space to work with them but when using scrcpy you often see the output completely change.Ā  The only workaround I have found for this is that when a 2D screen appears and messes up the screen display, just run scrcpy with no parameters.Ā  This will default to the resolution of the screen and show you the 2D dialog, as soon as you go back into VR mode though you will need to relaunch scrcpy in the below way otherwise you will get a 2 Eye output.

But for most experiences in VR you can use the below instructions to display and record the screen.

Initial Install and Setup

  1. Plug the USB-C cable into your computer and the Pico G2 4K.
  2. If its your first time plugging into this computer you will need to accept the prompt within the device that allows you to access the device from the computer and check the box to always allow if you want to skip this section in the future
  3. For Windows download and unzip the latest build of scrcpy fromĀ https://github.com/Genymobile/scrcpy/releasesĀ a direct link for the current version when writing this is here:Ā https://github.com/Genymobile/scrcpy/releases/download/v1.10/scrcpy-win64-v1.10.zip
  4. For Mac the application is available inĀ Homebrew. Install it using the following from a terminal window:
  5. brew install scrcpy
  6. You will also needĀ adb. you can install this by running the following from a terminal window:
  7. brew cask install android-platform-tools

Sharing the Screen connected via cable

  1. Open a command prompt (cmd.exe) or and CD into the extracted folder from above
  2. Run the following command:
  3. scrcpy --cropĀ 1280:1776:400:60 -mĀ 1600Ā -bĀ 25M

Sharing the Screen connected wirelessly

You will still need a cable to make an initial connection and start the client on the Pico and then you can disconnect and use wirelessly, use the following steps to connect wirelessly:

  1. Follow steps 1-4 above in the setup section
  2. Open a command prompt (cmd.exe) and CD into the extracted folder from above
  3. While the device is connected via a cable run the following to find out what your Pico’s IP address is in the src section:
  4. adb shell ip route
    192.168.1.0/24Ā dev wlan0Ā  proto kernelĀ  scope linkĀ  srcĀ 192.168.1.198
  5. Now run the following replacing the IP address below (192.168.1.198) as yours:
  6. adb tcpip 5555
    adb connect 192.168.1.198:5555
  7. Disconnect the cable from the PC and with the device disconnected run the command to connect to the device as below
scrcpy --crop 1280:1776:400:60Ā -b 25M

Sharing Window

If everything worked above a new window should appear showing the device screen, you can then maximize this for a better demo window.

Testing was done with variations of the scrcpy command but the above was found to be the best viewing size to enable a good demo.

Recording the screen

There is also a great way to capture the screen while mirroring, add the following command options to the end of the scrcpy command above to do this:

Ā --record file.mp4

To disable mirroring while recording:

Ā --no-display --record file.mp4

Troubleshooting

Connection Issues

If you get a blank window or are unable to connect when device is plugged in you should be able to run the following command from the same folder above:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 device

The device should show above rather than:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 unauthorized

If you get the latter then make sure you have enabled developer mode and authorized the device as per step 1-3 above.

Target Machine refused connection when in wireless

If you receive a message like the following:Ā “cannot connect to 192.168.1.198:5555: No connection could be made because the target machine actively refused it. (10061)”

Reconnect the Pico to the computer and go from Step 3 in the wireless connection steps above, this is caused because the client on the Pico stopped, normally as you reset the device.

Learn more about Enterprise AR/VR on the VMTN Podcast

Recently I was a guest on the VMware Communities Podcast where we spoke about Spatial Computing, Virtual Reality and Augmented reality and where these play in the enterprise, this was a great overview of what my life has been for the last while so I thought I would post it here for those interested in this space and looking to learn more.

You can download/listen to the podcast version here: https://t.co/bpRw8P9fam

Screen Sharing and Recording a Oculus Quest with a Windows or Mac Computer

Recently I attended a conference where I needed to display a demonstration of what we were doing in VR on the Oculus Quest, the Quest has some great mechanisms for casting to a mobile phone or to a Chromecast device attached to a TV but when it comes to sharing to a laptop there isn’t really a good solution at the moment.  Im sure that will all change when they bring out Oculus Link (for a wired connection anyway) but we needed something now.

After digging around on some forums and piecing some data together from youtube, forums and reddit I thought i would make a note of the end result here which enables you to use scrcpy, an android screen sharing utility, to share both with a wire but also wirelessly and also enables an easy way to capture video straight to the computer.

Initial Install and Setup

  1. Enable developer mode on your Oculus Quest (https://www.youtube.com/watch?v=1PTFkLnJRLs)
  2. Plug the USB-C cable into your computer and the Quest, this also works with USB to USB-C
  3. If its your first time plugging into this computer you will need to accept the prompt within the device that allows you to access the device from the computer as per below and check the box to always allow if you want to skip this section in the future
  4. For Windows download and unzip the latest build of scrcpy from https://github.com/Genymobile/scrcpy/releases a direct link for the current version when writing this is here: https://github.com/Genymobile/scrcpy/releases/download/v1.10/scrcpy-win64-v1.10.zip
  5. For Mac the application is available in Homebrew. Install it using the following from a terminal window:
  6. brew install scrcpy
  7. You will also need adb. you can install this by running the following from a terminal window:
  8. brew cask install android-platform-tools

Sharing the Screen connected via cable

  1. Open a command prompt (cmd.exe) or and CD into the extracted folder from above
  2. Run the following command:
  3. scrcpy -c 1200:800:180:320 -m 1600 -b 25M

Sharing the Screen connected wirelessly

You will still need a cable to make an initial connection and start the client on the Quest and then you can disconnect and use wirelessly, use the following steps to connect wirelessly:

  1. Follow steps 1-4 above in the setup section
  2. Open a command prompt (cmd.exe) and CD into the extracted folder from above
  3. While the device is connected via a cable run the following to find out what your Quests IP address is in the src section:
  4. adb shell ip route
    192.168.1.0/24 dev wlan0  proto kernel  scope link  src 192.168.1.198
  5. Now run the following replacing the IP address below (192.168.1.198) as yours:
  6. adb tcpip 5555
    adb connect 192.168.1.198:5555
  7. Disconnect the cable from the PC and with the device disconnected run the command to connect to the device as below
scrcpy -c 1200:800:180:320 -m 1600 -b 25M

Sharing Window

If everything worked above a new window should appear showing the device screen, you can then maximize this for a better demo window.

Testing was done with variations of the scrcpy command but the above was found to be the best viewing size to enable a good demo.

Recording the screen

There is also a great way to capture the screen while mirroring, add the following command options to the end of the scrcpy command above to do this:

 --record file.mp4

To disable mirroring while recording:

 --no-display --record file.mp4

Troubleshooting

Connection Issues

If you get a blank window or are unable to connect when device is plugged in you should be able to run the following command from the same folder above:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 device

The device should show above rather than:

PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 unauthorized

If you get the latter then make sure you have enabled developer mode and authorized the device as per step 1-3 above.

Target Machine refused connection when in wireless

If you receive a message like the following: “cannot connect to 192.168.1.198:5555: No connection could be made because the target machine actively refused it. (10061)”

Reconnect the Quest to the computer and go from Step 3 in the wireless connection steps above, this is caused because the client on the quest stopped, normally as you reset the device.