→ The Lansweeper Customer Excellence Awards 2024 - Submit Your Project Now! Learn More & Enter Here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
imccarthy
Engaged Sweeper II

Hi Folks,

I am trying to launch the below command from the basic actions menu for an asset but the PowerShell window displays and then closes with no output

I have the command working from a normal PowerShell window on the Lansweeper server.

The two commands I have tried are below:
powershell.exe Enter-PSSession -ComputerName {computer}
powershell.exe set-executionpolicy bypass Enter-PSSession -ComputerName {computer}

Any ideas what I am doing wrong?

1 ACCEPTED SOLUTION
steveb
Champion Sweeper
I got it to work. Try adding the -noexit parameter.

powershell.exe -noexit Enter-PSSession -ComputerName {smartname}

For anyone else, here is the how to I followed for enabling remote powershell sessions if you don't already have it setup.

remote powershell enable

View solution in original post

3 REPLIES 3
steveb
Champion Sweeper
I got it to work. Try adding the -noexit parameter.

powershell.exe -noexit Enter-PSSession -ComputerName {smartname}

For anyone else, here is the how to I followed for enabling remote powershell sessions if you don't already have it setup.

remote powershell enable
imccarthy
Engaged Sweeper II
steveb wrote:
I got it to work. Try adding the -noexit parameter.

powershell.exe -noexit Enter-PSSession -ComputerName {smartname}

For anyone else, here is the how to I followed for enabling remote powershell sessions if you don't already have it setup.

remote powershell enable


Thanks for that Steve, it worked perfectly.
steveb
Champion Sweeper
Its not exactly what you want but it does work via psexec.

{actionpath}psexec.exe /accepteula \\{smartname} powershell.exe

I cannot get it to work the same way you were trying it either.