Page 1 of 1

PowerShell

Posted: 26 May 2021, 06:45
by RadicalDave
PowerShell has a had a cross-platform, open source version for awhile. Can we get it deployable?

Re: PowerShell

Posted: 26 May 2021, 06:53
by outkastm
which platform is your NAS ? x64 or arm ?

Re: PowerShell

Posted: 10 Jun 2021, 12:26
by RadicalDave
I'm on F4-422 - with Intel Celeron CPU J3455

Re: PowerShell

Posted: 29 Jun 2021, 00:16
by djonesuk
Hi

I was able to get PowerShell installed by following the instructions in the Microsoft docs under Installation - Binary Archives.

You first have to install Curl for your architecture from https://github.com/moparisthebest/static-curl - I moved it to /usr/local/bin/curl and made it executable.

Code: Select all

sudo mv curl-amd64 /usr/local/bin/curl
sudo chmod +x /usr/local/bin/curl
Then I ran the commands from the docs:

Code: Select all

# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.1.3/powershell-7.1.3-linux-x64.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/7

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7

# Set execute permissions
sudo chmod +x /opt/microsoft/powershell/7/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
Then type pwsh to run PowerShell.

Code: Select all

[admin@TNAS ~]$ pwsh
PowerShell 7.1.3
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/admin> get-process | sort-object CPU -descending | select -first 10

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
      0     0.00       0.00  15,111.31    6550   0 md1_raid5
      0     0.00       0.00   3,220.34    6580   0 md1_resync
      0     0.00       0.00   1,611.27     933   0 kswapd0
      0     0.00      30.57   1,315.79   32365 …55 smbd
      0     0.00      47.78   1,052.33   14022 …63 Plex Media Server
      0     0.00       0.00     664.34    1853   0 kworker/1:1H-kblockd
      0     0.00       0.00     648.47    1843   0 kworker/0:1H-kblockd
      0     0.00       0.00     408.11      10   0 rcu_sched
      0     0.00       0.13     307.26    4467 …66 syscontrol
      0     0.00      46.12     196.98   20695 …63 Plex Script Hos
Hope that helps!