NANT registry import - nant

I have a build task in CruiseControl.NET that needs to import a registry setting. I have tried using the EXEC task and running regedit.exe but it seems to fail.
There doesn't seem to be a like there is a task.
Does anyone know how to do this?
Thanks,
David

I'm assuming you have the registry settings you want to import in a .reg file. The default handler for a .reg file in Windows is 'Merge'.
You should be able to just pass the .reg file name as command directly to CCNET exec to import the settings.

You can wrap the windows command REG as in REG QUERY in an exec task?

Related

Unable to invoke ssh.exe in PowerShell even on providing the full path via UiPath Studio

The following works on my windows machine using PowerShell
ssh username#example.com
Now, I am trying to run the same command within PowerShell using UiPath Studio for RPA but I get the standard invalid command error -
Invoke Power Shell: the term 'ssh username#example.com' is not recognized as the name of a cmdlet, function, script file, or operable program...
However ssh.exe does exist on the machine and I even tried providing the absolute path, same result.
Are there any additional configurations to be done on the UiPath / system end to make ssh executable via UiPath Studio?
Thanks in advance
I had a similar issue with Invoke-SSH, what I did was to do Import-Module Posh-SSH, but that resulted to:
Import-Module: Could no load file or assembly 'Renci.Ssh.Net
So in UiPath Studio I went to Manage Packages and installed the Nuget package for Renci SSH. Afterwards, the Import worked, and then the Invoke-SSH command worked too.
Got this tip from this video: https://www.youtube.com/watch?v=y2VnY48MJQE&ab_channel=techu

Azure DevOps ssh script file task

I'm just wondering if it's possible to use a script file in the SSH task in the Releases that will be populated with the environment variables from azure.
Script:
TEST=$(test)
I saved this script as an artifact, successfully download it, and select this script in the SSH task as a file, but the problem is the environment variables is not unwrapped, does someone have some approach?
If I put this same script as an inline script, then it's working. But if I chose script file then not.
I want to have this script in the git repo, so I can easily edit the script.
Does someone have this working?
I'm just wondering if it's possible to use a script file in the SSH task in the Releases that will be populated with the environment variables from azure
I am afraid there is no such out of way to use a script file in the SSH task to populated with the environment variables from azure.
As workaround, we could use the task Replace Tokens to update the value in the script file:
The format of variable in .sh file is #{TestVar}#.
Hope this helps.

In Rundeck: how can you set the working directory for command execution?

No matter what I try, executing pwd always prints /var/log/rundeck. I'd like to configure this as a global or even project-wide setting as all my scripts and commands will be relative to a specific directory on the file system.
/home/jobs for example.
There is no setting on Rundeck can set working directory.
Each command is running in separate context, you can chain them together.
As an improvement to the above answer by "Yang" you can edit rundeck "resources.xml" file and add a attribute called "nodepwd" with your node location like below.
<node name="localhost" nodepwd="/your/pwd/location" .... />
Then you can change your path to that and execute the commands.
In my case, I have to run "cd $RD_NODE_NODEPWD" in my inline scripts to change the current working directory.

None of my scripts run using PowerGUI, but they work directly from PowerShell

I just installed the latest version of PowerGUI (3.6.0.21).
When I try to run any script from inside PowerGUI I get the error message 'The file C:\Sandbox\MyPowerShell.ps1 cannot be loaded. The file C:\Sandbox\MyPowerShell.ps1 is not digitally signed.
I have googled all over for something simple to get around this, but no luck. What do I need to do to get this going?
Also, if I run the script commands from PowerShell directly they work.
AllSigned will not let you run an unsigned script. If you can't change the execution policy then import it as a module.
Save the script as a .psm1 and use Import-Module. It will bypass scripting policy because it's being loaded/run as a module.

How do I get Powershell to execute in scheduled task?

I have created a Powershell script and set it up to run within a .bat file. When I click on the .bat file the Powershell script runs like a champ. I then set up the .bat file to be run as a scheduled task. Again it works like a champ when I right click on it and launch it interactively. Problem is it fails when the task scheduled to run unattended in the evening.
Not sure if this matters but I am using Powershell v.1 on Windows 2003 Server 64.
Thanks in advance for your help.
==========================================
The status on the scheduled task is "Could not start". Perhaps fails was the wrong choice of words because the task probably doesn't even start running.
The task is set up to run as my user and I am set up as a local administrator on the box.
Check if scheduled task's security setting
Scheduled task might be running under a credential that does not have access to the batch file.
When you are adding a new task, you are asked to enter a credential
And you can check for already created task's credential
[UPDATE]
The status on the scheduled task is "Could not start". Perhaps fails was the wrong choice of words because the task probably doesn't even start running.
Make sure that Task Scheduler service is running
Is the task set to run with your useraccount or as System? Check the access rights on cmd.exe and powershell.exe.
Also if you go to the sheduled tasks you can do a 'view log' in the advanced menu to check for error messages.
Just a guess, but could it be something to do with the account/security context from which the script is running? If it's running on the System account, then that could certainly be a problem. (I suspect it's just running on your user account however.) Check that all your path variables are set correctly when the script runs, for a start. Otherwise, could you perhaps provide any more information on how exactly it fails (i.e. any error messages)?
Maybe the current directory is not set as you expect when running from the task manager. Try running your bat file from the command line, while you are not in the same directory as the file (and your .ps1 script) are.
Otherwise: check permissions.