Running Alteryx flows from command line - command-line

I'm trying to figure out if I can launch a pre-built Alteryx workflow without launching the Designer - and without having Alteryx Server.
I came across a helpful post on Alteryx uses by #Runonthespot that, among other things, addressed running workflows from the command line, but doesn't go into detail. That discussion is here: https://stackoverflow.com/a/30469848/4313331. I don't have the rep to comment on his post and the question is closed.
He writes:
"Flows are runnable from the commandline on a server, and easiest way I've found (besides using Alteryx's own scheduler) is to save as an "App", and then run from the command line using the Alteryx engine executable, passing it parameters via xml file. You can save a sample xml parameter file from your flow by hitting the magic wand button (after saving the flow as a .yxwz (app)) This brings up a panel that lets you set the variables, and that panel has a handy "save" button which generates an xml file in the right format."
So, I'm looking for more info on this process. Is it simply a question of using Alteryx Server? Or is this a more interesting work around?
Thanks.

Yes, you can run a workflow (used generally to refer to a workflow, macro, or analytical app) without launching the Designer. You'll first need to understand how to run the workflow from the command line. The AlteryxEngineCmd.exe executable runs a workflow. It is located in the Alteryx install path in the bin subfolder. Here is where mine is located:
C:\Program Files\Alteryx\bin
It allows an additional parameter of an XML file with interface values. This is documented for analytical apps ONLY though it does work for macros as well. This is based on my extensive use of this undocumented feature.
Below are two examples:
AlteryxEngineCmd.exe MyWorkflow.yxmd
AlteryxEngineCmd.exe MyAnalyticApp.yxwz AppValues.xml
You can see a post here:
Alteryx Command Line Help
I prefer to wrap the command in a batch file and execute that for more control.
Now that you understand how to run the workflow from the command line, you can execute it anytime you want without launching Designer. Furthermore, you can use Windows Scheduler or a third-party tool to run the command or the batch file on a schedule.
Finally, you do need a license which enables API & Command Line w/ Scheduler. This is less expensive than Alteryx Server.

Have you tried C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe? It doesn't require server.
https://help.alteryx.com/2019.1/Command_Line.htm

If restrained by budget, you don't need a scheduler license (enables the AlteryxEnginecmd.exe), you can use a windows mouse clicker or even Powershell, to run the Designer though, without manual intervention.

Related

How to run exported Parameters Variation experiment in a headless environment automatically?

I would like to run an exported Parameters Variation experiment on my Linux machine. Although there is a way for setting a Simulation experiment to start automatically running the batch file (or .sh file for Linux) once the file is opened, I cannot find a similar option for Parameters Variation in which I am running 40 different replications of the same model. In Windows, you need to open the file and manually click the Run button for this.
Considering Linux OS, which is a headless environment, how can I make the model start automatically once I run the command ./mySimulationModel_linux.sh?
Currently when I run this command, the model does nothing. Any help will be appreciated.
The best option would be to add some code to your "Initial Experiment setup:" section to get it to run without any user input
just add run();
Of course, you can add any of other code as well there.

How to run system command in Cake build?

I couldn't find any information related with running custom system command on this site: cakebuild.net/dsl
How can I do it?
The real command I want to run is 'upx mproject.exe'
If I have understood you correctly, then what you are looking for is the Process Aliases that exist within Cake:
http://cakebuild.net/dsl/process/
These allow you to start any arbitrary process from within your Cake script.
Another option, would be to create a Cake Addin that wraps the tool that you are trying to execute.

Installing other installers?

I'm tasked with reducing a 50-page installation manual to "much less"; a bunch of applications need to be installed in a specefic order, with specific options, and so on. Can I use any of the popular installers (WiX, NSIS, Inno Setup) to automate this process, or do I need to use Powershell?
I've read about what these installers can do, and as far as I can see they're designed to install one application to one computer -- I haven't seen that or even if they can be used to control other installers in a very detailed fashion -- "use this, this, and this option on this wizard page, but not that one on the next wizard page, and install to this path, then enter these details (users, whatever)".
Am I wildly over-understanding what these tools can do? Given that I need to do this, what's the best way to go about it?
Update 2: I learn that installers do offer silent install by way of a config file. Neat! I'm currently looking at NSIS (spawning Powershell scripts and other installers) as the option that's easiest to just start & go with. I like that I don't need a custom IDE for it. But I'm also wondering wether NSIS is (soon) obsolete, in a Windows 7&10 world?
You should look at WiX with a custom bootstrapper UI. That can be used to install any number of setups in whatever order you want. The tricky question is whether all those setups need to show their own UIs, one after the other. If they can all be installed silently with command line paramaters, then your WiX bootstrapper could show your UI to collect all the options, and then install each of the setups silently while you show progress for the entire operation. You could also get a single entry for the entire package in Programs&Features. So something like WiX could do it, but the UI requirements could make it awkward.
PowerShell CAN do it, but it's through invoking COM objects and sending keys to the window, so it's not the BEST way to do it. I'm going to repost something I posted yesterday to a similar question about using PowerShell to uninstall some unwanted software.
QFT:
PowerShell isn't going to interact with the prompts... you can't just tell it to click "Next" in an executable because it can't see it.
You can send keys to it though. You're really just using COM objects.
So, first, get your process ID by setting a variable that contains an array, the data for which is defined by the name of your process. Let's say your process is called, "Uninstall" and the process is ALREADY RUNNING:
$a = Get-Process | ?{$_.Name -eq "Uninstall"}
Start the COM:
$wshell = New-Object -ComObject wscript.shell;
Bring the uninstallation program with this process ID to the front so we can send it keystrokes:
$wshell.AppActivate($a.id)
Give it a few seconds to bring that window forward. I chose 5, but if your machine isn't stressed, 2 is probably enough:
Start-Sleep 5
Now start telling it what keys you want to send. The syntax here is this: whatever is in the () is what will be sent. The position in the single-quote is the keystroke to send, after the comma is how long you want it to wait before proceeding. Assuming the first screen is "Next" you can send your first command by telling PowerShell to send the ENTER key and wait 5 seconds:
$wshell.SendKeys('~',5)
The wait function is optional, but for your purposes, you're definitely going to want it. (If you don't want it $wshell.SendKeys('~') would send the ENTER key and immediately move to the next command.)
Walk through the uninstallation yourself manually, using all keystrokes, and for any keystroke you send, pay attention to how long it takes before the next part of uninstallation is loaded, and wait longer than that with your script (e.g. if it processes your ENTER key instantaneously, I'd have it wait 3 or 5 seconds before it sends the next command. If it takes 5 seconds to load, I'd tell it to wait 10 seconds before sending the next command).
Letters are letters, and numbers are numbers. Most non-commands are just assigned to their keys (meaning if you want to type "K" your command would just be $wshell.SendKeys('K')) You can get the rundown for the specific keys here: https://msdn.microsoft.com/en-us/library/office/aa202943(v=office.10).aspx.
/QFT
You may want to look into Auto-It, but that's based on pixel, last I checked, so if you run it on machines with different screen resolution, it can cause problems.
How you approach this really depends on if these other installers supports silent mode and/or answer files. This page list the options for some of the popular installers.
If they do and you decide to use NSIS then you would just do something like this:
Name "BundleInstaller"
OutFile "bundlesetup.exe"
RequestExecutionLevel Admin
Page Components # Comment out this if you don't want the user to have a choice
Page InstFiles
Section -Init
InitPluginsDir # $PluginsDir directory is deleted when the installer quits
SetOutPath "$PluginsDir"
SectionEnd
Section "Foo v1.2.3"
DetailPrint "Installing Foo"
File "FooSetup.exe"
ExecWait '"$PluginsDir\FooSetup.exe" /S /D=$ProgramFiles\Foo' # This is the syntax for NSIS installers
SectionEnd
Section "Bar 2015"
DetailPrint "Installing Bar 2015"
File "BarSetup.msi"
ExecWait '"MSIEXEC" /qb /i "$PluginsDir\BarSetup.msi" REBOOT=ReallySuppress'
SectionEnd
Section -Cleanup
SetOutPath "$Temp" # Release current directory lock on $PluginsDir
SectionEnd
If this solution is not possible then you are looking at some form of automation like the other answers have suggested.
I'd say there are two forms of automation; one where the app you are automating has to be the active window and the other where you send messages instead of keystrokes.
Just sending Enter to the active window with some sleep's thrown in is of course the easy solution but it can break if somebody starts interacting with the machine.
NSIS supports commands like FindWindow and SendMessage and I assume AutoHotkey does as well. The advantage to using FindWindow to find a specific HWND and then sending it a message directly is of course that the application does not have to have keyboard focus. This approach requires a bit more work but the end result is better because you only use SendMessage after finding the right window (and you can make sure the window/control is visible and enabled etc) so you know the application is in a known state without having to hope that the sleep was long enough...
Installing other installers is no problem with any decent installer builder.
These other installers are either msi, exe or zip files.
I do not assume that the installers (for SQL database servers and the like) offer silent install (by way of a million command-line parameters or a config file).
I highly doubt I can launch these installers in silent mode (with a million command line parameters)... :-(
Fetch the installer for the SQL database server and check it.
Most of the installers offer a silent install.
msi or exe files created by another installer builder accept CLI arguments to select components and set the target path
even exe files created as SFX archives accept a target path for the unpackaging
some installers do not provide all form-fields of their GUI configuration dialogs as CLI parameters. for those installers you would need a post-configuration step, which might simply consist of copying a default config file into the application folder
Yes, its also possible to center an installer around the idea of "gui automation" or "inserting keystrokes" using AutoIt, AutoHotkeys or any other Automation tool from inside the main installer.
You would need to build an automation script for each installer and execute it from the main installer. Its probably nice for testing and replaying the individual component installations.
But YAGNI.
Given that I need to do this, what's the best way to go about it?
Make a full run and note all the installation steps.
list the installers you need
find the download urls
download the installers
download additional tools you need (unzip?)
for each installer check the CLI arguments it accepts
check if you get a decent default configuration, when leaving some CLI args away
install each installer from the CLI into your target location
Then translate the steps you have into the Installer builder of your choice. Its mostly copy pasting CLI commands into Exec() or ShellExec() calls, followed by copying config files and fiddling around with cross-component configuration.
I haven't seen that or even if they can be used to control other installers in a very detailed fashion
Just think of all the game installers shipping DirectX or the pre-packaged web-development stacks like XAMPP or WPN-XM (speaking of the last: you might take a look at this InnoSetup script file).
A wrapped installation of multiple software components is pretty common.

Visual Studio Online / Azure stopping and starting web applications using Powershell

I'm using Visual Studio Online's build tools to deploy web applications from a single solution. I've occasionally been running into file locking issues.
Error: Web Deploy cannot modify the file 'Microsoft.CodeAnalysis.CSharp.dll' on the destination because it is locked by an external process.
After some Googling, I believe the "fix" is to stop the web applications before deployment on Azure and start it back up after. Sounds legit.
However, there does not seem to be a straight forward way to do this directly on VSO's build definitions. I've created an "Azure Powershell" build task, but it wants a PS1 file from the repository. It doesn't seem to let me just run Azure Powershell commands (e.g. Stop-AzureWebsite) from here. My team has created a work-around where we have a "run.ps1" that just executes the command you pass as a parameter, but none of us are satisfied by that.
What are we missing? There has got to be an easier way to do this without having a PS1 script checked into source control.
I solved this by installing Azure App Services - Start and Stop extension from Visual Studio Marketplace.
When installed, it will allow you to wrap the Deploy Website to Azure task in your Release definition with Azure AppServices Stop and Azure AppServices Start tasks, effectively eliminating the lock issues.
Check if you are using "/" on the "Web Deploy Package" path for folder separators instead of "\".
i.e. change
$(System.DefaultWorkingDirectory)/My Project/drop/MyFolder/MyFile.zip
for
$(System.DefaultWorkingDirectory)\My Project\drop\MyFolder\MyFile.zip
I noticed that was the only difference between the one I was getting the error and the others (the Restart step I added was not helping). Once I modified the path, I got it working.
Sounds crappy, but fixed my issue.
Did you use the Build Deployment Template that sets the correct msbuild parameters for you for your package? You can see how here. I would create a build using that template and see if you have the same issues. If so ping me on Twitter #DonovanBrown and I will see if I can figure what is going on.
As a rule it is good practice to have any scripts or commands required to deploy your software to be checked into source control as part of your build. They can then be easily run repeatedly with little configuration at the build level. This provides consistency and transparency.
Even better is to have deployment scripts output as part of the build and use a Release Management tool to control the actual deployment.
Regardless having configuration as code is a mantra that all Dev and Ops teams should live by.

Automated execution of a powershell script on Active Directory, Triggered from a web page

I am proposing an idea for a final year project that is basically a virtual environment. I would be using Citrix XenServer in conjunction with Windows Server 2008 R2 and Citrix netscaler to make the server accessible over the web. I would also be hosting a website on the server that Windows is on.
What I was wondering is, would it be possible to trigger the execution of a script on the server from the web page. So basically a user comes along, goes to my website, registers their details. a csv file is then produced based on the details that are input. Then I was wondering is there a way to trigger the execution of a powershell script that would use the csv file to set up the user in Active directory. The powershell script itself is simple its just how I would get it to run is another thing.
Yes it is possible.
PowerShell lets us create graphical interfaces with the .NET winforms. With it, we can build front end to manage our scripts. It's a really nice feature, and tools like AdminScriptEditor make it pretty easy.
I have found this link for your reference - PowerShellOnWebPage
You can tweak/create the script as per your need.
Let me know if this helps.
Thanks!