Run a batch file with Admin previlige - sharepoint

I have a sharepoint feature installer packaged as a batch file. The users should be able to run the .bat file and install the feature themselves in their environment with the admin previliges. Is there any command i can include in my .bat file to run it with elevated previliges?

runas provides this functionality.

One other approach is to compile the bat file to exe. Using a utility such as http://www.bdargo.com/ you can add an "Manifest Token" which will prompt the user to allow it to run with elevated privileges.
Note: I'm not affiliated with that company.

Related

How run command in CMD with administrator privileges in NSIS?

How to run command in CMD with administrator privileges after user clicks install on NSIS? I use Zip2Exe.
Am I mistaken in thinking that installers ask for these permissions anyway?
Either way it looks like you may be out of luck you might have to use makensis instead.
https://nsis.sourceforge.io/mediawiki/index.php?title=Zip2Exe&oldid=4446
It only allows you to set some very basic installer options like the
name, directory and compression method. It's not possible to add a
license, sections, script code etc.

How to get write permission to a /var/lib folder for app installed as a distiubutable package

I'm creating a mono app and I've build up a *.deb installer.
In windows I write quite a bit of configuration information into the program data directory. The linux corollary seems to be /var/lib/[appname]. I've figured out how to create the directories as part of the install package, but when the app goes to run I get an excpetion because the app doesn't have write permission.
How do I get my app to have write permission to the /var/lib/[appname] folder? Is that the correct place to put things like a local db for an app?
It seems the only way to do this is via the postinst script file.
You can use that hook to execute a script to chmod the directories to anything you want. You can find the complete documentation for the postinst file here: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#maintscripts

Microsoft signtool removes administrative privileges?

I need to sign an installer executable for Windows using a p12 file.
Before signing, this EXE file icon has a "shield icon" on it indicating that it requires administrative privileges, as it should.
However, after I sign using the signtool and the following command:
signtool.exe sign /f mycert.pfx /p <password> /t http://timestamp.verisign.com/scripts/timstamp.dll /v "<file to be signed>"
the signing succeeds but the shield icon disappears. When I run the resulting executable, it fails because it is no longer running under administrative privileges.
What do I need to do in order to sign an executable and have it keep its administrative privileges?
You should set the requestedExecutionLevel to requireAdministrator in your app's manifest to declare it as needing administrative privileges.
I suspect that your app is named "install" or similar, and so the non signed-and-manifested version picked up the administrator requirement as part of backwards compatibility settings, but now it looks like a current application and so Windows checks to see which privileges it requests, and since it doesn't request any the app doesn't get elevated.
See Create and Embed an Application Manifest with Your Application
Depending on how the app is created also look at /MANIFESTUAC (Embeds UAC information in manifest) and /win32manifest (C# Compiler Options)

Installshield Silent Install Log

I've been given a silent install from a 3rd party (made with Installshield) I need to include as part of the project I am working on at the moment.
I've got it all working right up until I burn it to a DVD and attempt the install.
Installshield in silent install mode writes a log file to the same directory as setup.exe. Being on a DVD this is a read only folder.
I see I can change the default location of the log file using a command line switch, but is there a way to make it not create one at all?
I struck the same problem. I tried:
Setup.exe /s /f2null
And I couldn't find a log file anywhere afterwards...
For each setup.exe that build by installsheild, you can use f2"logpath" parameter to specify the log file in your own script.
If 3rd party "setup.exe" creates a log automatically - the easiest solution it redirect this log to %temp% directory.

How to create log file for a launched setup.exe

I have inherited some InstallShield InstallScript projects.
I am currently using InstallShield 2009.
I cannot seem to create a log file when I run the setup.exe.
What command line options do I need to specify?
InstallShield has a method for creating a log file for the Setup.exe and Update.exe bootstrappers. You can simply use the /debuglog parameter from the command line when you run Setup.exe. This command line parameter can be used with the Setup launcher for Basic MSI, InstallScript MSI, and Web projects.
Here it is:
Setup.exe /debuglog
You will notice that a file called InstallShield.log has been created in the same folder as Setup.exe.
For more read >> http://www.installationdeveloper.com/686/using-log-files-in-installshield/
There is no such feature in InstallScript project types. The really good logging is in MSI project types. InstallScript really only has the ability to record a response file and generate a very terse logfile as part of a silent install. (/s /f1 /f2 arguments)
Setup.exe Command-Line Parameters
You can add registry settings which will tell Windows Installer to log your installation.
The registry settings you'll need are:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer]
"Logging"="voicewarmup"
"Debug"=dword:00000007
Once you run the installation, navigate to %temp% inside windows explorer and there will be .LOG files with a naming scheme of MSI#####.LOG.
NOTE: This should log all installations on your machine, so you may want to delete these registry settings when you're done.

Resources