Jump to content

calling pwsh from Linux shell script not working


DAGSP

Recommended Posts

Hi, so am trying to call a powershell script from shell but just seems to do nothing. Anyone got pwsh running from a global game script?

I have a global game script that runs 'after created' and does all the normal shell stuff, but if i try to call/run pwsh it seems to do nothing.


example script:

pwsh makefile.ps1

pwd > pwd.txt

 

the pwd.txt gets created ok so the shell is running but the powershell script does nothing. doesn't seem to error or anything either. all modules are installed and in my testing i am calling base cmdlets. the script runs fine in interactive console. I have tried with shebang in the ps1 script, i have tried with shebang in the tcadmin shell script... but nada..

Any ideas?
 

Link to comment
Share on other sites

Hey, cheers for the reply 😄 

The MakeFile.ps1 was creating a file to prove it worked. something like "New-Item -ItemType File -Name psfile.txt" - essentially doing the same as the pwd but via PoSH.

I worked it out though. Whilst I thought the PS modules were being loaded, they weren't importing during the script and needed to use literal path for the script to find the module...

i.e. "import-module <module name>" worked fine when running the script in interactive console. for it to work as task from TCA it needed full path "Import-Module /root/.local/share/powershell/Modules/<module"

So I think I just need to fine tune my PS profiles so the modules are loaded on start. It's 3:30am here so I'm probably doing more damage than good at the moment.

But for now the script is running passing TCA variables to the PoSH script and doing it's thing.

Cheers 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 23 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use