This topic contains 4 replies, has 3 voices, and was last updated by
June 24, 2018 at 6:48 pm #103153
I have created a useful script (PS 5.1 ISE) that will save my "enduser" about 6 steps in the production environment.
The steps are simple: export file from ACCESS to Excel (csv), convert, copy, merge and save final results to Excel .xlsx format.
I developed and tested the script in the PS (5.1) ISE environment. I now wonder what it would be like to "set it up" for my target user environment in the "least involved" (or "user firnedly") manner.
1 – Should I expect the user to run PS ISE Admin, open the PS1 file and then run it?
2 – Or is there a "friendlier way" — which in my view would be to simply ask the user to double-click the PS1 file (I tried this and it fails, perhaps because the enduser's environment isn't "hosted properly" to run my script;
3 – Or can I ask the user to Run As Administrator [cmd.exe] from Windows Start, get into the traditional DOS prompt and then invoke the PS1 file? (I haven't tried this for fear it might mess things up on the production PC).
Would be grateful for any advice, tips or suggestions.
June 24, 2018 at 7:44 pm #103159KeymasterPoints: 1Rank: Member
Double clicking doesn't work by design; it's a security feature.
If you use SAPIEN editors, I know they can package a script into an EXE. Easy double click. You can also apply alternate credentials. It's probably my preferred way to achieve what you're after.
June 24, 2018 at 11:05 pm #103195
Many thanks Mr Jones, much appreciated.
June 24, 2018 at 10:51 pm #103192ParticipantPoints: 15Rank: Member
If you users are not admins on the box, then your first bullet is moot, which lends to DonJ's comment regarding alternate creds as well.
.Ps1 files are only seen as text files on the system by default, for the reason DonJ points out. Sure, you could reassign all .ps1 extenuation to powershell.exe, but don't, it will become and issue for you long term from a risk management (security) perspective.
You could send the script with a shortcut to the user, then double-clicking the shortcut, if properly configured (using the runas setup) would execute the script. Yet, again, if you are installing , stuff, that requires admin, and the user is not and admin, then you have an issue anyway.
You could use GPO and make it a run once thing on logon.
Yep, Sapien, PSS is a good tool, been using it for years now, but you can create PS .exe without it, especially if you are strapped for cash yourself, or your company is unwilling to pay the annual subscription for it.
Use the MS powershellgallery.com tools or stuff on TechNet.
PS2EXE-GUI: "Convert" PowerShell Scripts to EXE Files with GUI
Overworking of the great script of Ingo Karstein with GUI support. The GUI output and input is activated with one switch, real windows executables are generated. With Powershell 5.x support.
Create-EXEFrom.ps1: Create EXE from PowerShell script (with supplementary files)
Takes one PowerShell script and any number of supplementary files or even a directory and creates an exe using Windows's built in iexpress program. The exe will run on any machine with PowerShell 2.0+.
Wrap your PowerShell scripts as Executables
In order to do this I am leveraging the awesome capabilities of PowerShell, allowing me to locate the compiler at runtime and compiling my wrapper code into an executable. So let's examine this step by step.
PowerShell Executable Generator
See this discussion on the .exe thing as well. Just so you know.
June 24, 2018 at 11:16 pm #103198
Thank you very much, your inputs are very helpful.
The topic ‘Running Powerscript in the "enduser" environment’ is closed to new replies.