Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Scripts » How to setup PowerShell on a Linux server
  • Retrict access to external storage
    Restrict access to removable Storage Drives [Part 2] Windows
  • Header picture 1
    Find BIOS Serial Number and System Information on Windows 11 Windows
  • https   blogs images.forbes.com jasonevangelho files 2018 06 windows 7 2018 edition 1200x676 1
    Windows deployment cannot continue, the operating system is missing via MDT deployment Windows Server
  • dfeef
    How to automatically resolve errors associated with failed dependencies Linux
  • Microaoft Edge
    Bing AI-Powered Copilot: How to install Microsoft Edge on macOS Network | Monitoring
  • mssql
    Fix MSSQL Connection timeout and timeout period expired Oracle/MSSQL/MySQL
  • TrueCrypt to BitLocker
    How to Migrate from TrueCrypt to BitLocker Backup
  • Pluggin cable
    System check found some issues during MBAM encryption: Fail, the Power cable must be connected Windows

How to setup PowerShell on a Linux server

Posted on 24/11/202009/09/2023 Christian By Christian No Comments on How to setup PowerShell on a Linux server
setup PowerShell

As we know, PowerShell is a cross-platform task automation and configuration management framework from Microsoft built on top of the .NET Common Language Runtime; it accepts and returns .NET objects. It consists of a command line shell and an associated scripted language. Powershell enables management of both local and remote linux machines

INSTALLING POWERSHELL ON CENTOS.
-Since the PowerShell package is not included in the official CentOS repository, first thing to do in the installation process is to add the repository with the following command;

curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
Linux server

After adding the repo, use the yum makecache to update the repository cache

PowerShell installation

Now install the powershell with yum install powershell

PowerShell installation
Linux PowerShell

Along the line, the installation guide may ask you to accept the gpg key. Type y to continue the installation.

setup PowerShell

Here are a few commands you can run to check if the installation is well set up;

pwsh –v

this will tell you the version of powershell  you have just installed.

Linux server
pwsh

This will take you to the powershell terminal and you will be ready to run powershell commands

Similarly, you can run Linux commands from the powershell terminal.

MAKING YOUR LOGIN POWERSHELL
– Run the whoami command to find the path of the pwsh shell program. Use that result of the command to set the default login shell to that of the powershell with the following command;

usermod –s /usr/bin/pwsh $(whoami)

Now reboot your machine and that is all that is needed to have PowerShell up and running.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session. I welcome you to follow me on Twitter and Facebook.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Scripts Tags:PowerShell, PowerShell version 7, Ubuntu

Post navigation

Previous Post: Restore AD Objects: How to restore deleted user accounts in Active Directory with Microsoft LDP and PowerShell
Next Post: How to delete obsolete drivers from the Driver Store in Windows

Related Posts

  • Featured image batch file.
    Retrieve Recent Windows Update: How to create batch script files Scripts
  • powershell01 1
    Create a self-signed certificate and export it in PFX format via PowerShell [Part 1] Scripts
  • windows 10 hert
    Windows Management Instrumentation Commands Scripts
  • windows update 03
    How to automate Windows Update with PowerShell Scripts
  • powershell commands lede 1024x276 1
    PowerShell Remoting: Guide to Windows Management Instrumentation Scripts
  • powershell logo
    Cannot find the computer: Fix the following error occurred while using Kerberos authentication Scripts

More Related Articles

Featured image batch file. Retrieve Recent Windows Update: How to create batch script files Scripts
powershell01 1 Create a self-signed certificate and export it in PFX format via PowerShell [Part 1] Scripts
windows 10 hert Windows Management Instrumentation Commands Scripts
windows update 03 How to automate Windows Update with PowerShell Scripts
powershell commands lede 1024x276 1 PowerShell Remoting: Guide to Windows Management Instrumentation Scripts
powershell logo Cannot find the computer: Fix the following error occurred while using Kerberos authentication Scripts

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a
 
  • Retrict access to external storage
    Restrict access to removable Storage Drives [Part 2] Windows
  • Header picture 1
    Find BIOS Serial Number and System Information on Windows 11 Windows
  • https   blogs images.forbes.com jasonevangelho files 2018 06 windows 7 2018 edition 1200x676 1
    Windows deployment cannot continue, the operating system is missing via MDT deployment Windows Server
  • dfeef
    How to automatically resolve errors associated with failed dependencies Linux
  • Microaoft Edge
    Bing AI-Powered Copilot: How to install Microsoft Edge on macOS Network | Monitoring
  • mssql
    Fix MSSQL Connection timeout and timeout period expired Oracle/MSSQL/MySQL
  • TrueCrypt to BitLocker
    How to Migrate from TrueCrypt to BitLocker Backup
  • Pluggin cable
    System check found some issues during MBAM encryption: Fail, the Power cable must be connected Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,840 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.