Using psexec to copy files from local machine to a remote desktop - psexec

Inorder to copy files from my local system to a remote desktop I use the following command
psexec \\192.168.xx.xx -u username -p password xcopy "C:\Users\User\Desktop\source" "\\192.168.xx.xx\C$\Users\User\Desktop\target" /S /Y /F /I
I am getting a this error
0 File(s) copied
`ƒ♦╝# zü┴k
xcopy exited on 192.168.xx.xx with error code 4.

Related

Setting up Postgres server on local machine - Windows 10

I installed Postgres 14 in local machine(Windows 10), and while installation selected postgres server as well, along with pgadmin and a couple others.
However, im not sure whether postgres server is already started on my local machine.
I tried using psql, but seems the credentials are incorrect. What is the default username ? Why am i unable to connect ? Screenshots below:
Adding batch script below:
#echo off
REM Copyright (c) 2012-2020, EnterpriseDB Corporation. All rights reserved
REM PostgreSQL server psql runner script for Windows
SET server=localhost
SET /P server="Server [%server%]: "
SET database=postgres
SET /P database="Database [%database%]: "
SET port=PG_PORT
SET /P port="Port [%port%]: "
SET username=PG_USERNAME
SET /P username="Username [%username%]: "
for /f "delims=" %%a in ('chcp ^|find /c "932"') do # SET CLIENTENCODING_JP=%%a
if "%CLIENTENCODING_JP%"=="1" SET PGCLIENTENCODING=SJIS
if "%CLIENTENCODING_JP%"=="1" SET /P PGCLIENTENCODING="Client Encoding [%PGCLIENTENCODING%]: "
REM Run psql
"PG_INSTALLDIR\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%
pause
I also get this warning while installing the setup:
Edit 1: Post reinstallation , i am getting an issue which says connection refused
The path to PGSQL is wrong. Either it is saved in the variable PG_INSTALLDIR, which means it should be written between %%
%PG_INSTALLDIR%\bin\psql.exe ...
or it is not and you should write the full path like
"C:\Program Files\PostgreSQL\14\bin\psql.exe" ...

VBS opens a CMD but can't read next commands to go on other directory

I am trying to create vbs file so that it will be executed by the MS Scheduler in order to backup my Postgresql database because i can't seem to find a way in using agent since i installed it but it is not appearing in the UI of PGAdmin III that was installed when i used Odoo. I am using windows 10.
Here is my .vbs file
Set ShellCmd = WScript.CreateObject("WScript.Shell")
ShellCmd.run "cmd cd\ cd 'Program Files' cd Odoo 9.0-20161004 cd PostgreSQL cd bin pg_dump -h localhost -p 5432 -U openpg -f 'C:/BackupFiles/Sample.backup' -d 120120161800"
WScript.Echo "Success!"
When i run this, the command line isn't going anywhere. Even just "cmd cd\" the cmd does nothing. I'ts a quite simple problem but i can't get my automated backup working if i can't run a simple vbs command
Instead of using a vbs script, you should just use a .bat or .cmd batch file:
c:
cd "\Program Files\Odoo 9.0-20161004\PostgreSQL\bin"
pg_dump -h localhost -p 5432 -U openpg -f 'C:/BackupFiles/Sample.backup' -d 120120161800"
Generally, we do not use ShellCmd.run "cmd ...." in vbs to execute multiple commands in one statement.
Your ShellCmd is heavily broken. I suggest instead of using .Run take the .Exec method to catch the output - at least until problems are solved. I don't know if your pg_dump requires to be run inside that same folder, if not this might work:
Dim WshShell, oExec, s
Set WshShell = CreateObject("WScript.Shell")
Program = """C:\Program Files\Odoo 9.0-20161004\PostgreSQL\bin\pg_dump"""
Options = " -h localhost -p 5432 -U openpg -f 'C:/BackupFiles/Sample.backup' -d 120120161800"
Set oExec = WshShell.Exec(Program & Options)
Do While Not oExec.StdOut.AtEndOfStream
s = s & oExec.StdOut.ReadLine() & vbCrLf
Loop
WScript.Echo "oExec.Status=" & oExec.Status
Wscript.Echo s

copy with PSEXEC hangs some times in batch execution

im copying multiple files to server Machine using PSEXEC,Calling Psexec is through perl file
my $exit_code5 = system("cmd /c c:\\PsExec.exe \\\\$host_name -u $user_name -p \ $pwd cmd /c xcopy \"\\\\$client\\c\$\\sif folder\\$val\" \"c:\\sif folder\\\" /O /X /E /H /K /Y /q");
sleep(20);
}
if($exit_code5!=0)
{
}
This command is working fine , but sometimes in batch executions it randomly fails
-----Copying files to BackUpFolder SiebsvrBackUp created in C Drive-----
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
and will be in hang state... Is there any consistent way to perform multiple file copy using PSEXEC, Have tried COPY Command to, but no use
Try adding -d in your command since it doesn't wait for the process to terminate
https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

User input path psftp script batch file

I am trying to implement a scenerio like the user should give a path and the path should be binded to another .
bat file and that path should be the destination where am going to put my file from local.
My code looks like this:
Getfile.bat:
set /P INPUT=Type input:
psftp <user>#<IP> -b D:\FileTransfer.bat -pw <PW>
Filetransfer.bat:
cd %INPUT%
lcd d:\
put log.sh
Error :Access denied Remote working directory is /home/irisuser Directory /home/irisuser/%INPUT%: no such file or directory
Your variable %INPUT% is not passed to Filetransfer.bat. If you want psftp to cd into a user-defined directory, you have to create Filetransfer.bat on the fly:
set /P INPUT=Type input:
>D:\Filetransfer.bat echo.cd %INPUT%
>>D:\Filetransfer.bat echo.lcd d:\
>>D:\Filetransfer.bat echo.put log.sh
psftp <user>#<IP> -b D:\FileTransfer.bat -pw <PW>

Why doesn't this work

Why doesn't this work? I want to copy the file to the remote machine and run it.
psexec \\epo-test -c C:\temp\Avmr64.msi /Silent
Heres the error I get
PsExec could not start Avmr64.msi on epo-test:
The system cannot find the file specified.
I am trying to copy Avmr64.msi over to epo-test and run a silent install but I get this
PsExec could not start Avmr64.msi on epo-test:
The system cannot find the file specified.
Any help would be great.
For those that are interested heres the answer
psexec -u domain\username \\system -s -i -d msiexec.exe /i "\\share\folder\msifile" /qb
I think what you're trying to run here is "/Silent". Try instead:
psexec \\epo-test -c C:\temp\Avmr64.msi "C:\temp\Avmr64.msi /Silent"
or something in that fashion.
Try the below ( untested ):
psexec \\epo-test -c C:\temp\Avmr64.msi "msiexec /i /passive Avmr64.msi"
http://forum.sysinternals.com/topic2542.html