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

I recently discovered that all my powershell deployed commands are not working under Scanning Credentials deployment. It was working as expected a few months ago. I'll state what I went through and as much info as I can:

1. The script works fine on it's own.
2. The deployment works fine when deployed with Currently logged on.
3. Scanning credential is working fine and is local administrator.
4. Share credential is working fine. Other packages are deployed as usual.
5. I see the Lansweeper deployment .exe for a brief moment in the task manager on target computer.
6. I restarted the Lansweeper server.
7. I tried on a computer without AV installed.
8. Deployed on Win 10 1909 and Win 10 20H2.

I ran the commands as the scanning credential account and it worked fine. I managed to track down registry keys for the scheduled task and everything is fine.

I ended up running a simple script that appends text to a .txt file on the share where packages are usually stored. Here it is:

Set-ExecutionPolicy -ExecutionPolicy Bypass
$Env:Computername | Out-File -Append "\\fileserver\tech\Distribution\PS\test.txt"


Here are the package steps:

Action
Command
Step Name
PS test
Command
powershell.exe -ExecutionPolicy Bypass -file "{PackageShare}\Distribution\PS\test.ps1"

Success Codes
0,1641,3010
Action on Success
Stop (Success)
Action on Failure
Stop (Failure)



Versions:
Website Version: 8.2.210.4
Server: 8.2.210.4


Does anyone have an idea of what might be going on?
Thanks!
1 ACCEPTED SOLUTION
roysam
Engaged Sweeper II
Here's my solution/workaround:

Action
Command
Step Name
PS test
Command
cmd.exe /c "\\fileserver\tech\distribution\PS\test.bat"

Success Codes
0,1641,3010
Action on Success
Stop (Success)
Action on Failure
Stop (Failure)

This batch file then runs the powershell script:
powershell.exe -ExecutionPolicy Bypass -file "\\fileserver\tech\Distribution\PS\test.ps1"

It works...

If anybody has a clear explanation of why it's behaving this way, I'd be interested.

View solution in original post

1 REPLY 1
roysam
Engaged Sweeper II
Here's my solution/workaround:

Action
Command
Step Name
PS test
Command
cmd.exe /c "\\fileserver\tech\distribution\PS\test.bat"

Success Codes
0,1641,3010
Action on Success
Stop (Success)
Action on Failure
Stop (Failure)

This batch file then runs the powershell script:
powershell.exe -ExecutionPolicy Bypass -file "\\fileserver\tech\Distribution\PS\test.ps1"

It works...

If anybody has a clear explanation of why it's behaving this way, I'd be interested.