Is there any way to transfer files to a remote windows machine using winrm / powershell or any native windows commands?
I have a Chef knife-windows installed on one of the Linux machine. I want to transfer files from the linux machine to the windows machine using knife winrm or any native windows commands without installing any additional packages on the windows machine.
I tried to cat a file & pipe it to the knife winrm command and do a Set-Content or Out-File powershell commands, but it was not working as expected.
If you have admin access to the Windows boxes you can always copy files to an administrative share via SMB.
From PowerShell
knife winrm -m <IP> -x <USER> -P <PASS> "echo $(gc .\secret_key)>c:\secret_key"
You have to remember, that main issues is that regardless of your execution context (powershell / bash shell) the destination will always be CMD. So you gotta play by the destination rules.
$(gc .\secret_key) gets the contents of the file locally, and echo is executed remotely.
Related
I am configuring my AWS CLI and I am trying to setup SSH. Whenever type in anything (I am just trying the default "aws-eb" I always get the error "To use this command, SSH must be installed on your local machine and available from the command line.".
Amazon says I must have ssh-keygen as well as SSH installed but I can't really find where to install SSH onto my computer.
I have installed OpenSSH Client and OpenSSH server through windows settings but that doesn't work. Can anyone help?
To install a Topshelf service, I normally simply do:
myservice.exe install
If I want to install the service on a remote machine, I can't just do:
\\server\c$\myservice.exe install
...because it would still install the service on my local machine.
How can I install a Topshelf service on a remote machine without having to log onto that machine and run the executable directly from there?
Microsoft provides a tool called PsExec. It has a whole bunch of feature one of which is to run command on remote machines.
Edit:
File Deployment: To get the files to the target machine you would have to do some sort of copy, whether that be manually or with some sort of script.
Install: Install psexec on your machine, it may need to be installed on the remote machine but I do not remember. Open command prompt on your machine, type
psexec \\remotecomputername -u admin#domain.com -p p#$$w0rd "c:\applications\myprogram\myprogram.bat"
In this case remotecomputername is the name of the computer your are targeting. If you need to login as another user, use the -u and -p switches in the example and finally, put the path to the exe "c:\applications..."
I'm trying to use vagrant ssh in windows console, but it don't work.
Vagrant is correctly installed, and i've installed also Git for windows.
Also, correct path is installed in the system environment, using
setx PATH "%PATH%;C:\Program Files (x86)\Git\bin"
and i can see the path add-on in the console via path and also in the windows system environment.
But when i'm use vagrant ssh in the windows console it give me the usual error:
ssh executable not found in any directories in the %PATH% variable.
Is an SSH client installed? Try installing Cygwin, MinGW or Git, all
of which contain an SSH client. Or use your favorite SSH client with
the following authentication information shown below:
Host: 127.0.0.1 Port: 2222 Username: vagrant Private key:
C:/vagtest/.vagrant/machines/default/virtualbox/private_key
If i digit path in console, i have the correct path with git location, but it is useless.
If i digit
set PATH=%PATH%;C:\C:\Program Files (x86)\Git\bin
the command
vagrant ssh run, but obviusly when i close the console and reopen it, it don't run more.
I really don't understand what happen.
try >vagrant ssh from Git Bash window
To run ssh on windows, you need to download msysgit from msysgit project page and copy the ssh.exe file from msysgit/bin folder to C:\Program Files\Git\bin.
Now try again vagrant ssh from cmd, git cmd or git bash.
Note: if you prefer, you can include the msysgit/bin to path, or copy all the content of msysgit/bin to git/bin.
How can I enable/activate commandline telnet without having admin privileges? I don't wish to use putty. I wish to use native telnet that starts from commandline.
This is not necessarily the answer to activate telnet, but this does answer how to get telnet working from commandlline on windows 7 without having admin privileges and without putty.
Answer is pretty simple:
Install cygwin with inetutils for telnet http://www.question-defense.com/2010/11/30/install-telnet-using-cygwin-on-windows-7,
Add cygwin bin to my local env PATH variable https://superuser.com/questions/25037/change-environment-variables-as-standard-user-windows-7
Is it possible to run a windows xp bat script remotely from a ubuntu machine via command line?
This is possible if you have an ssh server running on the WinXP machine. It is trivial to set up such a server if you have installed Cygwin. This is well described here.
Then from an Ubuntu command line (or cron job) you run
ssh user#winxp command
Make sure your .bat has executable permissions.
I think that the technology you are after is WMI. I see that there is an ubuntu package called wmi-client, which you can sudo apt-get install and attempt to you. Some quick searches and I'm unable to find details, but maybe that will get you somewhere....
You would probably use something like remote desktop, and if you did it that way, it would work, but your question isn't very specific