‎08-19-2024 10:59 PM - edited ‎08-19-2024 11:01 PM
I've been trying to get a deployment package working that executes a powershell script on a host computer. My current command looks as follows:
powershell.exe -executionpolicy bypass -file "\\lansweeper01\DefaultPackageShare$\Scripts\MyScript.ps1"
When I run this command on the host machine on a non-elevated command line it executes fine, but I get the following error when attempting to run it through scanning credentials deployment.
Result: Deployment ended: Incorrect function.. Stop(Failure).
I've attempted the other solutions on similar forums without any success. Any recommendations would be appreciated.
‎09-11-2024 11:16 PM
Hello - I've been having a similar problem that I've been working on with support. We were on 11.1.x and I had problems with two powershell scripts on domain controllers, that worked everywhere else fine and worked if I ran them on the servers in the context of our Lansweeper scan account. We upgraded to the last two 11.4 releases and the scripts stopped working on all of the servers and workstations. It would say they ran, but did not.
The issue was the last command in the script was a copy-item command to take the results from the computer and put them back into the import folder in the path of the Lansweeper application. Based on other comments in this thread, I tested the same thing and had it copy to c:\temp and it worked, but only if I took the command out of the script and made it another step in my deployment package.
Today, I made a fresh folder on the Lansweeper server and shared that, then keeping the copy command out of the script and a step in the deployment package I'm able to achieve my goal again (and the domain controllers are working). I hope this is helpful to others working on the same issues.
‎08-20-2024 03:00 PM
Is there any information you can provide as to what this lansweeper error means? It doesn't provide much information to work with.
‎08-28-2024 11:19 PM
We don't have specific information on the error other than there was an incorrect function and you will have to look at the deployment package.
‎08-19-2024 11:08 PM
Hi Zach,
Since the deployment module allows you to execute any non-Lansweeper-specific command towards a non-Lansweeper-specific environment, we, unfortunately, cannot provide in-depth support for creating or troubleshooting custom deployment packages.
More information on our deployment module can be found in this section of our knowledge base: https://www.lansweeper.com/kb-category/deploying-software-and-other-changes/
Keep in mind that all that Lansweeper does in this situation is execute the commands you've sent, towards the computers you've targeted, using the credentials you've specified. Lansweeper does the following:
• Uses your scanning credentials to write the deployment executable on the target computer
• Uses your scanning credentials to write the deployment package details into the registry
• Uses your scanning credentials to create a scheduled task that executes the deployment command in CMD
The scheduled task runs with your "Run Mode" user (Local System, current user or scanning credentials)
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now