Welcome PowerShell Enthusiasts, Android tinkerers and fellow Geeks!
This is a step by step guide on how I managed to run PowerShell on my Android device.
Quick disclaimer:
All information and files — both in source and compiled form — are provided on an as is basis. No guarantees or warranties are given or implied. The user assumes all risks of any damages that may occur, including but not limited to loss of data, damages to hardware, or loss of business profits. Please use at your own risk. Note that unless explicitly allowed by the warranty covering your device, it should be assumed that any warranty accompanying your device will be voided if you tamper with either the system software or the hardware.
In this guide I've used the following Device and Android Version:
Oneplus 5 - Android Pie 9.0
OK, Lets get to it !
- Download UserLAnd from the play store Link
- Run UserLAnd when opening the app for the first time you will need to select a distribution pick Arch (I picked arch over Ubuntu because I had many stability issues with Ubuntu it caused my phone to lag and freeze).
- After picking the distribution you will need to enter a username, password and a VNC password and press continue.
- Pick SSH on the connection type screen and press continue.
- UserLAnd will fetch the arch distribution and set it up for you once the setup is complete go to sessions and pick arch from the list
- Enter the password you picked in step 3
- Once we are logged into the arch we will need to preform a few steps lets start by updating all the packages by running the following code ```
sudo pacman -Syu
when you see a list of packages and are prompted to proceed with the installation press y
This process will take a bit of time depending on your internet connection speed and the processor of your device, you might see some errors during the update process its normal and can be ignored
<img src='https://thepracticaldev.s3.amazonaws.com/i/6zp9q0r6xdt9mt8h6q3z.jpg' width=400>
8. Once the upgrade completed we need to install wget and libuv
```
sudo pacman -S wget libuv
- Lets make a folder for PowerShell and download the PowerShell 7 preview 3 to it ```
mkdir powershell
cd powershell
#If your android device has an arm64 CPU download the arm64 package by running the below line
#If your android device has an arm32 CPU download the arm32 package by running the below line
<img src='https://thepracticaldev.s3.amazonaws.com/i/2h5d07yvbt1mqkh7cdw8.jpg' width=400>
10. Once the powershell tar.gz file downloads we need to extract it
```
tar xzvf powershell*.tar.gz
<img src='https://thepracticaldev.s3.amazonaws.com/i/86ms6mvewhbed0y2qkzs.jpg' width=400>
-
Lets run PowerShell !!!
./pwsh
<img src='https://thepracticaldev.s3.amazonaws.com/i/xhuiga6p6c7yp3vvuem4.jpg' width=400>
There we have it folks we have PowerShell running on Android.
Now for the fun of it lets install the UniversalDashboard.Community by Adam Driscoll from [IronmanSoftware](https://ironmansoftware.com/universal-dashboard-2-4-release/) Module and run it.
Find-Module UniversalDashboard.Community | Install-Module -AcceptLicence
Import-Module UniversalDashboard.Community
Start-UDDashboard -Port 10001
It's running the UniversalDashboard locally on the phone rendering pages, graphs and everything else you can think of on PowerShell.
<img src='https://thepracticaldev.s3.amazonaws.com/i/jatd7r2gtq88ht41gsml.jpg' width=400>
<img src='https://thepracticaldev.s3.amazonaws.com/i/nm6zobxz0a3n4im4t98c.jpg' width=400>
<img src='https://thepracticaldev.s3.amazonaws.com/i/gtkvswqb28qoez5pgrc3.jpg' width=400>
Thank you for reading my guide !
Feel free to comment and ask questions.
You can find more of me on twitter [PowershellOnLinux](https://www.twitter.com/@Posh4Linux)
Also you can join the [PowerShellOnLinux Telegram Group](https://t.me/PowershellOnLinux)
-TheMentor
Top comments (14)
I followed the instructions, tough things didn't look quite the same (e.g., no login required, in step 4 choice was between graphical and terminal). I chose terminal becasue I am trying this on an eink tablet.
I downloaded and expanded the 7.3.0 version of PowerShell. Had to chmod +x.
But when running ./pwsh all I get is "Failed to create CoreCLR, HRESULT: 0x8007000E".
Any ideas?
Update: I decided to try again with PowerPoint 7.0. So I rm -r-ed the powershell directory and downloaded this version from powershell 7.0.13 on github and proceeded with that. This works, which is good enough for me: I mostly want it for some experiments with powershell while reading some deep-dive poershell books on my tablet.
It was upgrading the packages and when I "tabbed" back, it was asking for the password again, but I cannot login. Since there was no confirmation that first time, I am not sure if I typed the VNC and user password differently, although I tried to watch the shown letter. Either way, I logged in to update and now I can't. How can I solve this?
Apparently, a dependency broke. That was the real issue. The other was because multiple instance sessions were trying to be opened every time I clicked on the main menu's app.
error while loading shared libraries: libgpgme.so.11: cannot open shared object file: No such file or directory
So I installed it all again from scratch. Now I would like to run a PS1 file, but the FS is hidden from view. Hmm
Final issue:
I ran
wget
with the target URL but got an error list:Any idea how too get it to work?
Program to use:
github.com/CelianB/ChesscomPgnExpo...
Beautiful!
Thank you very much!
As a Powershell fan, this is just fantastic. Just tried all your instructions on my Oneplus 6 and works perfect! Much appreciated, thank you!
I'm happy you liked it and that it worked on your oneplus6
Thats awesome!! Will try, thanks for the inspiration
Definitely give it a shot it's a lot of fun.
If you need any help let me know!
crazy idea love it ;)
Hi, Im just a noob trying to run a powershell script on android. I'm unable to run or locate the right path to my file and showing me the error as in the image. Can anyone help?
I'm getting problems when running powershell (./pwsh)
"No usable version of libssl was found..aborted"
I feel I have done according to the steps above
I want to know how to use python code with android powershell