How to provide answers to Powershell installation questions? - windows

I have a setup.exe file to install on Windows Server 2012. Upon clicking the SETUP file, a PowerShell console will popup and will start the installation process. As the process goes through, I will be asked many questions for initial configuration, such as:
>username:
>password:
...................#starts with setup again with verbose outputs
>SQL Server Address:
>SQL Server Database Name:
..................#starts with setup again with verbose outputs
>Database Username:
>Database user password:
.................#starts with setup again with verbose outputs
>Application Name:
.................#starts with setup again with verbose outputs
..............................................................
I install this application from time to time and I want to know if I can write a PowerShell script to give the answers via the script, since I am a newcomer to Powershell, I am here to seek help.
Thanks

Related

Bamboo remote build agent cannot find powershell.exe after installing nodejs

I just installed nodejs on one of my build servers (Win Server 2008 R2) which hosts a Bamboo remote agent. After completing the installation and doing a reboot I got stuck in the following situation:
The remote Bamboo build agent is running as a windows service with user MyDomain\MyUser. When a build with an inline powershell task is executing it fails with the error (from the build agent log):
com.atlassian.utils.process.ProcessNotStartedException: powershell could not be started
...
java.io.IOException: Cannot run program "powershell"
...
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
Loggin on to the server as MyDomain\MyUser, I have checked that powershell is in the path:
where powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
I have tried to restart the service and reboot the machine multiple times. No luck. The only thing that works is if I execute my scripts as a bat file with an absolute path to powershell - but I do not want that.
I have searched for solutions on this, but even though this one seems related: Hudson cannot find powershell after update to powershell 3 - the proposed solutions do not work.
What am I missing here?
If you do a default installation of nodejs you will see that it adds nodejs and npm to the path. Sometimes I have seen that the installer adds a user variable named PATH - it might be that the Bamboo agent decides to read the user path without "merging" it with the system path. I think it would be worth a try to give that a look.
As per Atlassian support page, this is related to a bug in Java Service Wrapper. I tried Workaround-2 since there was no user PATH variable in my system. I had to uninstall bamboo agent service and Java 64 versions from the agent machine to apply the workaround-2.

MPICH2 error - Credentials for <user> rejected connecting to <host> Aborting: Unable to connect to <host>

I need to get MPICH2 working for my college project. But it appears I won't implement anything until I manage how to start MPICH2. For now I only try to run anything on my computer, nothing more. What I do:
I install the MPICH2 (from mpich.org/downloads, from the bottom of the site - the x86_64 Windows version) on my 64bit Windows 7 (I also tried the same with my 64bit Windows 8). I start the installer from a command line (run as an administrator), install MPICH2 for everybody (although my acc is the only one). After successful installation I run the wmpiregister.exe, where I type Danioss (it's the name of my account) and the password for this account. I click register, everything seems to be fine so far. Then I run wmpiconfig.exe, I don't change nor click anything and there is this error:
'g-pc: MPICH2 not installed or unable to query the host'
I can see on the left the table with my host name (g-pc) and the version of MPICH - 1.4.1p1. So it sees it is installed here but cannot query the host. I have no idea what that means.
Of course I tried to execute any compiled program but after running wmpiexec.exe, choosing the file and clicking Execute - I get
'Credentials for Danioss rejected connecting to g-PC
Aborting: Unable to connect to g-PC'
I tried running every .exe as an administrator, didn't help. I also installed and reinstalled the whole MPICH2 tens of times (literally - tens) trying different configurations. I also tried to install the 32bit version but that made no progress. I really have no idea what the problem is.
Please, help me!
Greetings,
Daniel
Try not specifying username after running wmpiexec -register. Just password for your current user. That worked well for me. Source: https://trac.mpich.org/projects/mpich/ticket/1151
First: crate a windows user password of your windows user acount
Second: go to installdir deform (C:\Program Files\SFTC\DEFORM\v10.2\3D)
Third: execute "wmpiregister.exe" and register user name and password that your windows user name and password
start deform on multiprocessor
good work
You need to run wmpiregister.exe which is in bin folder, to register your Windows user.
Register using mpiexec -register with ".\" before the username, in your case: .\Danioss.

Exec a program on client runs a programm on server

First of all I have spent over 4 hours researching this topic..
So I have a Windows 2008 r2 root server at the moment. I connect to it via Remote Desktop.
Now I want to write a program that runs batch files on the server but the program is at client side, I have tried to setup an SSH server on my Windows server with Freesshd.
That seems to work but the programs are not shown. (In Taskmanager are they)
Is there way (prefer SSH) to let them show normally?
The goal is to restart programs (Gameservers).
My Program will work so: if I press restart server it will connect (if SSH) via Putty to the server to exec the batch file.
Or will start another program with parameters something like this:
Clientprogramm -ip 95.25.115.** -user Administrator -p xxxxxx C:\gameserverdir\start.bat
Simple and fine. I have done that already for Linux and there it isn't that hard.
So if you have an idea that can help me would be nice to know.
Both system are Windows!
If you are using SSH, the tool you need is plink. It's putty for command line.
Or, as indicated in comments, you can use psexec, or powershell, or vbscript, or .... BUT started programs are only "visible" in the same session from where they were started.

Install .exe software application on remote machines

I modified this script from the net, which is suppose to install .exe applications for remote machines:
$m = Read-Host "Enter machine name"
$File = "c:\temp\office2007sp2-kb958194-fullfile-en-us.exe"
$product = [WMICLASS]"\\$m\ROOT\CIMV2:win32_Process"
$product.Create($File)
When I run this script, I have noticed that this program promptly creates a process in the remote machine with the application name office2007sp2-kb958194-fullfile-en-us.exe.
This can be checked in the task manager also.
But other than that, there is no way to find out if this is getting installed in the remote machine or not.
Is there a way to find out, if the installation is really happening?
Or does this script actually works?
Not a proper answer because I haven't tried remote process launching like that, but I have used psexec to launch processes on other machines.
If you are still having problems with your script you may want to check out ps_exec, it lets you execute processes on other machines as if it was your own. You can check the exit code of the process just like you would if you were executing the process locally.
It's offered as a free tool by microsoft: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Running batch file on remote machine from hudson server using PSEXEC

I am new to Hudson with PSEXEC, i am using hudson in my computer, i want to run batch file on remote computer from hudson build.
I used PSEXEC to run batch file on remote computer,when i executed from command promt it working successfully.But same i did from Hudson build its hanging..it's not doing anything.so please give any suggestions is there any other way we can handle this.
I want to do this quikly...urgent
Anyones help is appreciable
thanks in advance.
Could it be that psexec is waiting for a user entry? In this case hudson will hang.
Does Hudson runs with your user credentials? if not lunch a command Prompt with the credentials Hudson is running with and see what happens if you call psexec. If hudson runs on the local system account, you can't start a command prompt with it. Than try to run Hudson with your credentials and see what happens.
BTW, did you check Hudsons log files (just in case that there might be something)?
I had the same problem where PSEXEC simply hung.
The solution i found (after trawling for AGES) was to add the parameter -accepteula to the PSEXEC called. Hudson stopped hanging after that.
Very frustrating.
maybe it is too late, but I thought I will post it for others who have the same problem.
Psexec has problem running from any CI server, doesn't matter what CI server you have, is it Hudson, Teamcity, ...).
Psexec hangs when run from the build server.
It doesn't hang for all commands, but with some commands , psexec will hang.
The problem resides with how psexec will read the output of the remote running command.
The ultimate solution is to use other tools than psexec.
You can check this blog of this solution.
But if you need a simpler solution, and you don't care about the output of the command, I came up with a simple solution that suppress the output of the psexec.
You can write a small c# program that will run the psexec command, suppressing its output.
I blogged about that here
I thought I would respond to this since I was having the same hanging problem with TeamCity and psExec. Since I believe it is actually an issue with Java executing psexec, it should apply in the case of Hudson as well.
While I ran into the accepteula issue was early on, you only need to agree once and it sets a registry setting. As user327759 indicates the -accepteula switch in the script would cover your basis the first time and for ever after.
If this doesn't fix your problem, which it didn't in my case, you need to add the "-i" command switch. ex: psexec -i \ServerName "C:\folder\file.bat"
For context regarding this solution, I have included my backstory:
I was able to execute this PsExec command just fine via a MsBuild task, via a .Net wrapper and via straight command prompt usage, but TeamCity would just hang on the execution. It seems that Java is expecting some response on standard in, when it invokes the psexec exe. On the remote server I would see the psexecsvc process fire up and register in the services console appropriately, but then it would stop. After reading many posts such as this one, and struggling for far longer than I would care to admit, I eventually tried -i option, despite not needing this in any other execution scenario outside of TeamCity. The psexec documentation indicates that -i will "Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session." It is still unclear to me why this makes all the difference for TeamCity.

Resources