elevated-privileges

PowerShell - script 1 calls script 2 - how to return value from script 2 to script 1

好久不见. 提交于 2019-11-29 16:31:16
I have two PowerShell scripts. One script invokes another PowerShell script using elevated credentials, using Start-Process . But I am struggling with how to make the second script return the output value to the first script. Here is script # 1, which is invoked with script1.psl "sender-ip=10.10.10.10" function getUser($abc) { <#Previously created password file in C:\Script\cred.txt, read-host -assecurestring | convertfrom-securestring | out-file C:\Script\cred.txt#> $password = get-content C:\Script\cred.txt| convertto-securestring $credentials = new-object -typename System.Management

Forcing an application to Admin from config file

拥有回忆 提交于 2019-11-29 08:44:04
Is there a way I can add a setting in the configuration file so that that application will always start as admin? Thanks a lot. Not from the config file, but in the .manifest. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> http://blogs.msdn.com/b/nikhiln/archive/2007/04/19/embed-a-manifest-to-make

Silverlight 5 Trusted Mode. Accessing FileSystem and Local drives

你说的曾经没有我的故事 提交于 2019-11-29 08:07:27
Is there any way, any chance at all to access entire filesystem in SL app with elevated trust? That will work both in Windows and Mac? Through AutomationFactory , PInvoke or unmanaged code? I need an app that could read local drives, folders and files. UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :( Ok I have an idea about this. It is straightforward enough with Windows, to get the list of the local drives you can use

passing quoted arguments from batch file to `powershell start` - self-elevation on demand

假装没事ソ 提交于 2019-11-29 08:02:52
I am writing a Windows batch file that automatically escalates itself to administrative permissions, provided the user clicks "Yes" on the User Access Control dialog that appears. I am using a technique I learned here to detect whether we already have admin rights and another from here to escalate. When appropriate, the following script, let's call it foo.bat , re-launches itself via a powershell-mediated call to runas : @echo off net session >NUL 2>NUL if %ERRORLEVEL% NEQ 0 ( powershell start -wait -verb runas "%~dpfx0" -ArgumentList '%*' goto :eof ) echo Now we are running with admin rights

Start non-elevated process from elevated process [duplicate]

房东的猫 提交于 2019-11-28 12:16:07
Possible Duplicate: How to run NOT elevated in Vista (.NET) How do you de-elevate privileges for a child process My program running as an elevated process, and starting new processes with Process.Start() . For security reasons, I would like to run those new processes as non-elevated. How to do that? Michael Goldshteyn Take a look at: How to run NOT elevated in Vista (.NET) The answer is presented at that URL. Also, you may want to read http://go.microsoft.com/fwlink/?LinkId=81232 for why this is not such a good idea... 来源: https://stackoverflow.com/questions/3927790/start-non-elevated-process

How to prevent uninstaller elevating for Standard Windows 10 user?

和自甴很熟 提交于 2019-11-28 11:14:14
We have an x86 Win32 desktop application. When the installer is run by a Standard (non-Admin) user, we avoid elevating and/or showing a UAC prompt and install under C:\Users\username\AppData\Roaming\... instead of the common Program Files directory. On Windows 10, when our uninstaller is launched from Control Panel -> Programs -> Programs and Features , no UAC prompt is shown and the uninstaller runs without elevating. This is the desired behaviour. When the same uninstaller is launched from Start -> Settings -> System -> Apps & features , a UAC prompt is shown. (The same behaviour can be seen

Batch file: Drop elevated privileges (run a command as original user)

痞子三分冷 提交于 2019-11-28 10:02:55
I have a batch file that starts with elevated privileges (my installer spawns it), but at a certain point I need to run a command as the original user who started my installer (i.e. drop from the elevated privileges). Is it possible to do so? You can run a command with restricted privileges with: runas /trustlevel:0x20000 "YourCommandHere" You should provide the absolute path to your command including any arguments in double quotes as an argument to runas . If you would like to run more than one command with restricted privileges, you can put them in a separate batch file and run it with:

Forcing an application to Admin from config file

喜你入骨 提交于 2019-11-28 01:54:12
问题 Is there a way I can add a setting in the configuration file so that that application will always start as admin? Thanks a lot. 回答1: Not from the config file, but in the .manifest. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> <

Silverlight 5 Trusted Mode. Accessing FileSystem and Local drives

时间秒杀一切 提交于 2019-11-28 01:52:26
问题 Is there any way, any chance at all to access entire filesystem in SL app with elevated trust? That will work both in Windows and Mac? Through AutomationFactory , PInvoke or unmanaged code? I need an app that could read local drives, folders and files. UDP: Ok, seems it's possible to read folders and files using classes of System.IO from mscorlib. Although you still can't get information about local mounted drives. There is no DriveInfo in Silverlight's mscorlib :( 回答1: Ok I have an idea

How do I get WiX installer to request administrative privileges?

a 夏天 提交于 2019-11-27 19:25:12
We have a program we have developed in house. We are upgrading to use Visual Studio 2012, and so have to leave the Visual Studio installer project behind. InstallShield LE was giving us problems with shortcuts if the application was already installed. This left me with finally going with WiX. I have researched this for a few days and read several posts on how to get administrator rights, but none of them seem to work. The Package element has InstallPrivileges="1" and the following Property element is present: <Property Id="MSIUSEREALADMINDETECTION" Value="1" /> It will not request