Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Saturday, August 01, 2020

SCRCPY - No Frills Tool for Android Screen Mirroring

If you are Android user and wanted to Mirror your mobile or tablet screen on your laptop for presentations or want to control your phone from your computer without having to switch between the devices every now and then SCRCPY is the tool for you. It is OpenSource, free and easy to setup. Works out of the box once you enable Developer Options and Switch on USB Debugging on your Android Device.

Once it is setup, you can control your device from your computer using Keyboard and Mouse, make use of the larger screen real estate of your computer instead of your tiny mobile device screen. You can check your SMS, notifications, open your favorite apps, play games etc all from your computer. Best part - it works on Windows, Linux and MacOS

Now lets get to work.

First download SCRCPY that is suitable to your OS from the Github page link below


It would download a Zip file that you can unzip to a location of your choice.



Enable USB Debugging on your Device
1. Make sure your device is running on Android 5.0 or higher. You can get this information from About section in settings of your device
2. Enable Developer Options on your Device. To do this tap 7 to 8 times on the Build Number in the About section in the Settings screen
3. You will see that message will be displayed saying Developer Options have been enabled on your device
4. Now Return to the main Settings page and select Developer Options and scroll down to find USB Debugging and enable it.

Now Connect your device to your computer using a USB cable and in couple of seconds you would see a prompt on your phone to accept the fingerprint of the Computer, select allow this computer and click 'OK'

Got to SCRCPY folder and launch scrcpy-noconsole with Admin Privilege, on Windows you can right click and select run as administrator, on Linux and Mac OS you can launch it as super user from terminal. If everything worked as expected it would show up your mobile screen on your computer


1. Use your Mouse right click to wake your device.
2. Use left click to interact with your device.
3. Use Ctrl+R on keyboard to Rotate the screen
4. You can also Use Ctrl+P to Wake your device.

By default the mirroring function would keep the actual screen device active. Use Ctrl+O to Poweroff
the device screen, however, SCRCPY window would be still available for use

You can now launch your favorite apps on your phone without even touching your phone all from your computer with all the convenience of Keyboard and Mouse.

To take it to next level you can actually configure SCRCPY to work on Wifi so that you can get rid of the USB cable between your device and computer. For this follow below steps.

Make sure your Android Device and Computer are connected to the same WiFi network.
Find out the IP address of your Android Device from WiFi advanced settings

Connect your Android Device to your computer using the USB cable.
Open Command prompt in admin mode, navigate to SCRCPY folder and run below two command
adb tcpip 5555
adb connect DEVICE_IP:5555 (Replace DEVICE_IP with IP address your Android Device)


Disconnect cable from the device and launch scrcpy-noconsole

Now you can mirror your phone to your computer without any cable. Isn't it cool.

You can play games, watch OTT content from Apps that cannot be accessed on your computer, dial your contacts or receive calls, send and read SMS all without touching your mobile device or while it is charging in other room.


Reference:
https://developer.android.com/studio/command-line/adb#wireless
https://www.youtube.com/watch?v=vuTdxa-w1js

Tuesday, May 24, 2016

Enable Nested Virtualization in Hyper-V 2016 TP5

This is a short post on how to enable long awaited feature, Nested Virtualization in Hyper-V that is available in Windows 2016 Technical Preview 5 (TP5), which the competition VMware had for few years now.

 

Nested Virtualization is a feature that would allow us to enable Hyper-V inside the VM. This has many interesting use cases mainly labs and training. and even run other Hypervisors like VMware on top of Hyper-V.

 

To try this feature download latest Windows Server 2016 TP5 ISO from here

 

Install TP5 and enable Hyper-V role.

 

Create a new VM and install 2016 TP5 on the VM.

 

Now if you try to enable Hyper-V role, you would be presented with below error.

 

image

 

This is because Virtualization Extensions of Processor are not exposed to VM and so VM thinks Processor does not have Virtualization Capabilities.

 

First turn off the VM and run below command in PowerShell admin mode. Replace <VM’s Name> with name of VM in which you want to enable Hyper-V

 

Set-VMProcessor –VMName <VM's Name> -ExposeVirtualizationExtensions $true

 

image

 

Once the above PowerShell command finishes successfully you can start the VM and enable Hyper-V.

 

If you run the command without shutting down the VM you would see a error as below

 

image

 

If you like to check if Virtualization Extensions are exposed to the VM, you can run the below command.

 

ExposeVirtualizationExtensions will be True if enabled and False if not

 

Get-VMProcessor -VMName <VM's name> | FL *

 

image

 

Below is the graphical representation of Nested Virtualization.

 

image

Image Source – msdn.microsoft.com

 

Reference-

https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/user_guide/nesting

https://blogs.technet.microsoft.com/virtualization/2015/10/13/windows-insider-preview-nested-virtualization/

http://www.altaro.com/hyper-v/nested-virtualization-hyper-v-windows-server-2016/

 

Download Windows Server 2016 TP5 ISO (You would need Microsoft Live ID to download) - https://www.microsoft.com/en-in/evalcenter/evaluate-windows-server-technical-preview

Sunday, March 16, 2014

Raspberry PI and CherryMusic - Web Music Server

CherryMusic is a open source music streaming server that can play your personal music collection on almost any device with a web browser. It is written in python and is very light weight.

 

image

 

CherryMusic can be installed on Raspberry PI to create a personal web based music station that can be used on any device of our choice and be central repository of all the music you like.

 

So, below is the list of what we need to build our own personal music streaming server

1. Raspberry PI

2. PiBang Linux Server (Any Linux distro will do, I prefer Pi Bang based on Raspbian)

3. CherryMusic – Download it from here

 

Burn PiBang Server to SD card and boot your RPi.

 

Update Linux on RPI and install prerequisites for CherryMusic Server

apt-get update && apt-get -y upgrade && apt-get install -y imagemagick vorbis-tools lame flac python-mutagen

 

Use wget and download the latest CherryMusic Master branch from GitHub and unzip the master.zip

 

Make a folder on your RPi and upload your music collection. I have it on /music folder

mkdir /music

now cd to unzipped CherryMusic folder and run below command to setup CherryMusic

python cherrymusic --setup --port 8080

It will ask to download cherrypy, key in y and press enter to continue with installation

 

image

 

Now point your browser to http://rpi-ipaddress and you will be presented with the below setup screen.

 

Key in /music/ (or any other folder that has your music collection) in the Media base directory, leave the rest as defaults and click on Save Configuration and start CherryMusic

 

image

 

Wait for the Setup to complete, it would take few seconds

 

image

 

Once the setup is complete you will be greeted with the below login screen.

 

image

 

I have admin as default username and password. Login and enjoy your music on all your devices. You can even port forward or NAT your RPi and listen to your collection anywhere as long as you are connected to internet.

 

image

 

I was able to play music simultaneously on 4 different devices on my home wifi with no issue

1. Windows 8.1

2. Blackberry

3. Android

4. Acer Iconia Tablet

 

Reference-

1. http://www.fomori.org/cherrymusic/Setup%20Guide.html

2. https://github.com/devsnd/cherrymusic/tree/master

3. http://raspberrypihelp.net/tutorials/44-raspberry-pi-cherrymusic-music-streaming

Tuesday, August 14, 2012

Missing Windows Server 2012 Management Tools

If you have installed Windows Server 2012 Roles and Features using PowerShell or remote server admin tools or new multi server manager console, you will see that the management tools are missing from the server on which you just have enabled the role or feature. This is because Microsoft has provided more granular control on what is installed on the Windows Server 2012. As an administrator we have choice to include or not to include management tools while installing the Roles and Features we choose.

 

Below is a comic illustrating the same.

 

 

Source:

http://blogs.technet.com/b/servermanager/archive/2012/08/13/the-case-of-the-missing-role-and-feature-management-tools.aspx

 

Reference:

More on Installing Roles and Features here

Tuesday, October 25, 2011

Create Bootable USB to install Windows 7 or 8

There are many tools available on internet that help create a bootable USB/Flash drive to install Windows 7. But if you are running Windows 7 we can use built-in tools like diskpart to create a bootable USB drive without any third party tools.

All you need for this is a Windows 7 or 2008 R2 machine, a USB Flash drive with minimum of 4 GB capacity (Note that all data on this drive will be erased), Windows DVD and privilege to run command prompt in elevated mode.

Note:This post assumes you have only one physical hard disk on your machine and no other USB disks attached

First attach a USB flash drive to your system and if auto run kicks in close all related windows.

Fire up an elevated command prompt, invoke diskpart by typing diskpart at the command prompt and key in below commands one by one

list disk
select disk 1
clean
create partition primary
list partition
select partition 1
active
format quick
assign letter=m
exit
This finishes the USB disk preparation. Now key in the below command to copy the installation files of Windows 7/8/2008/2008R2/Server 8  to the above USB disk. Replace X: in below command with path to Windows installation files on hard drive or DVD drive on your machine

xcopy X:\*.* /s/e/f M:\

When the last command finishes, a bootable USB disk with Windows installation files is ready

Tuesday, October 04, 2011

Enable PING Response on Win 7 with Firewall ON

If you are a person managing or using systems running Windows Operating Systems, you would know that starting from Windows XP, Microsoft has provided built in firewall and is by default enabled blocking ICMP response to PING. Though blocking PING response is considered a security best practice when connected to network, it is a general practice by many SysAdmins to disable Windows Firewall whenever a system is built, leaving it vulnerable with all ports open.

Today we will see how to enable ICMP response on Windows machines without disabling firewall.

From Command Line
On Windows 7 and Windows 2008 R2 run the following command to enable ICMP response without disabling the firewall

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=yes

If you ever want to disable ICMP response run below command

netsh advfirewall firewall set rule name="File and Printer Sharing (Echo Request - ICMPv4-In)" new enable=no
Refer screenshot below for output from both the commands

image

Sunday, February 06, 2011

Get System Serial and Model from Command Line

Many times for some or the other reason we may need to look for serial number and model of the system. We generally do that turning our laptops upside down or by looking on CPU cabinet panels.

Well there’s a much easier way to look for them using command line. If you are running Windows just issue below commands in the command prompt.

      • For Serial Number
                •      wmic bios get serialnumber
      • For Manufacturer
      •      wmic csproduct get vendor

For Model
      •      wmic csproduct get name

image

The above commands make use of Windows Management Instrumentation (WMI)

If you use Linux, a tool called dmidecode comes to the rescue. Just issue below command in terminal with elevated privilege and you would get the necessary details

dmidecode –t system

Use sudo dmidecode –t system on Debian based Linux distros like Ubuntu

image

Use su dmidecode –t system on RPM based Linux distros like Fedora

image

dmidecode is available on most of the new distros by default. If it is not available on your system you can install it from the repository or get it from here to compile and install.

Sunday, December 12, 2010

Reset Lost Windows Password

At some point in time everyone who work with Windows would need to reset or clear password of built-in administrator as it was not accessed for long time or it was removed from Domain and no one remembers the password. Many would reinstall Windows in this situation not knowing how to crack the password. In this post we will see how to clear forgotten local administrator password on Windows using free Offline NT Password & Registry Editor.

Offline NT Password & Registry Editor is 4 MB CD based on Linux which contains things needed to reset the passwords on most Windows systems for free. The CD can also be installed on a USB drive and floppy disk as well by following the instructions on the site.

Download the latest version of Offline NT Password & Registry Editor from here. Burn a CD or create a USB or Floppy which ever is suitable for you and configure your system to boot from that device.

When the systems boots from Offline NT Password & Registry Editor the screen would look like the one below with a boot prompt.

NTPassword-1

Sunday, August 08, 2010

Use GImageX to work with .Wim OS Images

People who create and deploy Windows Vista and Windows 7 images know that .wim is now new native image format used by Microsoft for all its OSs. Microsoft has provided a command line tool called ImageX as part of WAIK short for Windows Automated Installation Kit to work with .wim images. ImageX being a command line tool, sometimes we tend to make mistakes while typing the commands and feel if it had a GUI to work with. Jon Bennett a MCS consultant has felt the same and built an app called GImageX – a GUI for ImageX using C++ and Microsoft’s WIMGAPI API (the wimgapi.dll file from the imagex directory of WAIK)

You can capture, apply, change, mount, delete, export and get info from .wim images using GImageX as you can with ImageX CLI. Below are the screenshots of ImageX CLI and GImageX

image

Saturday, January 30, 2010

30 Useful Windows Commands

If you are like me using Windows computer daily and keep moving your hand between keyboard and mouse, Run box in Windows Start menu can be used to speed up access to a whole variety of functions.

 

Here are 30 commands that are very useful for time saving while using Windows computer. These commands not only help you get the work done faster, but also more efficiently instead of clicking through tons of windows and options.

 

All these commands can also be used from good old command prompt or brand new PowerShell

 

1. Add or Remove Programs – appwiz.cpl

image