Run AHK script as admin on startup - admin

I have four AHK scripts which run on startup, as they have shortcuts placed in my startup folder. How can I make them run as admin?
What I've tried:
I've tried changing their properties to be run as admin, but they just don't run (when I do that).
I've tried changing their shortcuts' properties to be run as admin, but they too just don't run (when I do that).
I've looked at this reddit post on the topic, but I don't know how to implement that code in the scripts.
I've tried creating a basic C++ application which runs them with system("start path\\to\\script"), but it wouldn't compile.
In case it matters, the scripts in question are ahk-active-screenshot, CtrlAlt_Switch.ahk, Kill.ahk, and a modified version of this search script.

You can allow the script to automate administrative programs without running as admin, here're the required steps:
When installing AHK, check the "Add 'Run with UI Access' to context menus" option.
After installation, find AutoHotkeyU64_UIA.exe on your disk.
Open the .ahk script's properties, change the "Open with" option to the AutoHotkeyU64_UIA.exe you just found.
Create a shortcut to this script.
Open %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup in the file explorer.
Move that shortcut to this folder.
And you're done.
How does it work?
The "Add 'Run with UI Access' to context menus" option provides a workaround for common UAC-related issues by allowing the script to automate administrative programs without running as admin.
Reference: Run with UI Access.

Find the UIA version of autohotkey on your machine. For me it is at C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe.
In your startup folder, create a new shortcut (probably one for each of the scripts you want) as follows (replacing paths as appropriate):
Target: "C:\Program Files\AutoHotkey\AutoHotkeyU64_UIA.exe" "D:\path\to\script.ahk"
Start in: "C:\Program Files\AutoHotkey"
This launches your script as an admin using the UIA version of AHK on startup.

Related

Can I run/debug files with babel-node in WebStorm?

I know there are Run/Debug configurations in WebStorm, but I don't know how to configure the context menu (when I right click in a file, it has Run... and Debug... in the menu, but I can't find where to configure this).
Run configurations are created via Run | Edit Configurations... : press +, choose Node.js, in created configuration specify babel-node as Node Interpreter:
But note that debugging doesn't work well when using it. I'd strongly recommend using -r #babel/register Node.js parameter instead - see comments in https://youtrack.jetbrains.com/issue/WEB-21949

ColdFusion 10 Mandatory Update install fails on VM

I need to run the mandatory update for ColdFusion 10 so I can apply the later updates to the server. I downloaded the file and tried the instructions listed here: Mandatory Update Instructions.
I have a singular instance, so this should be fairly straightforward. I download the file, place it in the "hf-updates" folder, and then do java -jar cf10_man_updt.jar and I get the following notice:
Graphical installers are not supported by the VM. The console mode
will be used instead...
The installer proceeds to hang and fails to complete. I then go to option #2: Silent mode. I create my properties file and then do java -jar cf10_mdt_updt.jar -i silent -f install.cfg.txt. I get the following message:
Installer User Interface Mode Not Supported
Unable to load and to prepare the installer in console or silent mode.
This one has the courtesy to actually terminate so I don't have to close the command prompt window to retry, but I'm still nowhere. Any ideas on what I can do?
Alex provided the correct answer. I had been using the JRE in my program files folder (explicitly, actually. There was no javapath to speak of in the environment variables. I shorthanded the command for the sake of brevity). I changed the command to "C:\Coldfusion10\cfusion\jre\bin\java" -jar cf10_mdt_updt.jar and the install ran successfully.

Run configuration with command line program in IntelliJ IDEA

I would like to add a configuration inside IntelliJ so that I can run it from the Run context menu (there is included Node.JS launcher but I couldn't find a "Command Line configuration launcher")
Also, is it possible to run the command line terminal as Administrator if ran from Windows ?
The command I would like to run is ember serve
Thanks for the help.
These are the steps:
Go to Run/Edit Configurations...
Add a new one for "Javascript Debug"
Fill Name with the name you want for the configuration, fill the URL with http://localhost:4200 and pick the browser you prefer
Then, in the second white box, add an external tool by clicking in the green plus button and selecting the option Run External tool
Add a new one clicking on the green plus button and fill the following fields: in Name the name you want for the external tool, in Program write ember (it's the command you are going to run), in Parameters write server or s as the options for the command and in Working directory write $ProjectFileDir$ if it's not written already to run it in the folder in which you are working with.
With all this, you should only need to press the play button and it should run and open the browser automatically with a tab directing to localhost:4200, where your ember server is running.
EDIT: I'm not using it on windows so I'm not sure if it will run the command as administrator. Probably running Intellij using "Run as Administrator" will do the job.

WebStorm run command or program on project open

Is there any way to run external program or command after I open project in WebStorm?
I've created new external tool which runs database server, and after I click on it in menu, it runs the server and everything works, but I'd like to start this tool automatically on project start. And it'd be awesome if it could also open web browser to certain url which would be database admin tool.
If you can launch your desired task using Grunt/Gulp/npm task or any other Run/Debug Configuration then yes -- there is Startup Tasks functionality available at Settings/Preferences | Tools | Startup Tasks.
Note that you cannot execute External Tools entry directly or launch any DOS/shell command this way.
The easiest way of using this would be creating Grunt/Gulp task that would do your actual job. There you can use exec() method to execute custom command.

Installing a WIF Runtime for hosting a .NET application in Windows Azure

I developed a Custom application that is able to consume the CRM Web services and perform Windows Live Id authentication, create, read and update operation in the CRM from the custom .NET page. It runs absolutely fine when I debug the application in Visual Studio 2010 but when I deploy the same application and try to authenticate it shows the following error:
"Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
I just wanted to know how to install the Microsoft.IdentityModel assembly using a startup task.I followed some of the steps in the following link:
http://blogs.msdn.com/b/sriharsha/archive/2012/04/07/windows-azure-unable-to-find-assembly-microsoft-identitymodel.aspx
But was unable to add RegisterDLL.cmd to my project solution.
Well,
You can use what Sandrino suggests, but you can also use this powershell script. I use it in couple of project and it works fine. It also auto-recognizes Windows Version (because for Azure Guest OS Family 1.xx you have to use the Windows6.0-xxxxx, and for Guest OS Family 2.xx you have to use Windows6.1-xxx version of the KB update).
You can execute that powershell script in a very simple startup task. Create one setup.cmd file, that you have the following content:
#echo off
powershell -command "Set-ExecutionPolicy Unrestricted" 2>> err.out
powershell .\Install-WIF-OnAzure.ps1 2>> err.out
And run it as simple startup task:
<WebRole name="AzureAndWif" vmsize="Small">
<Startup>
<Task commandLine="setup.cmd" executionContext="elevated" />
</Startup>
...
</WebRole>
Hope this also helps ;)
What do you mean by "was unable to add RegisterDLL.cmd to my project solution"? In Visual Studio, just follow these steps:
Right click on your project
Choose Add > New Item > Text File
Enter the following code (from the blog post):
#echo off
sc config wuauserv start= demand
wusa.exe "Windows6.1-KB974405-x64.msu" /quiet /norestart
sc config wuauserv start= disabled
exit /b 0
Rename the file to RegisterDLL.cmd
In the properties, set Copy to Output Directory to Copy always
Go to File > Save as. On the Save button, click the small arrow and choose Save with Encoding
Choose Unicode (UTF-8 without signature) - Codepage 65001
This should be enough to have a working file. Now follow the rest of the guide and redeploy your application.
If you are deploying this to Windows Azure then make sure "copy local" is set to true on the Microsoft.IdentityModel when you deploy to Azure.
-----------**Update**----------------------------
Cloud Tip #9-Add Microsoft.IdentityModel to the GAC with a Startup Task
http://blogs.msdn.com/b/benko/archive/2012/04/07/cloud-tip-9-add-microsoft-identitymodel-to-the-gac-with-a-startup-task.aspx
This should help...