Notification

Icon
Error

Deploying PowerShell script

Posted: Thursday, October 31, 2019 11:56:08 PM(UTC)
Lewis_Spokane

Lewis_Spokane

Member Original PosterPosts: 14
0
Like
This issue has been solved! Click here to view the solution
I have a PowerShell script to install a piece of software. If put the .ps1 file in the scripts folder of the {PackageShare} what do i do with all the files that script is going to call on?

Do I put the entire package in the scripts folder?
CyberCitizen
#1CyberCitizen Member Posts: 440  
posted: 11/1/2019 2:20:12 AM(UTC)
It depends, but the script needs to know where to get those files from so if the script is hardcoded to a UNC path (file share) then it needs to stay in that location, however the users need access.

If it looks to the directy the script is running from then it needs to be in the same directory.
Lewis_Spokane
#2Lewis_Spokane Member Original PosterPosts: 14  
posted: 11/1/2019 6:41:25 PM(UTC)
Thank you, that is helpful.

What I have only seems to work when I run it from Administrative prompt (cmd or powershell), how do I indicate to the deployment package that it should open an elevated session?
CyberCitizen
#3CyberCitizen Member Posts: 440  
posted: 11/3/2019 11:54:40 PM(UTC)
Use the scanning credentials for elevated prompt.

System can work, however my previous experience with SYSTEM is that it can't connect to network paths / shares.
CyberCitizen
#4CyberCitizen Member Posts: 440  
posted: 11/3/2019 11:55:45 PM(UTC)
Note you might also need to do something like this (executionpolicy bypass) to allow the script to actually run.

powershell.exe -executionpolicy bypass -file "{PackageShare}\CleanUpMGRScript.ps1"
Esben.D
#5Esben.D Member Administration Posts: 2,055  
posted: 11/4/2019 4:15:20 PM(UTC)
Every time I've done it I've always used what Cyber mentioned. It is also mentioned in this old thread: https://www.lansweeper.c...-Deployment-Package.aspx
FreddieIT
#6FreddieIT Member Posts: 1  
posted: 8/3/2021 10:57:34 AM(UTC)
You could try this;

powershell -noprofile -command "&{ start-process powershell -ArgumentList '-noprofile -file C:\Temp\powershellscript.ps1' -verb RunAs}"

Active Discussions

Lansweeper Scan User Exclusion / Define User OU for active scanning
by  Almada   Go to last post Go to first unread
Last post: Yesterday at 6:43:34 PM(UTC)
Lansweeper sqlServerId is changing
by  Ciro Bizelli  
Go to last post Go to first unread
Last post: Yesterday at 3:40:34 PM(UTC)
Lansweeper Slow Loading Lansweeper
by  Maikel Vanroelen   Go to last post Go to first unread
Last post: Yesterday at 9:25:31 AM(UTC)
Lansweeper Sync information
by  Jay-IT  
Go to last post Go to first unread
Last post: 9/16/2021 9:20:11 PM(UTC)
Lansweeper "Unknown" exclusion does not exclude Unknown assets
by  Almada   Go to last post Go to first unread
Last post: 9/16/2021 7:18:43 PM(UTC)
Lansweeper multiple scanning servers with granular permission
by  FrankSc  
Go to last post Go to first unread
Last post: 9/16/2021 6:29:54 PM(UTC)
Lansweeper Separate helpdesk websites?
by  JCochran   Go to last post Go to first unread
Last post: 9/15/2021 2:51:03 PM(UTC)
Lansweeper Remove Ads
by  FrankSc  
Go to last post Go to first unread
Last post: 9/15/2021 12:30:18 PM(UTC)