Jump to content

psexec: copy and remote installation --- remote execute - deep freeze


Recommended Posts

Posted

Hi :)

 

I suck at any form of scripting!!

 

But i need to copy+execute files to a bunch of remote machines.

Its in my Deep freeze environment so it has to be with psexec.

 

Thus far I got this down:

 

\\ipadress\ -u -p -w -c c:\ -h cscript.exe "F:\"

 

I would like to copy the files to all my computers in my environment, and execute the files + create a log file with errors and succes.

The local computer and the remote computers are not the same, so maybe i can't use the "-c" switch.

 

I have also tried to make a .cmd file and run it.

 

xcopy "F:" c:\tempup\ /y

Start /wait c:\tempup\_sccm_install.vbs

RD C:\Tempup\ /S /Q

 

But that does not work either.

 

The thing is, that not matter what i do, the cmd just blinks and i have no way of seeing what went wrong.

 

if anybody can tell me, very slowly what i'm doing wrong, i would be a very happy man. :)

Posted

I noticed the following issues in the syntax:

 

Directly after using the switch -w a working directory has not been definded.

Directly after using the switch -c the full path to the command you wish to copy over has not been definded.

Posted
...The thing is, that not matter what i do, the cmd just blinks and i have no way of seeing what went wrong...

 

Have you tried adding pause to the end of your batch file:

 

xcopy "F:" c:\tempup\ /yStart /wait c:\tempup\_sccm_install.vbs
RD C:\Tempup\ /S /Q 
Pause

 

That way when the command executes it should stay on screen displaying any [error] message until you press return (provided it can get to the pause command) If it does not stay on screen you could insert more pauses:

 

xcopy "F:" c:\tempup\ /y
Pause
Start /wait c:\tempup\_sccm_install.vbs
Pause
RD C:\Tempup\ /S /Q 
Pause

 

Then step through each line executing one at a time.

 

HTH.

Posted
Have you tried adding pause to the end of your batch file:

 

xcopy "F:" c:\tempup\ /yStart /wait c:\tempup\_sccm_install.vbs
RD C:\Tempup\ /S /Q 
Pause

 

That way when the command executes it should stay on screen displaying any [error] message until you press return (provided it can get to the pause command) If it does not stay on screen you could insert more pauses:

 

xcopy "F:" c:\tempup\ /y
Pause
Start /wait c:\tempup\_sccm_install.vbs
Pause
RD C:\Tempup\ /S /Q 
Pause

 

Then step through each line executing one at a time.

 

HTH.

 

 

This is how it looking now, When I execute it inside Deep freeze, it still just blinks.

 

 

I made the script below into a .cmd

To start the copying and executing of the _sccm_install.vbs

 

xcopy "Path to file on local computer" c:\tempup\ /y

pause

Start /wait c:\tempup\_sccm_install

pause

RD C:\Tempup\ /S /Q

pause

 

When I double click the .cmd it tells me that the file is copied, which I don't understand because its a big file so it should take a couple of minuts to copy.

But after that it will say: error: "c:\tempup\_sccm_install.conf does not exist, leaving script."

 

Sorry if I sound a bit confusing, but i have been trying make this work for a long time, plus i didn't get to much sleep last night.

Posted
I noticed the following issues in the syntax:

 

Directly after using the switch -w a working directory has not been definded.

Directly after using the switch -c the full path to the command you wish to copy over has not been definded.

 

I'm not quit sure what you mean.

 

\\ipadress\ -u -p -w -c c:\ -h cscript.exe "F:\"

The working directory is there.?

 

Can you write a example of what you mean with -w -c.

 

Thank you :)

Posted
...When I double click the .cmd it tells me that the file is copied, which I don't understand because its a big file so it should take a couple of minuts to copy.

But after that it will say: error: "c:\tempup\_sccm_install.conf does not exist, leaving script."...

 

After it has hit the first 'pause', and while it is still paused, have you checked the target path to see if the copying has indeed completed?

 

Regardless of the message saying that the file has copied there is no point in trying to troubleshoot problems beyond this point if the copying is unsuccessful.

Posted
I'm not quit sure what you mean.

 

\\ipadress\ -u -p -w -c c:\ -h cscript.exe "F:\"

The working directory is there.?

 

Can you write a example of what you mean with -w -c.

 

Thank you :)

 

Give this a try:

psexec \\ipaddress\ -u name -p password -w c:\ -c F:\Local\Path\Here\VBS-Filename-Here.vbs -h cscript.exe VBS-Filename-Here.vbs

Posted
After it has hit the first 'pause', and while it is still paused, have you checked the target path to see if the copying has indeed completed?

 

Regardless of the message saying that the file has copied there is no point in trying to troubleshoot problems beyond this point if the copying is unsuccessful.

 

No nothing has been copied.

 

fyi: :)

This is what in trying to do.

Posted
No nothing has been copied...

 

Can you copy the files manually?

 

If you can are you allowed to run the script manually (as if copy had been successful?)

Posted
Give this a try:

psexec \\ipaddress\ -u name -p password -w c:\ -c F:\Local\Path\Here\VBS-Filename-Here.vbs -h cscript.exe VBS-Filename-Here.vbs

 

I get a unknown user name or bad password.

But the user name and password are correct.!

 

"\\ipadress\ -u -p -w c:\ -c F:\Local\Path\Here\VBS-Filename-Here.vbs -h cscript.exe VBS-Filename-Here.vbs"

 

I have also tried with netbios name but i still get a user name or password error.!?

Posted (edited)

Spend all day trying to figure this out.

 

So fare I have done

 

Disable firewall

 

Enable file and printer sharing:

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes

 

change this keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System”

LocalAccountTokenFilterPolicy

reg_dword 32

1

 

 

 

 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters

reg_dword 32

AutoShareServer and AutoShareWks values

1

 

F:\_PSTools>PSEXEC.exe \\ipadress -i -u -p Msiexec.exe /i "c:\Path to file on remote computer.msi" /quiet /norestart

 

The file is copied to the remote machine Copy+past.

The file path is the correct one, it's copy and past from the remote computer.

So why do i get a

 

PsExec could not start ?u on xxx.xxx.xxx.xxx:

The system cannot find the file specified.

 

>psexec \\ipadress -u -p cmd

When i use this command i get the remote computers cmd, in my cmd.

So that works,,but thats the only thing that works.

Edited by denmyos
Posted
Very odd. Are you able to give use the content of the vbs file to see what is trying to run?

 

That would change anything since I also get it when do a

PSEXEC.EXE \\IPadress -u -p ECHO "SUCCESS > C:\PSEXECTEST.TXT"

Posted
That would change anything since I also get it when do a

PSEXEC.EXE \\IPadress -u -p ECHO "SUCCESS > C:\PSEXECTEST.TXT"

 

If I run that command here I get an issue due to the Echo command not being found. The following test should work though:

PSEXEC.EXE \\IPadress -u -p cmd "/k ECHO SUCCESS > C:\PSEXECTEST.TXT"

Posted
Out of interest... when you type the username, is it in the format of DOMAIN\User or PC\User? If not it will cause a The user name or password is incorrect as you said you were having.
Posted (edited)

Hmmm.

It's actually in a workgroup so a just type the user.

But I'll try with workgroup\user and pc\user.

 

just tried workgroupname\user name

And

Pc name\User name

 

To make it simple I tried this:

 

PSEXEC \\ -u \ -p ECHO "SUCCESS > C:\PSEXECTEST.TXT

 

PsExec could not start ?u on xxx.xxx.xxx.xxx:

The system cannot find the file specified.

 

I have the feeling that its the psexecsvc it can't find.?

 

When using your command

PSEXEC.EXE \\IPadress -u -p cmd "/k ECHO SUCCESS > C:\PSEXECTEST.TXT"

 

I get a access denied, even though I used workgroupname\username or pcname\username.

Edited by denmyos
Posted

PSEXEC.EXE \\IPadress -u -p cmd "/k ECHO SUCCESS > C:\PSEXECTEST.TXT"

 

Shouldn't this be this instead:

 

 

PSEXEC.EXE \\IPadress -u -p cmd /k ECHO "SUCCESS > C:\PSEXECTEST.TXT"

 

Since the /k belong to the cmd? (I'm just guessing, I have really no idea what im talking about)

 

But if i use PSEXEC.EXE \\IPadress -u -p cmd /k ECHO "SUCCESS > C:\PSEXECTEST.TXT"

I get a "SUCCESS > C:\PSEXECTEST.TXT" in my cmd.

 

?

Posted
PSEXEC.EXE \\IPadress -u -p cmd "/k ECHO SUCCESS > C:\PSEXECTEST.TXT"

 

Shouldn't this be this instead:

 

 

PSEXEC.EXE \\IPadress -u -p cmd /k ECHO "SUCCESS > C:\PSEXECTEST.TXT"

 

Since the /k belong to the cmd? (I'm just guessing, I have really no idea what im talking about)

 

But if i use PSEXEC.EXE \\IPadress -u -p cmd /k ECHO "SUCCESS > C:\PSEXECTEST.TXT"

I get a "SUCCESS > C:\PSEXECTEST.TXT" in my cmd.

 

?

 

I just thought I would keep the speach marks you used to encapsulate all of the arguments, as it would error when using the > without encapsulation. Though it worked fine here, but I am testing on domain joined machines.

Posted

This work with 1 computer.

 

 

robocopy -s F:\_Princh\_Silent_install_peter_1.2 "\\computername\c$\temp\_princh_1.2"

pause

cd /

pause

F:

pause

cd _pstools

pause

psexec -i -s -d @COMputerlist.txt cscript.exe /nologo "C$\Temp\_princh_1.2\_sccm_install.vbs"

pause

RD C:\Temp\_princh_1.2 /S /Q

pause

 

 

But now stuck on how to copy to multiple computer.

I have about 130 computer, which names changes, so is has to be something easy. @COMputerlist.txt seems to be the easy way to go, but I can't find a easy way for robocopy to use a @COMputerlist.

 

the pause is for me to see what is going on. :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...