Run a PowerShell script in Replit

Hi,

I am trying to run my own PowerShell scripts in replit interface. What do I need to do t get this running. Every time I run my script it says the file main.ps1 is missing. I have created a new file called main.ps1 and copied my PowerShell code to that file and run it. It still comes back saying main.ps1 is missing. Any suggestion is highly appreciated.

1 Like

Welcome, @somenathghosh1!

By curiosity, did you use the Powershell Template? It is much easier to set up a blank Repl. First, create a blank Repl, then install “pash”, and finally run your Powershell script through pash file.ps1.

Screenshot 2023-05-13 11.45.06 AM

After installing, the file should run.

Screenshot 2023-05-13 11.46.48 AM

Also, by configuring the .replit run command, you can simply use the run button like so:

Hope this solves your problem.

2 Likes

Thank you @bobastley for the quick response. I used the Powershell template. The background is I am trying to manage O365 and Azure via the PowerShell template inside Replit. Taking your suggesstion I have got around to running main.ps1 from Nix. However how do I get around installing powershell modules for azure and O365 in order run my scripts to connect to a tenant and manage it. Is that possible ?

2 Likes

It would be the same as if you would be doing it in a normal linux command line, so maybe do some research on that.

2 Likes

Hi, sorry for the late response.

I’d assume you’d install it the same way you did before, or do some research like @MiloCat suggested.

2 Likes