Powershell Parameter Passing - powershell-2.0

This seems so trivial, but I can't figure out why the parameters I'm passing into a .ps1 script from the command pane aren't getting captured correctly as shown in this image below. String parameters are just empty, numbers are 0 which tells me I've overlooked something basic! This is with Powershell v2.

Thanks mklement0.
It was, in fact, a path issue within the ISE

Related

How to set jenkins string parameter in Windows batch command

I have declared a string parameter in Jenkins i.e "Year".
The value is to be set in windows batch command, because i thought this was simple without a plugin.
Below screen depicts on how i am setting the parameter Year.
When I do echo can see in the console correct data is displayed however when I try to use the same parameter after this execution in next set as ${params.Year}, it seen as empty.
What I am doing wrong here? not able to figure it out.

SQL*PLUS How to place argument inside string

I am passing a string into sql script in &1 and unplugging pdb. I am required to enter path to file location where the xml from unplug will be placed, I would like the path to contain the string passed in &1, something like this d:\Oracle\oradata\gl_db&1&1.xml.
The path itself needs to be quoted in SQLPLUS script, like this "d:\Oracle\oradata\gl_db&1&1.xml" where &1 would be replaced with the variable passed from powershell as "$Variable".
I suspect this problem has a really simple solution but I can't seem to figure it out, and would appreciate any help.
Actually, I found the answer myself, the issue was simply in the dot before xml extenstion, to have dot work correctly after &1(&1.), simply make it 2 dots, like this &1..

Closure compiler does not write out errors

I have a Groovy script that runs the closure compiler latest version.
def command = "java -jar $compiler --js $orderedDependencies --js_output_file $minFilename --create_source_map $mapFilename --compilation_level WHITESPACE_ONLY --source_map_format=V3 --language_in=ECMASCRIPT5 --debug --formatting=PRETTY_PRINT"
command.execute(null as List, outputDir).waitForProcessOutput(System.out, System.err)
When I use it without the --language_in option, I get error output. When I add the command option, I don't get any error output, but it breaks somewhere, because nothing gets created and the web interface is broken.
Does anyone have any idea why this might be?
I'm not sure what the problem is since the code you provided isn't enough the reproduce it.
But chances are that you are searching in the wrong place: the .execute() command can be quite annoying. Take a look at this question to get some ideas on what could go wrong and how to solve it: Trying to send an email trough a groovy shell script

How to pass command-line args to my application when it has replaced Explorer.exe

I am using the techinque shown here and in a number of other places to cause my application to launch at start-up in place of Explorer (and Metro in Windows 8!) by creating a registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
with c:\xxxxx\MyApp.exe as the argument.
This works fine but I also need to pass it some arguments. I've tried this by making my key value (for example) "c:\xxxx\MyApp.exe" "arg1, arg2" but it would appear that arguments are being taken as a possible second start-up program with the comma as a delimiter. Can anyone advise how to pass arguments to a shell substitute? I've also tried double quotes with the same effect. Is it actually possible to pass arguments in this way? Or must I create some kind of launcher app to do this indirectly? I really do want my app to be the only kid on the block....
BTW I'm using Windows 8.0 and my app is written in Delphi.
AFAIK, you'd use the parameters just like you would in a batch file:
"C:\xxxxx\MyApp.exe" "%1" "%2" "%3" "%4" "%5"
In a batch (or the registry) the "%x" parameters have special meaning. They always mean "parameter X".

How do I fix 'Setup project with custom action file not found' exception?

I am trying to create a setup project for a Windows Service. I've followed the directions at http://support.microsoft.com/kb/816169 to create the setup project with no trouble.
I want to be able to get a value during the installation in order to update the app.config with the user's desired settings. I added a Textboxes (A) dialog to retrieve the values. I set the Edit1Property property to "TIMETORUN", and in my Primary Output action's CustomActionData property I put in the following: /TimeToRun="[TIMETORUN]\". So far so good. Running the setup I can retrieve the TimeToRun value from the Context.Parameters collection without issue.
In order to locate the app.config I need to also pass in the value of the TARGETDIR Windows Installer Property to my custom action. This is where things begin to fall apart. In order to achieve this, the above CustomActionData must be altered like so: /TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\". Now when I run the setup I get the following error message:
Error 1001. Exception occurred while initializing the installation.
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\SysWOW64\Files' or one of its dependencies. The system cannot
find the file specified.
If you google this problem you will inevitably find people having tremendous success by simply adding the trailing slash to the /TargetDir="[TARGETDIR]\" portion of the CustomActionData. This unfortunately does not solve my issue.
I tried so many different variations of the CustomActionData string and none of them worked. I tried logging to a file from my overridden Install method to determine where the breakage was, but no log file is created because it's not even getting that far. As the error indicates, the failure is during the Initialization step.
I have a hunch that it could be one of the dependencies that the setup project is trying to load. Perhaps somehow something is being appended to the CustomActionData string and isn't playing well with the TARGETDIR value (which contains spaces, i.e. "C:\Program Files\My Company\Project Name"). Again, this is another hunch that I cannot seem to confirm due to my inability to debug the setup process.
One further thing to mention, and yes it's another hunch, could this be an issue with Setup Projects on 64-bit version of Windows? I'm running Windows 7 Professional.
I'll provide names of the dependencies in case it helps:
Microsoft .NET Framework
Microsoft.SqlServer.DtsMsg.dll
Microsoft.SqlServer.DTSPipelineWrap.dll
Microsoft.SqlServer.DTSRuntimeWrap.dll
Microsoft.SQLServer.ManagedDTS.dll
Microsoft.SqlServer.msxml6_interop.dll
Microsoft.SqlServer.PipelineHost.dll
Microsoft.SqlServer.SqlTDiagM.dll
As you may glean from the dependencies, the Windows Service is scheduling a call to a DTSX package.
Sorry for the long rant. Thanks for any help you can provide.
The answer is so maddeningly simple. If the last argument in the CustomActionData is going to contain spaces and thus you have to surround it with quotes and a trailing slash, you must also have a space following the trailing slash, like this:
/TimeToRun="[TIMETORUN]\" /TargetDir="[TARGETDIR]\ "
The solution and explanation can be found here.
Had a similar issue. In my case, it was odd because my installer had ran successfully once, then I uninstalled my app via Add/Remove Programs successfully, did some coding (did NOT touch my CustomActionData string), and rebuilt my project and setup project. It was when I re-ran my MSI that I got this error.
The coding I had done was to bring in more values of more parameters I had been specifying in my CustomActionData string. That syntax for getting the parameter values (i.e. string filepath = Context.Paramenters["filepath"]), which was in my Installer class, was actually fine, but as I found out, the syntax of the later parameters I was now trying to get from my CustomActionData string had not been correct, from the very beginning. I had failed to add a second quote around one of those parameters, so nothing else could be obtained.
I was using the "Textboxes (A)" and "Textboxes (B)" windows in the User Interface section. A has 1 box, EDITA1, where I get the path to a file, and B has 2 boxes, EDITB1 and EDITB2, for some database parameters. My CustomActionData string looked like this:
/filepath="[EDITA1]" /host="[EDITB1] /port="[EDITB2]"
It should have been:
/filepath="[EDITA1]" /host="[EDITB1]" /port="[EDITB2]"
(closing quote on [EDITB1])

Resources